From: "David Hildenbrand (Red Hat)" <david@kernel.org>
To: Dev Jain <dev.jain@arm.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
akpm@linux-foundation.org
Cc: axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com,
Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org,
surenb@google.com, mhocko@suse.com, riel@surriel.com,
harry.yoo@oracle.com, jannh@google.com, ryan.roberts@arm.com,
baohua@kernel.org, baolin.wang@linux.alibaba.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH mm-unstable] mm: Fix uffd-wp bit loss when batching file folio unmapping
Date: Fri, 16 Jan 2026 11:51:17 +0100 [thread overview]
Message-ID: <5af933d1-8c64-4d3c-b835-d90c8e9f771a@kernel.org> (raw)
In-Reply-To: <4b784eef-e874-45a6-828a-4fc2acab6fb7@arm.com>
On 1/16/26 10:40, Dev Jain wrote:
>
> On 16/01/26 2:09 pm, Lorenzo Stoakes wrote:
>> On Fri, Jan 16, 2026 at 01:57:21PM +0530, Dev Jain wrote:
>>> The recently added file folio unmap batching support forgets to update
>>> pte_install_uffd_wp_if_needed(), which still updates a single pte.
>>> We end up jumping to the end of the folio in page_vma_mapped_walk(), thus
>>> setting the uffd-wp marker only on a single pte in the batch. Fix this by
>>> passing nr_pages into the function, and set the uffd-wp marker on all ptes.
>>>
>>> Note that, since the nr_pages passed to this function is always derived by
>>> some sort of batching, it is guaranteed that the set of old ptevals of the
>>> batch have uffd-wp bit on all ptes or no ptes, therefore it is safe to derive
>>> the value of the local variable "arm_uffd_pte" from only the particular
>>> pteval passed to this function, but apply the result on all ptes of the batch.
>>>
>>> Use set_pte_at() in a loop to set the markers - we cannot use set_ptes()
>>> as that will increment the PFN, but we don't have any PFN to update here.
>>>
>>> The userspace visible effect of the bug is inaccuracy observed by workloads
>>> relying on uffd-wp regions to install their own pages.
>>>
>>> Fixes: 8798e255b5ec ("mm: rmap: support batched unmapping for file large folios")
>> Hmm this patch isn't upstream yet, so wouldn't this patch be better as a comment
>> replying to the series so it can be respun?
>>
>> You only do a fixes tag for either upstream things that obviously have to stay
>> in place or perhaps things in mm-stable immediately prior to merge window that
>> can't be adjusted.
>
> I saw that the last comment on that series was more than a week back, so best
> thought to just do a folded fix on top of it - and I had formed the impression
> (from the conversations on list) that akpm prefers fixes over respins : )
That series is still on my TODO list and I hope Andrew will keep it out
of stable until I get to it.
Hope is all I got ;)
--
Cheers
David
next prev parent reply other threads:[~2026-01-16 10:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 8:27 Dev Jain
2026-01-16 8:39 ` Lorenzo Stoakes
2026-01-16 9:40 ` Dev Jain
2026-01-16 9:48 ` Lorenzo Stoakes
2026-01-16 9:54 ` Dev Jain
2026-01-16 10:51 ` David Hildenbrand (Red Hat) [this message]
2026-01-17 17:46 ` Andrew Morton
2026-01-16 10:57 ` David Hildenbrand (Red Hat)
2026-01-16 11:12 ` Lorenzo Stoakes
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=5af933d1-8c64-4d3c-b835-d90c8e9f771a@kernel.org \
--to=david@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=axelrasmussen@google.com \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dev.jain@arm.com \
--cc=harry.yoo@oracle.com \
--cc=jannh@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=mhocko@suse.com \
--cc=riel@surriel.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=surenb@google.com \
--cc=vbabka@suse.cz \
--cc=weixugc@google.com \
--cc=yuanchu@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