The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hongfu Li <hongfu.li@linux.dev>
To: ljs@kernel.org
Cc: akpm@linux-foundation.org, david@kernel.org, hongfu.li@linux.dev,
	liam@infradead.org, lihongfu@kylinos.cn,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	mhocko@suse.com, rppt@kernel.org, surenb@google.com,
	vbabka@kernel.org
Subject: Re: [PATCH v2 1/2] mm: Use a folio in the softleaf_is_device_private path
Date: Fri, 31 Jul 2026 17:40:54 +0800	[thread overview]
Message-ID: <20260731094054.90791-1-hongfu.li@linux.dev> (raw)
In-Reply-To: <amdkR-gX_ABcKyCQ@lucifer>

> >  mm/memory.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> >
> > diff --git a/mm/memory.c b/mm/memory.c
> > index d5e87624f692..ae521baa8c84 100644
> > --- a/mm/memory.c
> > +++ b/mm/memory.c
> > @@ -4871,18 +4871,19 @@ vm_fault_t do_swap_page(struct vm_fault *vmf)
> >  				goto unlock;
> >
> 
> Up here we have:
> 
> 			vmf->page = softleaf_to_page(entry);
> 			vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,
> 					vmf->address, &vmf->ptl);
> 			if (unlikely(!vmf->pte ||
> 				     !pte_same(ptep_get(vmf->pte),
> 							vmf->orig_pte)))
> 
> Since we're canonicalising to folio why not actually set folio using
> softleaf_to_folio()?
> 
> So
> 
> +			folio = softleaf_to_folio(entry);
> -			vmf->page = softleaf_to_page(entry);
> +			vmf->page = &folio->page;
> 
> This would also make more sense in your 2/2. But more on that in a sec.

Thanks, I've thought through your suggestion carefully.

Could entry reference a tail page of a folio here? 
If so, softleaf_to_folio() retrieves the folio containing this page,
and vmf->page = &folio->page would point to the folio's head page,
which may not be correct.

Best regards,
Hongfu

  reply	other threads:[~2026-07-31  9:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  3:07 [PATCH v2 0/2] mm: folio conversion and refactoring in do_swap_page() Hongfu Li
2026-07-23  3:07 ` [PATCH v2 1/2] mm: Use a folio in the softleaf_is_device_private path Hongfu Li
2026-07-27 16:29   ` Lorenzo Stoakes (ARM)
2026-07-31  9:40     ` Hongfu Li [this message]
2026-07-31 13:06       ` Lorenzo Stoakes (ARM)
2026-07-23  3:07 ` [PATCH v2 2/2] mm: Extract non-swap page handling to do_non_swap_page() Hongfu Li
2026-07-24 19:33   ` David Hildenbrand (Arm)
2026-07-27 12:10     ` Hongfu Li
2026-07-27 12:16       ` David Hildenbrand (Arm)
2026-07-27 13:58         ` Lorenzo Stoakes (ARM)
2026-07-28  3:21         ` Hongfu Li
2026-07-28  3:13     ` Christoph Hellwig
2026-07-27 16:30   ` Lorenzo Stoakes (ARM)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260731094054.90791-1-hongfu.li@linux.dev \
    --to=hongfu.li@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=david@kernel.org \
    --cc=liam@infradead.org \
    --cc=lihongfu@kylinos.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=rppt@kernel.org \
    --cc=surenb@google.com \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox