Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Zi Yan <ziy@nvidia.com>, David Hildenbrand <david@kernel.org>,
	"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>,
	Lorenzo Stoakes <ljs@kernel.org>, Rik van Riel <riel@surriel.com>,
	Vlastimil Babka <vbabka@kernel.org>, Harry Yoo <harry@kernel.org>,
	Jann Horn <jannh@google.com>, Kyle Zeng <kylebot@openai.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Sashiko <sashiko-bot@kernel.org>
Subject: Re: [PATCH v2 8/9] mm/rmap: re-enable discarding lazyfree THPs at PMD level
Date: Fri, 4 Dec 2026 17:49:24 +0800	[thread overview]
Message-ID: <3e173239-73e2-49e9-b0b7-49e40635cc67@linux.alibaba.com> (raw)
In-Reply-To: <20261203-anon_vma_uaf_fix-v2-8-3d4c746e8839@nvidia.com>



On 12/4/26 12:17 PM, Zi Yan wrote:
> The patch "mm/rmap: don't discard lazyfree THPs at PMD level" disabled
> the PMD-level discard, because it cleared the PMD before checking whether
> the folio could be discarded, and munmap() or mremap() could skip that
> transiently none PMD.
> 
> __discard_anon_folio_pmd_locked() now keeps the PMD invalidated, not
> cleared, until the discard is committed, GUP-fast no longer follows an
> invalidated PMD on any architecture, powerpc page table check no longer
> counts an invalidated PMD as mapped, and sparc64 keeps thp_pte_count
> balanced when an invalidated PMD is set again or cleared. Discard lazyfree
> THPs at PMD level again.
> 
> Also call update_hiwater_rss() before unmap_huge_pmd_locked(), as the
> PTE path does before lowering RSS. The PMD path has skipped it since the
> PMD-level discard was added in commit 735ecdfaf4e8 ("mm/vmscan: avoid
> split lazyfree THP during shrink_folio_list()"), so a discard could lower
> RSS without recording the high watermark first, and VmHWM could be
> under-reported.
> 
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/patchset/20261015-anon_vma_uaf_fix-v1-0-7b977303b42b%40nvidia.com?part=7
> Signed-off-by: Zi Yan <ziy@nvidia.com>
> To: Andrew Morton <akpm@linux-foundation.org>
> To: David Hildenbrand <david@kernel.org>
> To: Lorenzo Stoakes <ljs@kernel.org>
> Cc: Rik van Riel <riel@surriel.com>
> Cc: "Liam R. Howlett" <liam@infradead.org>
> Cc: Vlastimil Babka <vbabka@kernel.org>
> Cc: Harry Yoo <harry@kernel.org>
> Cc: Jann Horn <jannh@google.com>
> Cc: Lance Yang <lance.yang@linux.dev>
> Cc: Kyle Zeng <kylebot@openai.com>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> ---

Make sense to me.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>


  parent reply	other threads:[~2026-12-04  9:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  4:17 [PATCH v2 0/9] Re-enable discarding lazyfree PMD THPs and transient none PMD fixes Zi Yan
2026-12-04  4:17 ` [PATCH v2 1/9] mm/migrate: do not clear device private entry in set_pmd_migration_entry() Zi Yan
2026-12-04  4:17 ` [PATCH v2 2/9] powerpc/book3s64/mm: don't count invalidated PMDs in page table check Zi Yan
2026-12-04  4:17 ` [PATCH v2 3/9] riscv: mm: don't let GUP-fast follow entries without _PAGE_READ Zi Yan
2026-12-04  4:17 ` [PATCH v2 4/9] LoongArch: mm: don't let GUP-fast follow invalidated THP PMDs Zi Yan
2026-12-04  4:17 ` [PATCH v2 5/9] s390/mm: always clear _SEGMENT_ENTRY_READ in pmdp_invalidate() Zi Yan
2026-12-04 12:31   ` Alexander Gordeev
2026-12-04  4:17 ` [PATCH v2 6/9] sparc64: mm: fix thp_pte_count accounting around pmdp_invalidate() Zi Yan
2026-12-04  4:17 ` [PATCH v2 7/9] mm/huge_memory: avoid transient none PMDs during lazyfree reclaim Zi Yan
2026-12-04  4:35   ` Liam R. Howlett
2026-12-04  9:38   ` Baolin Wang
2026-12-04 13:23   ` Lorenzo Stoakes (ARM)
2026-12-04  4:17 ` [PATCH v2 8/9] mm/rmap: re-enable discarding lazyfree THPs at PMD level Zi Yan
2026-12-04  4:37   ` Liam R. Howlett
2026-12-04  9:49   ` Baolin Wang [this message]
2026-12-04  4:17 ` [PATCH v2 9/9] userfaultfd: avoid transient none PMDs during UFFDIO_MOVE Zi Yan
2026-12-04 12:52   ` 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=3e173239-73e2-49e9-b0b7-49e40635cc67@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=david@kernel.org \
    --cc=dev.jain@arm.com \
    --cc=harry@kernel.org \
    --cc=jannh@google.com \
    --cc=kas@kernel.org \
    --cc=kylebot@openai.com \
    --cc=lance.yang@linux.dev \
    --cc=liam@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ljs@kernel.org \
    --cc=nico.pache@linux.dev \
    --cc=riel@surriel.com \
    --cc=ryan.roberts@arm.com \
    --cc=sashiko-bot@kernel.org \
    --cc=usama.arif@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=ziy@nvidia.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