Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mm: memcontrol: use __account_obj_stock() in the !locked path

Make __account_obj_stock() usable for the case where the local trylock
failed. Then switch refill_obj_stock() over to it.

This consolidates the mod_objcg_mlstate() call into one place and will
make the next patch easier to follow.

Link: https://lkml.kernel.org/r/20260302195305.620713-5-hannes@cmpxchg.org
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Roman Gushchin <roman.gushchin@linux.dev>
Reviewed-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
Reviewed-by: Hao Li <hao.li@linux.dev>
Cc: Johannes Weiner <jweiner@meta.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Muchun Song <muchun.song@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Johannes Weiner and committed by
Andrew Morton
4665aa7e edb6abd3

+5 -1
+5 -1
mm/memcontrol.c
··· 2969 2969 { 2970 2970 int *bytes; 2971 2971 2972 + if (!stock) 2973 + goto direct; 2974 + 2972 2975 /* 2973 2976 * Save vmstat data in stock and skip vmstat array update unless 2974 2977 * accumulating over a page of vmstat data or when pgdat changes. ··· 3011 3008 nr = 0; 3012 3009 } 3013 3010 } 3011 + direct: 3014 3012 if (nr) 3015 3013 mod_objcg_mlstate(objcg, pgdat, idx, nr); 3016 3014 } ··· 3128 3124 stock = trylock_stock(); 3129 3125 if (!stock) { 3130 3126 if (pgdat) 3131 - mod_objcg_mlstate(objcg, pgdat, idx, nr_acct); 3127 + __account_obj_stock(objcg, NULL, nr_acct, pgdat, idx); 3132 3128 nr_pages = nr_bytes >> PAGE_SHIFT; 3133 3129 nr_bytes = nr_bytes & (PAGE_SIZE - 1); 3134 3130 atomic_add(nr_bytes, &objcg->nr_charged_bytes);