[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <d7c834a2-ea3a-43a5-838a-9cf9c2870386@oracle.com>
Date: Mon, 13 Jan 2025 10:18:33 -0500
From: Sidhartha Kumar <sidhartha.kumar@...cle.com>
To: David Hildenbrand <david@...hat.com>, linux-kernel@...r.kernel.org
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Muchun Song <muchun.song@...ux.dev>,
"Matthew Wilcox (Oracle)" <willy@...radead.org>
Subject: Re: [PATCH v2 6/6] mm/hugetlb: use folio->lru int
demote_free_hugetlb_folios()
On 1/13/25 8:16 AM, David Hildenbrand wrote:
> We are demoting hugetlb folios to smaller hugetlb folios; let's avoid
> messing with pages where avoidable and handle it more similar to
> __split_huge_page_tail().
>
> Signed-off-by: David Hildenbrand <david@...hat.com>
> ---
> mm/hugetlb.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index bc4ab45d9b93b..a94d52dd53728 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -3822,13 +3822,15 @@ static long demote_free_hugetlb_folios(struct hstate *src, struct hstate *dst,
>
> for (i = 0; i < pages_per_huge_page(src); i += pages_per_huge_page(dst)) {
> struct page *page = folio_page(folio, i);
> + /* Careful: see __split_huge_page_tail() */
> + struct folio *new_folio = (struct folio *)page;
>
> - page->mapping = NULL;
> clear_compound_head(page);
> prep_compound_page(page, dst->order);
>
> - init_new_hugetlb_folio(dst, page_folio(page));
> - list_add(&page->lru, &dst_list);
> + new_folio->mapping = NULL;
> + init_new_hugetlb_folio(dst, new_folio);
> + list_add(&new_folio->lru, &dst_list);
> }
> }
>
Reviewed-by: Sidhartha Kumar <sidhartha.kumar@...cle.com>
Powered by blists - more mailing lists