[PATCH] mm/page_alloc: Add some comments for specific scenarios to make it easier to understand why unmovable and reclaimable allocations can steal from moveable pageblocks by default.

Xiang Gao posted 1 patch 2 months, 1 week ago
mm/page_alloc.c | 7 +++++++
1 file changed, 7 insertions(+)
[PATCH] mm/page_alloc: Add some comments for specific scenarios to make it easier to understand why unmovable and reclaimable allocations can steal from moveable pageblocks by default.
Posted by Xiang Gao 2 months, 1 week ago
From: gaoxiang17 <gaoxiang17@xiaomi.com>

Signed-off-by: gaoxiang17 <gaoxiang17@xiaomi.com>
---
 mm/page_alloc.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 91ace8ca97e2..cc8a7a0772cb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1818,6 +1818,13 @@ static bool can_steal_fallback(unsigned int order, int start_mt)
 	if (order >= pageblock_order)
 		return true;
 
+	/*
+	 * The reasons why unmovable and reclaimable allocations can steal from
+	 * moveable pageblocks by default aside from the above comments, a different
+	 * and better understood scenario is: System initializations are all movable
+	 * pageblocks. If you want to alloc unmovable and reclaimable pages,
+	 * you have to steal from moveable pageblocks or it may fail.
+	 */
 	if (order >= pageblock_order / 2 ||
 		start_mt == MIGRATE_RECLAIMABLE ||
 		start_mt == MIGRATE_UNMOVABLE ||
-- 
2.34.1
Re: [PATCH] mm/page_alloc: Add some comments for specific scenarios to make it easier to understand why unmovable and reclaimable allocations can steal from moveable pageblocks by default.
Posted by Anshuman Khandual 2 months, 1 week ago
The subject line is too big.

On 9/18/24 10:28, Xiang Gao wrote:
> From: gaoxiang17 <gaoxiang17@xiaomi.com>

Also there is no commit message here as well.

Please do follow the instructions for submitting patches as explained
in the documentation below and then resend the patch.

https://www.kernel.org/doc/html/v6.11/process/submitting-patches.html

> 
> Signed-off-by: gaoxiang17 <gaoxiang17@xiaomi.com>
> ---
>  mm/page_alloc.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 91ace8ca97e2..cc8a7a0772cb 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1818,6 +1818,13 @@ static bool can_steal_fallback(unsigned int order, int start_mt)
>  	if (order >= pageblock_order)
>  		return true;
>  
> +	/*
> +	 * The reasons why unmovable and reclaimable allocations can steal from
> +	 * moveable pageblocks by default aside from the above comments, a different
> +	 * and better understood scenario is: System initializations are all movable
> +	 * pageblocks. If you want to alloc unmovable and reclaimable pages,
> +	 * you have to steal from moveable pageblocks or it may fail.
> +	 */

Although there are sufficient comments for this particular function, it
does seem like this new comment tries to explain why using unmovable and
reclaimable migrate types as steal fallback makes sense. But this can use
some clean up and rewriting.

>  	if (order >= pageblock_order / 2 ||
>  		start_mt == MIGRATE_RECLAIMABLE ||
>  		start_mt == MIGRATE_UNMOVABLE ||