Skip to content

Commit 0ccf180

Browse files
shakeelbakpm00
authored andcommitted
memcg: no stock lock for cpu hot-unplug
Previously on the cpu hot-unplug, the kernel would call drain_obj_stock() with objcg local lock. However local lock was not needed as the stock which was accessed belongs to a dead cpu but we kept it there to disable irqs as drain_obj_stock() may call mod_objcg_mlstate() which required irqs disabled. However there is no need to disable irqs now for mod_objcg_mlstate(), so we can remove the local lock altogether from cpu hot-unplug path. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Shakeel Butt <[email protected]> Acked-by: Vlastimil Babka <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Johannes Weiner <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Muchun Song <[email protected]> Cc: Roman Gushchin <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent eee8a17 commit 0ccf180

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

mm/memcontrol.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,17 +2023,8 @@ void drain_all_stock(struct mem_cgroup *root_memcg)
20232023

20242024
static int memcg_hotplug_cpu_dead(unsigned int cpu)
20252025
{
2026-
struct obj_stock_pcp *obj_st;
2027-
unsigned long flags;
2028-
2029-
obj_st = &per_cpu(obj_stock, cpu);
2030-
2031-
/* drain_obj_stock requires objstock.lock */
2032-
local_lock_irqsave(&obj_stock.lock, flags);
2033-
drain_obj_stock(obj_st);
2034-
local_unlock_irqrestore(&obj_stock.lock, flags);
2035-
20362026
/* no need for the local lock */
2027+
drain_obj_stock(&per_cpu(obj_stock, cpu));
20372028
drain_stock_fully(&per_cpu(memcg_stock, cpu));
20382029

20392030
return 0;

0 commit comments

Comments
 (0)