From: Andrew Morton <akpm@linux-foundation.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Jann Horn <jannh@google.com>,
Christophe Leroy <christophe.leroy@csgroup.eu>,
Rick Edgecombe <rick.p.edgecombe@intel.com>, <linux-mm@kvack.org>,
Yang Shi <shy828301@gmail.com>,
David Hildenbrand <david@redhat.com>,
Ryan Roberts <ryan.roberts@arm.com>
Subject: Re: [PATCH -next] mm: don't try THP align for FS without get_unmapped_area
Date: Fri, 6 Dec 2024 22:34:56 -0800 [thread overview]
Message-ID: <20241206223456.255b00b35cb554987e48daae@linux-foundation.org> (raw)
In-Reply-To: <20241206070345.2526501-1-wangkefeng.wang@huawei.com>
On Fri, 6 Dec 2024 15:03:45 +0800 Kefeng Wang <wangkefeng.wang@huawei.com> wrote:
> Commit ed48e87c7df3 ("thp: add thp_get_unmapped_area_vmflags()")
> changes thp_get_unmapped_area() to thp_get_unmapped_area_vmflags()
> in __get_unmapped_area(), which won't setup get_area for anonymous
> mappings, but it leads to always try THP align when file ops without
> '.get_unmapped_area' callback too as the get_area is NULL.
>
> Since commit efa7df3e3bb5 ("mm: align larger anonymous mappings on
> THP boundaries") only want to enable THP align for anonymous, adding
> !file check to fix it.
The above is tough. I attempted a rewrite, please review for accuracy
and completeness:
: Commit ed48e87c7df3 ("thp: add thp_get_unmapped_area_vmflags()") changes
: thp_get_unmapped_area() to thp_get_unmapped_area_vmflags() in
: __get_unmapped_area(), which doesn't initialize local get_area for
: anonymous mappings. This leads to us always trying THP alignment even for
: file_operations which have a NULL ->get_unmapped_area() callback.
:
: Since commit efa7df3e3bb5 ("mm: align larger anonymous mappings on THP
: boundaries") we only want to enable THP alignment for anonymous mappings,
: so add a !file check to avoid attempting THP alignment for file mappings.
Also, the changelog failed to describe the userspace-visible effects of
the flaw, which is basically essential when fixing bugs.
The bug has been there since 6.10 so it would be interesting to learn
why it took this long to be noticed.
next prev parent reply other threads:[~2024-12-07 6:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 7:03 Kefeng Wang
2024-12-06 8:44 ` Vlastimil Babka
2024-12-06 16:28 ` Yang Shi
2024-12-07 6:34 ` Andrew Morton [this message]
2024-12-09 5:00 ` Kefeng Wang
2024-12-09 8:36 ` Vlastimil Babka
2024-12-09 11:52 ` Kefeng Wang
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=20241206223456.255b00b35cb554987e48daae@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=Liam.Howlett@oracle.com \
--cc=christophe.leroy@csgroup.eu \
--cc=david@redhat.com \
--cc=jannh@google.com \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=rick.p.edgecombe@intel.com \
--cc=ryan.roberts@arm.com \
--cc=shy828301@gmail.com \
--cc=vbabka@suse.cz \
--cc=wangkefeng.wang@huawei.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