--- a/mm/memcontrol.c~mm-memcg-save-some-atomic-ops-when-flush-is-already-true +++ a/mm/memcontrol.c @@ -2246,7 +2246,7 @@ static void drain_all_stock(struct mem_c if (memcg && stock->nr_pages && mem_cgroup_is_descendant(memcg, root_memcg)) flush = true; - if (obj_stock_flush_required(stock, root_memcg)) + else if (obj_stock_flush_required(stock, root_memcg)) flush = true; rcu_read_unlock();