The patch titled Subject: mm: do not call add_nr_deferred() with zero deferred has been removed from the -mm tree. Its filename was mm-do-not-call-add_nr_deferred-with-zero-deferred.patch This patch was dropped because it was withdrawn ------------------------------------------------------ From: Roman Gushchin <roman.gushchin@xxxxxxxxx> Subject: mm: do not call add_nr_deferred() with zero deferred add_nr_deferred() is often called with next_deferred equal to 0. For instance, it's happening under low memory pressure for any shrinkers with a low number of cached objects. A corresponding trace looks like: <...>-619914 [005] .... 467456.345160: mm_shrink_slab_end: \ super_cache_scan+0x0/0x1a0 0000000087027f06: nid: 1 \ unused scan count 0 new scan count 0 total_scan 0 \ last shrinker return val 0 <...>-619914 [005] .... 467456.345371: mm_shrink_slab_end: \ super_cache_scan+0x0/0x1a0 0000000087027f06: nid: 1 \ unused scan count 0 new scan count 0 total_scan 0 \ last shrinker return val 0 <...>-619914 [005] .... 467456.345380: mm_shrink_slab_end: \ super_cache_scan+0x0/0x1a0 0000000087027f06: nid: 1 unused \ scan count 0 new scan count 0 total_scan 0 \ last shrinker return val 0 This lead to unnecessary checks and atomic operations, which can be avoided by checking next_deferred for not being zero before calling add_nr_deferred(). In this case the mm_shrink_slab_end trace point will get a potentially slightly outdated "new scan count" value, but it's totally fine. Link: https://lkml.kernel.org/r/20220416004104.4089743-1-roman.gushchin@xxxxxxxxx Signed-off-by: Roman Gushchin <roman.gushchin@xxxxxxxxx> Acked-by: David Hildenbrand <david@xxxxxxxxxx> Cc: Dave Chinner <dchinner@xxxxxxxxxx> Cc: Johannes Weiner <hannes@xxxxxxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Shakeel Butt <shakeelb@xxxxxxxxxx> Cc: Yang Shi <shy828301@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/vmscan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/mm/vmscan.c~mm-do-not-call-add_nr_deferred-with-zero-deferred +++ a/mm/vmscan.c @@ -797,7 +797,10 @@ static unsigned long do_shrink_slab(stru * move the unused scan count back into the shrinker in a * manner that handles concurrent updates. */ - new_nr = add_nr_deferred(next_deferred, shrinker, shrinkctl); + if (next_deferred) + new_nr = add_nr_deferred(next_deferred, shrinker, shrinkctl); + else + new_nr = nr; trace_mm_shrink_slab_end(shrinker, shrinkctl->nid, freed, nr, new_nr, total_scan); return freed; _ Patches currently in -mm which might be from roman.gushchin@xxxxxxxxx are kselftests-memcg-update-the-oom-group-leaf-events-test.patch kselftests-memcg-speed-up-the-memoryhigh-test.patch maintainers-add-corresponding-kselftests-to-cgroup-entry.patch maintainers-add-corresponding-kselftests-to-memcg-entry.patch