]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm/page_alloc: clarify terminology in migratetype fallback code
authorBrendan Jackman <jackmanb@google.com>
Tue, 25 Feb 2025 15:29:48 +0000 (15:29 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Fri, 28 Feb 2025 01:00:33 +0000 (17:00 -0800)
commitfbc2bf5860476d2cf02de00a43b2d509c55b9f52
tree774deed7be76ea8f7a89dd2572be0276602327c7
parentbe1028d3aeaec27fdeb38b187e03d8ae868a049d
mm/page_alloc: clarify terminology in migratetype fallback code

Patch series "mm/page_alloc: Some clarifications for migratetype
fallback", v3.

A couple of patches to try and make the code easier to follow.

This patch (of 2):

This code is rather confusing because:

1. "Steal" is sometimes used to refer to the general concept of
   allocating from a block of a fallback migratetype
   (steal_suitable_fallback()) but sometimes it refers specifically to
   converting a whole block's migratetype (can_steal_fallback()).

2. can_steal_fallback() sounds as though it's answering the question
   "am I functionally permitted to allocate from that other type" but in
   fact it is encoding a heuristic preference.

3. The same piece of data has different names in different places:
   can_steal vs whole_block.  This reinforces point 2 because it looks
   like the different names reflect a shift in intent from "am I allowed
   to steal" to "do I want to steal", but no such shift exists.

Fix 1. by avoiding the term "steal" in ambiguous contexts. Start using
the term "claim" to refer to the special case of stealing the entire
block.

Fix 2. by using "should" instead of "can", and also rename its
parameters and add some commentary to make it more explicit what they
mean.

Fix 3. by adopting the new "claim" terminology universally for this
set of variables.

Link: https://lkml.kernel.org/r/20250225-clarify-steal-v3-0-f2550ead0139@google.com
Link: https://lkml.kernel.org/r/20250225-clarify-steal-v3-1-f2550ead0139@google.com
Signed-off-by: Brendan Jackman <jackmanb@google.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Yosry Ahmed <yosry.ahmed@linux.dev>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/compaction.c
mm/internal.h
mm/page_alloc.c