From: "David Hildenbrand (Arm)" <david@kernel.org>
To: Deepanshu Kartikey <kartikey406@gmail.com>,
Ackerley Tng <ackerleytng@google.com>
Cc: akpm@linux-foundation.org, lorenzo.stoakes@oracle.com,
baolin.wang@linux.alibaba.com, Liam.Howlett@oracle.com,
npache@redhat.com, ryan.roberts@arm.com, dev.jain@arm.com,
baohua@kernel.org, seanjc@google.com, pbonzini@redhat.com,
michael.roth@amd.com, vannapurve@google.com, ziy@nvidia.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
syzbot+33a04338019ac7e43a44@syzkaller.appspotmail.com,
Fangrui Song <i@maskray.me>
Subject: Re: [PATCH] mm: thp: Deny THP for guest_memfd and secretmem in file_thp_enabled()
Date: Fri, 13 Feb 2026 10:06:48 +0100 [thread overview]
Message-ID: <f3252a77-f41a-430a-bbb5-2f6d3c8a7c2c@kernel.org> (raw)
In-Reply-To: <CADhLXY6zzWJnu9ZLH8jThMx=z6JpYmnB_jdxRJe=QVjEMu6WFg@mail.gmail.com>
On 2/13/26 06:02, Deepanshu Kartikey wrote:
> On Fri, Feb 13, 2026 at 3:49 AM Ackerley Tng <ackerleytng@google.com> wrote:
>>
>> "David Hildenbrand (Arm)" <david@kernel.org> writes:
>>
>> Going to try and summarize the findings/discussions here, copying from a
>> few earlier emails. David, you can jump directly to [Question].
>>
>>
>> [Bug]
>> khugepaged (and MADV_COLLAPSE) will try to collapse secretmem pages with
>> MADV_HUGEPAGE applied. There is no crash, but there is a false memory
>> failure printout that looks like
>>
>> [ 1068.322578] Memory failure: 0x106d96f: recovery action for
>> clean unevictable LRU page: Recovered
>>
>> The correct Fixes tag should be:
>>
>> Fixes: 7fbb5e188248 ("mm: remove VM_EXEC requirement for THP eligibility")
>>
>> I was able to reproduce this on 6.12, 6.18 and HEAD
>>
>> [Stable Backports]
>> The first stable version this affects is 6.12.
>>
>> In 6.12, S_ANON_INODE does not yet exist, so I think in
>> file_thp_enabled() we can return false if vma_is_secretmem(vma).
>>
>> 6.18 needs a fix for both secretmem and guest_memfd.
>>
>> [Solution]
>> For 6.18 and later, David's suggestion of using IS_ANON_FILE() seems to
>> work. This affects more filesystems than just secretmem and guest_memfd
>> though.
>>
>> [Question]
>> I'm not familiar with the concept of anonymous inodes. What does that
>> entail? Why is it suitable in deciding THP eligibility?
>>
>> [Next Steps]
>> I'm going to be traveling over the next few weeks, so perhaps Deepanshu
>> can help with the fixup patches for 6.12, 6.18 and HEAD?
>>
>
> Hi David,
>
> Thanks Ackerley for the reproducer and analysis. Since Ackerley will be
> traveling, I can take this forward.
>
> Here is the approach I am planning:
>
> For HEAD / 6.18:
> - Add IS_ANON_FILE(inode) check in file_thp_enabled() as you suggested
> - Fixes: 7fbb5e188248 ("mm: remove VM_EXEC requirement for THP eligibility")
> - Cc: stable@vger.kernel.org
Right. Please link the mail with Ackerley's reproducers and carefully
describe the implications. Then describe how anon inodes never pass the
"opened writable" check and that the clean thing to do is to revert to
disallowing anon inodes altogether.
Also describe how secretmem is not affected upstream, but triggers the
confusing memory failure errors.
>
> For 6.12 stable backport:
> - IS_ANON_FILE / S_ANON_INODE does not exist in 6.12, so use
> mapping_inaccessible() || secretmem_mapping() in file_thp_enabled()
> instead
I think secretmem_mapping() is sufficient there given that guest_memfd
does not apply yet.
But we can discuss the details about the backport once the upstream fix
is in.
Thanks!
--
Cheers,
David
next prev parent reply other threads:[~2026-02-13 9:07 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-09 3:35 Deepanshu Kartikey
2026-02-09 10:24 ` David Hildenbrand (Arm)
2026-02-09 10:41 ` David Hildenbrand (Arm)
2026-02-09 13:06 ` Deepanshu Kartikey
2026-02-09 18:22 ` Ackerley Tng
2026-02-09 19:45 ` David Hildenbrand (Arm)
2026-02-09 20:13 ` David Hildenbrand (Arm)
2026-02-09 21:31 ` Ackerley Tng
2026-02-10 9:33 ` David Hildenbrand (Arm)
2026-02-10 23:00 ` Ackerley Tng
2026-02-11 0:58 ` Ackerley Tng
2026-02-11 2:01 ` Deepanshu Kartikey
2026-02-11 9:29 ` David Hildenbrand (Arm)
2026-02-11 16:16 ` Ackerley Tng
2026-02-11 16:35 ` David Hildenbrand (Arm)
2026-02-11 16:44 ` David Hildenbrand (Arm)
2026-02-11 1:59 ` Deepanshu Kartikey
2026-02-11 9:28 ` David Hildenbrand (Arm)
2026-02-11 14:50 ` Deepanshu Kartikey
2026-02-11 15:38 ` Ackerley Tng
2026-02-11 16:45 ` David Hildenbrand (Arm)
2026-02-12 22:19 ` Ackerley Tng
2026-02-13 5:02 ` Deepanshu Kartikey
2026-02-13 9:06 ` David Hildenbrand (Arm) [this message]
2026-02-21 4:37 ` Deepanshu Kartikey
2026-02-10 1:51 ` Deepanshu Kartikey
2026-02-10 9:33 ` David Hildenbrand (Arm)
2026-02-09 23:37 ` kernel test robot
2026-02-10 17:51 ` kernel test robot
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=f3252a77-f41a-430a-bbb5-2f6d3c8a7c2c@kernel.org \
--to=david@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=ackerleytng@google.com \
--cc=akpm@linux-foundation.org \
--cc=baohua@kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=dev.jain@arm.com \
--cc=i@maskray.me \
--cc=kartikey406@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=michael.roth@amd.com \
--cc=npache@redhat.com \
--cc=pbonzini@redhat.com \
--cc=ryan.roberts@arm.com \
--cc=seanjc@google.com \
--cc=syzbot+33a04338019ac7e43a44@syzkaller.appspotmail.com \
--cc=vannapurve@google.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