]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm-page_alloc-batch-page-freeing-in-free_frozen_page_commit-fix
authorJoshua Hahn <joshua.hahnjy@gmail.com>
Tue, 14 Oct 2025 19:28:22 +0000 (12:28 -0700)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 15 Oct 2025 04:28:54 +0000 (21:28 -0700)
checking for 0-ness is sufficient, per Vlastimil

Since to_free and pcp->count cannot become negative, make the checks into an
equality check instead.

Link: https://lkml.kernel.org/r/20251014192827.851389-1-joshua.hahnjy@gmail.com
Signed-off-by: Joshua Hahn <joshua.hahnjy@gmail.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Chris Mason <clm@fb.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Michal Hocko <mhocko@suse.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Zi Yan <ziy@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_alloc.c

index 58cb279928a59ca7c655bcdc70c192368e0db442..0155a66d7367f1cc681b0bb5b0379a18a9a34814 100644 (file)
@@ -2884,7 +2884,7 @@ static bool free_frozen_page_commit(struct zone *zone,
                free_pcppages_bulk(zone, to_free_batched, pcp, pindex);
                to_free -= to_free_batched;
 
-               if (to_free <= 0 || pcp->count <= 0)
+               if (to_free == 0 || pcp->count == 0)
                        break;
 
                pcp_spin_unlock(pcp);