linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Vlastimil Babka <vbabka@suse.cz>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
	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: Mon, 9 Dec 2024 09:36:20 +0100	[thread overview]
Message-ID: <32c2aae0-37e2-46c7-87a1-075ead14dd89@suse.cz> (raw)
In-Reply-To: <59025011-0525-49d2-9dd9-e275991748ad@huawei.com>

On 12/9/24 06:00, Kefeng Wang wrote:
> 
> 
> On 2024/12/7 14:34, Andrew Morton wrote:
>> 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:
> 
> Forgive my English, thanks for rewriting the better changelog.
>> 
>> : 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.
> 
> Found issue by code inspection. THP alignment is used for easy or more
> pmd mappings, from vma side, I don't think it will introduce usespace-
> visible effects, only different vma address, but I don't know if there's
> any other effect.

How about:

This may cause unnecessary VMA fragmentation and potentially worse
performance on filesystems that do not actually support THPs and thus cannot
benefit from the alignment.


  reply	other threads:[~2024-12-09  8:36 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
2024-12-09  5:00   ` Kefeng Wang
2024-12-09  8:36     ` Vlastimil Babka [this message]
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=32c2aae0-37e2-46c7-87a1-075ead14dd89@suse.cz \
    --to=vbabka@suse.cz \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --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=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