lkml.org 
[lkml]   [2022]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 1/6] mm/page_alloc: Add page->buddy_list and page->pcp_list
On Mon, May 09, 2022 at 02:08:00PM +0100, Mel Gorman wrote:
> The page allocator uses page->lru for storing pages on either buddy or
> PCP lists. Create page->buddy_list and page->pcp_list as a union with
> page->lru. This is simply to clarify what type of list a page is on
> in the page allocator.
>
> No functional change intended.
>

Nice cleanup for me.

> Signed-off-by: Mel Gorman <mgorman@techsingularity.net>
> ---
> include/linux/mm_types.h | 5 +++++
> mm/page_alloc.c | 18 +++++++++---------
> 2 files changed, 14 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 8834e38c06a4..a2782e8af307 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -87,6 +87,7 @@ struct page {
> */
> union {
> struct list_head lru;
> +
> /* Or, for the Unevictable "LRU list" slot */
> struct {
> /* Always even, to negate PageTail */
> @@ -94,6 +95,10 @@ struct page {
> /* Count page's or folio's mlocks */
> unsigned int mlock_count;
> };
> +
> + /* Or, free page */
> + struct list_head buddy_list;
> + struct list_head pcp_list;
> };

Since you have clarified "lru" member, should we go further?
Like union "index" to "pcp_migratetype" and "private" to "order"
since buddy allocator reuses "index" and "private" as well.
My initial idea is as follows, it is more clear for me, what
do you think?

diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index dbfd892ac96a..644349a5f901 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -107,6 +107,15 @@ struct page {
*/
unsigned long private;
};
+ struct { /* pages manipulated by buddy allocator */
+ union {
+ struct list_head buddy_list;
+ struct list_head pcp_list;
+ };
+ unsigned long mapping_pad; /* Not used */
+ unsigned long pcp_migratetype;
+ unsigned long order;
+ };
struct { /* page_pool used by netstack */
/**
* @pp_magic: magic value to avoid recycling non
\
 
 \ /
  Last update: 2022-05-13 10:43    [W:2.401 / U:0.532 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site