Linux filesystem development
 help / color / mirror / Atom feed
From: "Zi Yan" <ziy@nvidia.com>
To: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>,
	"David Hildenbrand" <david@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Zach O'Keefe" <zokeefe@google.com>,
	"Hugh Dickins" <hughd@google.com>,
	"Lorenzo Stoakes" <ljs@kernel.org>,
	"Baolin Wang" <baolin.wang@linux.alibaba.com>
Cc: "Liam R. Howlett" <liam@infradead.org>,
	"Nico Pache" <nico.pache@linux.dev>,
	"Ryan Roberts" <ryan.roberts@arm.com>,
	"Dev Jain" <dev.jain@arm.com>, "Barry Song" <baohua@kernel.org>,
	"Lance Yang" <lance.yang@linux.dev>,
	"Usama Arif" <usama.arif@linux.dev>,
	"Kiryl Shutsemau" <kas@kernel.org>,
	"Vlastimil Babka" <vbabka@kernel.org>,
	"Mike Rapoport" <rppt@kernel.org>,
	"Michal Hocko" <mhocko@suse.com>, <linux-mm@kvack.org>,
	"Matthew Wilcox" <willy@infradead.org>, "Jan Kara" <jack@suse.cz>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Rik van Riel" <riel@surriel.com>,
	"Song Liu" <songliubraving@fb.com>,
	<linux-fsdevel@vger.kernel.org>, <stable@vger.kernel.org>
Subject: Re: [PATCH v3 3/3] mm/memory: don't allocate in finish_fault() with the folio locked
Date: Tue, 01 Dec 2026 20:19:19 -0500	[thread overview]
Message-ID: <DN9UO5IF46VU.11ACSVUAQDLVI@nvidia.com> (raw)
In-Reply-To: <20261201115332.88194-4-azpijr@gmail.com>

On Tue Dec 1, 2026 at 6:53 AM EST, Jose A. Perez de Azpillaga wrote:
> __do_fault() tries to avoid page table allocation in finish_fault() by
> pre-allocating one if the PMD is empty.
>
> However, it is no longer safe to assume that a page table found here
> (thus avoiding pre-allocation) remains in place, since
> retract_page_tables() no longer takes the mmap and VMA locks. If the
> table is retracted, finish_fault() allocates one with the folio locked,
> which can deadlock in reclaim.
>
> If the folio can't be mapped with a PMD, return VM_FAULT_NOPAGE instead,
> as we already do when pte_offset_map_lock() fails. The retry
> preallocates the page table, so it only loops if the table is retracted
> again every time.
>
> Fixes: 1d65b771bc08 ("mm/khugepaged: retract_page_tables() without mmap or vma lock")
> Cc: stable@vger.kernel.org
> Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> Reviewed-by: David Hildenbrand (Arm) <david@kernel.org>
> Signed-off-by: Jose A. Perez de Azpillaga <azpijr@gmail.com>
> ---
> Changes in v3:
> - take Lorenzo's finish_fault() comment
> - note at the __do_fault() preallocation that it is best-effort
>   (Lorenzo)
> - reword the changelog opener, mention the NOPAGE retry, drop the
>   memcg v1 example (Lorenzo)
>
> Changes in v2:
> - return VM_FAULT_NOPAGE after trying do_set_pmd() (David)
> - drop the ppc64 sentence, do_set_pmd() is handled on its own now
>
> v2: https://lore.kernel.org/20261127091344.113688-4-azpijr@gmail.com
> v1: https://lore.kernel.org/20261125100058.15200-3-azpijr@gmail.com
>
>  mm/memory.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>

LGTM.

Reviewed-by: Zi Yan <ziy@nvidia.com>


-- 
Best Regards,
Yan, Zi


  parent reply	other threads:[~2026-12-02  1:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 11:53 [PATCH v3 0/3] mm: don't allocate page tables with the folio locked Jose A. Perez de Azpillaga
2026-12-01 11:53 ` [PATCH v3 1/3] mm/memory: allocate the deposit page table with NOFS in do_set_pmd() Jose A. Perez de Azpillaga
2026-12-01 11:53 ` [PATCH v3 2/3] mm/khugepaged: allocate page tables with NOFS in set_huge_pmd() Jose A. Perez de Azpillaga
2026-12-01 11:53 ` [PATCH v3 3/3] mm/memory: don't allocate in finish_fault() with the folio locked Jose A. Perez de Azpillaga
2026-12-01 11:56   ` Lorenzo Stoakes (ARM)
2026-12-02  1:19   ` Zi Yan [this message]
2026-12-01 12:47 ` (subset) [PATCH v3 0/3] mm: don't allocate page tables " David Hildenbrand
2026-12-01 12:49 ` David Hildenbrand

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=DN9UO5IF46VU.11ACSVUAQDLVI@nvidia.com \
    --to=ziy@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=azpijr@gmail.com \
    --cc=baohua@kernel.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=kas@kernel.org \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=mhocko@suse.com \
    --cc=nico.pache@linux.dev \
    --cc=riel@surriel.com \
    --cc=rppt@kernel.org \
    --cc=ryan.roberts@arm.com \
    --cc=songliubraving@fb.com \
    --cc=stable@vger.kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=willy@infradead.org \
    --cc=zokeefe@google.com \
    /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