From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Gregory Price <gourry@gourry.net>, Zi Yan <ziy@nvidia.com>,
Joshua Hahn <joshua.hahnjy@gmail.com>,
Rakie Kim <rakie.kim@sk.com>,
Ying Huang <ying.huang@linux.alibaba.com>,
Johannes Weiner <hannes@cmpxchg.org>,
Vladimir Davydov <vdavydov.dev@gmail.com>,
Michal Hocko <mhocko@suse.com>, Hugh Dickins <hughd@google.com>,
Lukas Czerner <lczerner@redhat.com>,
Carlos Maiolino <cmaiolino@redhat.com>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Daniel Verkamp <dverkamp@chromium.org>,
Jeff Xu <jeffxu@google.com>, Muchun Song <muchun.song@linux.dev>,
Oscar Salvador <osalvador@suse.de>,
David Stevens <stevensd@chromium.org>,
"Matthew Wilcox (Oracle)" <willy@infradead.org>,
William Kucharski <william.kucharski@oracle.com>,
Chris Li <chrisl@kernel.org>, Kairui Song <kasong@tencent.com>,
Nhat Pham <nphamcs@gmail.com>, Miaohe Lin <linmiaohe@huawei.com>,
Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Chris Mason <mason@kernel.org>,
stable@vger.kernel.org, Josef Bacik <josef@toxicpanda.com>,
Eva Kurchatova <eva.kurchatova@virtuozzo.com>
Subject: Re: [PATCH 00/16] mm/shmem: various (urgent?) fixes
Date: Mon, 26 Oct 2026 19:11:02 +0800 [thread overview]
Message-ID: <a8f01101-7d7d-4982-9cf8-04b754ba132a@linux.alibaba.com> (raw)
In-Reply-To: <20261026-fixes_shmem-v1-0-703206d5fa0c@kernel.org>
On 10/26/26 5:40 PM, David Hildenbrand (Arm) wrote:
> Hi,
>
> the fixing fun continues.
>
> This is a handful of fixes for shmem/tmpfs. I sneaked in a related
> hugetlb fix that stalled upstream.
Wow, thanks David!
> Some of the stuff is more urgent (patch #1, F_SEAL_EXEC, truncation
> hangs), others are less urgent but still rather unpleasant.
>
> The majority are fixes from Anthropic that I cleaned up or reworked.
> While doing that, I found a bunch of other issues and tried to fix them
> somewhat cleanly.
>
> In general, shmem + swap handling is a nightmare. shmem_undo_range() is
> such utter garbage it makes me want to cry. I mean, really, WTF did we
> end up creating there. Does any expert here have time to clean that up and
> make it *actually* maintainable.
Agree. :) I'll re-read shmem_undo_range() and take a close look at the
issues you raised, and see if I can make shmem_undo_range() more readable.
> The following things are still broken in shmem_undo_range():
>
> (1) Truncate/punch of a single page of a large swap-error marker
>
> We don't split. Consequently, read access afterwards will still fail
> instead of returning 0s.
>
> I have a fix to try to split (which can fail), but I don't consider it
> that urgent, really. So I'm not including it. Might send it later
> separately.
>
> Truncate/punch of a partial page can obviously never do the right thing,
> as we cannot poison parts of pages ...
>
> (2) Truncate/punch whole pages within part of a large swap entry
>
> We try to read the entry, but if we are out of memory that might fail.
> Consequently, we will not free up swap space and a re-read will not give
> us 0s but the previous content.
>
> AI proposed a nasty NOFAIL patch which has too many nasty side effects
> IMHO (allowing users to force-read pages and retain them afterwards even
> though memory.max would disallow it). This needs a proper thought. Likely,
> support for splitting large swap entries (and large folios in the
> swapcache, which I recall is under development by Kairui). But splitting
> can fail ...
>
> (3) Truncate/punch of a part of a base-page swap entry
>
> We obviously have to read the page in, in order to 0-out the parts to
> discard. That might obviously fail.
>
> Maybe we should install swapin-error markers if swapping during
> truncate/punchhole fails, to at least tell user space on later access
> that something went wrong? We might affect unrelated data, outside the
> requested range, though. Anyhow, these are long standing issues and
> I don't consider them urgent.
>
> They need a proper solution.
>
> I did my best trying to test these fixes. I was able to reproduce some
> of the things (including unkillable truncation hangs), and the fixes seemed
> to help.
>
> But again, shmem_undo_range() is just an absolute mess.
>
> Please prioritize review of these fixes, I want to get fixes for the
> issues in a timely manner upstream.
OK. Will review and test this serires this week.
> Signed-off-by: David Hildenbrand (Arm) <david@kernel.org>
> ---
> Chris Mason (5):
> mm/mempolicy: charge shared policy nodes
> mm/shmem: honour F_SEAL_EXEC when an ACL is set
> mm/shmem: avoid moving the truncation start backwards
> mm/shmem: stop retrying folios that cannot be split
> mm/shmem: preserve data in clean folios when splitting fails
>
> David Hildenbrand (Arm) (7):
> mm/shmem: discard whole new large folios on fallocate rollback
> mm/shmem: rescan after nonuniform folio splitting
> mm/shmem: fix truncate hang in large swap entry
> mm/shmem: preserve allocation errors when swapping in large entries
> mm/shmem: fix truncate loop after boundary swapin failure
> mm/shmem: fix accounting of swapin-error markers
> mm/shmem: fix truncation of files containing only swapin-error markers
>
> Eva Kurchatova (1):
> hugetlbfs: enforce F_SEAL_EXEC in setattr
>
> Josef Bacik (3):
> tmpfs: keep the quota soft limits of an unused id
> tmpfs: preserve explicitly disabled quota limits
> mm/shmem: hold off eviction in shmem_writeout()
>
> fs/hugetlbfs/inode.c | 8 +++
> include/linux/memfd.h | 9 +++
> mm/mempolicy.c | 4 +-
> mm/shmem.c | 170 +++++++++++++++++++++++++++++++++++---------------
> mm/shmem_quota.c | 28 +++++----
> 5 files changed, 154 insertions(+), 65 deletions(-)
>
> ---
>
> base-commit: 21a7f44fd0765fcc5194130b28767786eba1d1e7
>
> change-id: 20261025-fixes_shmem-2782719b130e
>
> --
>
> Cheers,
>
> David
next prev parent reply other threads:[~2026-10-26 11:11 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 9:40 David Hildenbrand (Arm)
2026-10-26 9:40 ` [PATCH 01/16] mm/mempolicy: charge shared policy nodes David Hildenbrand (Arm)
2026-10-26 13:38 ` Pedro Falcato
2026-10-26 15:44 ` Kiryl Shutsemau
2026-10-26 18:10 ` Zi Yan
2026-10-26 9:40 ` [PATCH 02/16] tmpfs: keep the quota soft limits of an unused id David Hildenbrand (Arm)
2026-10-26 10:53 ` Jan Kara
2026-10-26 11:00 ` David Hildenbrand (Arm)
2026-10-26 9:40 ` [PATCH 03/16] tmpfs: preserve explicitly disabled quota limits David Hildenbrand (Arm)
2026-10-26 13:37 ` Jan Kara
2026-10-26 9:40 ` [PATCH 04/16] mm/shmem: honour F_SEAL_EXEC when an ACL is set David Hildenbrand (Arm)
2026-10-26 13:48 ` Pedro Falcato
2026-10-26 15:52 ` Kiryl Shutsemau
2026-10-26 19:07 ` Zi Yan
2026-10-26 9:40 ` [PATCH 05/16] hugetlbfs: enforce F_SEAL_EXEC in setattr David Hildenbrand (Arm)
2026-10-26 13:49 ` Pedro Falcato
2026-10-26 15:55 ` Kiryl Shutsemau
2026-10-26 19:08 ` Zi Yan
2026-10-26 9:40 ` [PATCH 06/16] mm/shmem: hold off eviction in shmem_writeout() David Hildenbrand (Arm)
2026-10-26 15:14 ` Pedro Falcato
2026-10-26 18:44 ` Nhat Pham
2026-10-26 16:13 ` Kiryl Shutsemau
2026-10-26 18:32 ` Nhat Pham
2026-10-26 9:40 ` [PATCH 07/16] mm/shmem: avoid moving the truncation start backwards David Hildenbrand (Arm)
2026-10-26 16:30 ` Kiryl Shutsemau
2026-10-26 19:21 ` Zi Yan
2026-10-26 9:40 ` [PATCH 08/16] mm/shmem: stop retrying folios that cannot be split David Hildenbrand (Arm)
2026-10-26 16:36 ` Kiryl Shutsemau
2026-10-26 17:08 ` David Hildenbrand (Arm)
2026-10-26 17:59 ` Kiryl Shutsemau
2026-10-26 9:40 ` [PATCH 09/16] mm/shmem: preserve data in clean folios when splitting fails David Hildenbrand (Arm)
2026-10-26 17:12 ` Kiryl Shutsemau
2026-10-26 9:40 ` [PATCH 10/16] mm/shmem: discard whole new large folios on fallocate rollback David Hildenbrand (Arm)
2026-10-26 17:15 ` Kiryl Shutsemau
2026-10-26 9:40 ` [PATCH 11/16] mm/shmem: rescan after nonuniform folio splitting David Hildenbrand (Arm)
2026-10-26 17:26 ` Kiryl Shutsemau
2026-10-26 9:40 ` [PATCH 12/16] mm/shmem: fix truncate hang in large swap entry David Hildenbrand (Arm)
2026-10-26 17:39 ` Kiryl Shutsemau
2026-10-26 9:40 ` [PATCH 13/16] mm/shmem: preserve allocation errors when swapping in large entries David Hildenbrand (Arm)
2026-10-26 17:49 ` Kiryl Shutsemau
2026-10-26 9:40 ` [PATCH 14/16] mm/shmem: fix truncate loop after boundary swapin failure David Hildenbrand (Arm)
2026-10-26 17:53 ` Kiryl Shutsemau
2026-10-26 9:40 ` [PATCH 15/16] mm/shmem: fix accounting of swapin-error markers David Hildenbrand (Arm)
2026-10-26 9:40 ` [PATCH 16/16] mm/shmem: fix truncation of files containing only " David Hildenbrand (Arm)
2026-10-26 11:11 ` Baolin Wang [this message]
2026-10-26 12:12 ` [PATCH 00/16] mm/shmem: various (urgent?) fixes David Hildenbrand (Arm)
2026-10-26 13:23 ` Kairui Song
2026-10-26 20:08 ` Gregory Price
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=a8f01101-7d7d-4982-9cf8-04b754ba132a@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=chrisl@kernel.org \
--cc=cmaiolino@redhat.com \
--cc=david@kernel.org \
--cc=dverkamp@chromium.org \
--cc=eva.kurchatova@virtuozzo.com \
--cc=gourry@gourry.net \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=jeffxu@google.com \
--cc=josef@toxicpanda.com \
--cc=joshua.hahnjy@gmail.com \
--cc=kasong@tencent.com \
--cc=lczerner@redhat.com \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mason@kernel.org \
--cc=mhocko@suse.com \
--cc=muchun.song@linux.dev \
--cc=nao.horiguchi@gmail.com \
--cc=nphamcs@gmail.com \
--cc=osalvador@suse.de \
--cc=rakie.kim@sk.com \
--cc=stable@vger.kernel.org \
--cc=stevensd@chromium.org \
--cc=vdavydov.dev@gmail.com \
--cc=william.kucharski@oracle.com \
--cc=willy@infradead.org \
--cc=ying.huang@linux.alibaba.com \
--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®