mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 13:41:30 +00:00
memcg: localize memcg_kmem_enabled() check
Move the memcg_kmem_enabled() checks into memcg kmem charge/uncharge functions, so, the users don't have to explicitly check that condition. This is purely code cleanup patch without any functional change. Only the order of checks in memcg_charge_slab() can potentially be changed but the functionally it will be same. This should not matter as memcg_charge_slab() is not in the hot path. Link: http://lkml.kernel.org/r/20190103161203.162375-1-shakeelb@google.com Signed-off-by: Shakeel Butt <shakeelb@google.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Vladimir Davydov <vdavydov.dev@gmail.com> Cc: Roman Gushchin <guro@fb.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
9234bae9b2
commit
60cd4bcd62
5 changed files with 44 additions and 20 deletions
|
@ -1056,7 +1056,7 @@ static __always_inline bool free_pages_prepare(struct page *page,
|
|||
if (PageMappingFlags(page))
|
||||
page->mapping = NULL;
|
||||
if (memcg_kmem_enabled() && PageKmemcg(page))
|
||||
memcg_kmem_uncharge(page, order);
|
||||
__memcg_kmem_uncharge(page, order);
|
||||
if (check_free)
|
||||
bad += free_pages_check(page);
|
||||
if (bad)
|
||||
|
@ -4568,7 +4568,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid,
|
|||
|
||||
out:
|
||||
if (memcg_kmem_enabled() && (gfp_mask & __GFP_ACCOUNT) && page &&
|
||||
unlikely(memcg_kmem_charge(page, gfp_mask, order) != 0)) {
|
||||
unlikely(__memcg_kmem_charge(page, gfp_mask, order) != 0)) {
|
||||
__free_pages(page, order);
|
||||
page = NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue