[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOzc2pxjg=ReO_3s-LWu_iwik=5ASS3qL-2dKGjd6BN6AthH2w@mail.gmail.com>
Date: Mon, 25 Sep 2023 11:57:51 -0700
From: Vishal Moola <vishal.moola@...il.com>
To: David Hildenbrand <david@...hat.com>
Cc: linux-mm@...ck.org, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 1/2] mm/khugepaged: Convert __collapse_huge_page_isolate()
to use folios
On Mon, Sep 25, 2023 at 12:18 AM David Hildenbrand <david@...hat.com> wrote:
>
> On 22.09.23 21:36, Vishal Moola (Oracle) wrote:
> > This is in preparation for the removal of the khugepaged compound_pagelist.
> >
> > Replaces 11 calls to compound_head() with 1, and removes 499 bytes of
> > kernel text.
> >
> > Signed-off-by: Vishal Moola (Oracle) <vishal.moola@...il.com>
> > ---
> > mm/khugepaged.c | 52 ++++++++++++++++++++++++-------------------------
> > 1 file changed, 26 insertions(+), 26 deletions(-)
> >
> > diff --git a/mm/khugepaged.c b/mm/khugepaged.c
> > index 88433cc25d8a..f46a7a7c489f 100644
> > --- a/mm/khugepaged.c
> > +++ b/mm/khugepaged.c
> > @@ -541,7 +541,7 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> > struct collapse_control *cc,
> > struct list_head *compound_pagelist)
> > {
> > - struct page *page = NULL;
> > + struct folio *folio = NULL;
> > pte_t *_pte;
> > int none_or_zero = 0, shared = 0, result = SCAN_FAIL, referenced = 0;
> > bool writable = false;
> > @@ -570,15 +570,15 @@ static int __collapse_huge_page_isolate(struct vm_area_struct *vma,
> > result = SCAN_PTE_UFFD_WP;
> > goto out;
> > }
> > - page = vm_normal_page(vma, address, pteval);
> > - if (unlikely(!page) || unlikely(is_zone_device_page(page))) {
> > + folio = vm_normal_folio(vma, address, pteval);
> > + if (unlikely(!folio) || unlikely(folio_is_zone_device(folio))) {
> > result = SCAN_PAGE_NULL;
> > goto out;
> > }
> >
> > - VM_BUG_ON_PAGE(!PageAnon(page), page);
> > + VM_BUG_ON_FOLIO(!folio_test_anon(folio), folio);
> >
> > - if (page_mapcount(page) > 1) {
> > + if (folio_estimated_sharers(folio) > 1) {
>
> For a tail page of a PTE-mapped THP this is not the same.
>
> The possible side effects this might have should be spelled out in the
> patch description.
Ok, I'll add the side effects to the commit message in v2.
Powered by blists - more mailing lists