From: Alexander Gordeev <agordeev@linux.ibm.com>
To: Zi Yan <ziy@nvidia.com>
Cc: David Hildenbrand <david@kernel.org>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
"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>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Gerald Schaefer <gerald.schaefer@linux.ibm.com>,
Heiko Carstens <hca@linux.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Christian Borntraeger <borntraeger@linux.ibm.com>,
Sven Schnelle <svens@linux.ibm.com>,
John Hubbard <jhubbard@nvidia.com>, Peter Xu <peterx@redhat.com>,
linux-s390@vger.kernel.org, Jason Gunthorpe <jgg@ziepe.ca>
Subject: Re: [PATCH for 7.4-rc2+ 4/7] s390/mm: always clear _SEGMENT_ENTRY_READ in pmdp_invalidate()
Date: Wed, 2 Dec 2026 11:20:35 +0100 [thread overview]
Message-ID: <a3ff1975-8348-4be5-8979-dd8ffb427d59-agordeev@linux.ibm.com> (raw)
In-Reply-To: <382AD8E8-026E-4FB2-8A19-76EA0DC5285F@nvidia.com>
On Tue, Dec 01, 2026 at 04:47:16PM -0500, Zi Yan wrote:
> On 1 Dec 2026, at 10:41, Alexander Gordeev wrote:
>
> > On Tue, Dec 01, 2026 at 10:06:11AM -0500, Zi Yan wrote:
> >> Thanks. What is the plan for upstreaming this? 7.4-rcX or 7.5-rcX?
> >> I would like to keep track of it for V2, since Patch 6 and 7 depend
> >> on it. In addition, I will need to convert 3 more places in V2 to
> >> use pmdp_invalidate(), so V2 will take a while.
> >
> > This is 7.5-rc1 material. Do you expect v2 could make it into 7.5?
> > If so, I would rather get it as a whole via the mm tree.
>
> Yes, I am working on it.
Great! With your original message slightly reworded:
pmdp_invalidate() sets _SEGMENT_ENTRY_INVALID, but that bit alone does
not make the entry pmd_protnone(). Clear the _SEGMENT_ENTRY_READ as
well, so that GUP-fast backs off and no longer grabs a reference to a
folio mapped by the invalidated PMD.
Code can invalidate a PMD and then based on folio refcount decides
whether it may drop the mapping. That relies on GUP-fast backing off
from an invalidated PMD, as it does on x86, arm64, and powerpc.
With CONFIG_PAGE_TABLE_CHECK, pmdp_invalidate() already clears
_SEGMENT_ENTRY_READ, which makes the entry pmd_protnone(), so GUP-fast
does not follow it. Do that unconditionally. As noted in commit
7b4dde5e40ad6 ("s390/pgtable: Add s390 support for page table check"),
an invalidated PMD that is pmd_protnone() is fine for the remaining
pmd_protnone() users, which run under the page table lock or are
lockless walkers that should not follow it anyway.
Reviewed-by: Alexander Gordeev <agordeev@linux.ibm.com>
> Best Regards,
> Yan, Zi
Thanks!
next prev parent reply other threads:[~2026-12-02 10:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 18:13 [PATCH for 7.4-rc2+ 0/7] Re-enable discarding lazyfree THPs at PMD level Zi Yan
2026-10-15 18:13 ` [PATCH for 7.4-rc2+ 1/7] powerpc/book3s64/mm: don't count invalidated PMDs in page table check Zi Yan
2026-11-27 16:27 ` Usama Arif
2026-10-15 18:13 ` [PATCH for 7.4-rc2+ 2/7] riscv: mm: don't let GUP-fast follow invalidated THP PMDs Zi Yan
2026-10-16 2:41 ` Zi Yan
2026-10-15 18:13 ` [PATCH for 7.4-rc2+ 3/7] LoongArch: " Zi Yan
2026-10-15 18:13 ` [PATCH for 7.4-rc2+ 4/7] s390/mm: always clear _SEGMENT_ENTRY_READ in pmdp_invalidate() Zi Yan
2026-11-16 8:06 ` Alexander Gordeev
2026-12-01 4:06 ` Zi Yan
2026-12-01 9:20 ` Alexander Gordeev
2026-12-01 15:06 ` Zi Yan
2026-12-01 15:41 ` Alexander Gordeev
2026-12-01 21:47 ` Zi Yan
2026-12-02 10:20 ` Alexander Gordeev [this message]
2026-11-27 13:14 ` Gerald Schaefer
2026-10-15 18:13 ` [PATCH for 7.4-rc2+ 5/7] sparc64: mm: fix thp_pte_count accounting around pmdp_invalidate() Zi Yan
2026-10-15 18:13 ` [PATCH for 7.4-rc2+ 6/7] mm/huge_memory: avoid transient none PMDs during lazyfree reclaim Zi Yan
2026-10-15 18:13 ` [PATCH for 7.4-rc2+ 7/7] mm/rmap: re-enable discarding lazyfree THPs at PMD level Zi Yan
2026-10-16 2:47 ` Zi Yan
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=a3ff1975-8348-4be5-8979-dd8ffb427d59-agordeev@linux.ibm.com \
--to=agordeev@linux.ibm.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=borntraeger@linux.ibm.com \
--cc=david@kernel.org \
--cc=dev.jain@arm.com \
--cc=gerald.schaefer@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=harry@kernel.org \
--cc=hca@linux.ibm.com \
--cc=jannh@google.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.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=linux-s390@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=nico.pache@linux.dev \
--cc=peterx@redhat.com \
--cc=riel@surriel.com \
--cc=ryan.roberts@arm.com \
--cc=svens@linux.ibm.com \
--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
all inboxes | Powered by JetHome®