linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Ignacio.MorenoGonzalez@kuka.com, Liam.Howlett@oracle.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: mmap: map MAP_STACK to VM_NOHUGEPAGE only if THP is enabled
Date: Fri, 2 May 2025 15:16:52 +0100	[thread overview]
Message-ID: <aBTT1JIz17g_2pM7@casper.infradead.org> (raw)
In-Reply-To: <3de8814b-9964-489c-8d13-feb319623b82@lucifer.local>

On Fri, May 02, 2025 at 02:12:16PM +0100, Lorenzo Stoakes wrote:
> On Fri, May 02, 2025 at 02:03:48PM +0100, Matthew Wilcox wrote:
> > On Fri, May 02, 2025 at 11:31:41AM +0200, Ignacio Moreno Gonzalez via B4 Relay wrote:
> > > From: Ignacio Moreno Gonzalez <Ignacio.MorenoGonzalez@kuka.com>
> > >
> > > commit c4608d1bf7c6 ("mm: mmap: map MAP_STACK to VM_NOHUGEPAGE") maps
> > > the mmap option MAP_STACK to VM_NOHUGEPAGE. This is also done if
> > > CONFIG_TRANSPARENT_HUGETABLES is not defined. But in that case, the
> > > VM_NOHUGEPAGE does not make sense. For instance, when calling madvise()
> > > with MADV_NOHUGEPAGE, an error is always returned.
> >
> > Isn't that the real problem though?
> 
> Hmm, but wouldn't we want users who are trying to set MADV_[NO]HUGEPAGE to
> be made aware that it isn't going to do anything?

... I thought the patch was clear.  Only setting NOHUGEPAGE becomes a
no-op.  Setting HUGEPAGE remains EINVAL.

> And wouldn't changing this be a possibly 'breaking userspace' thing if
> somebody somewhere relies on this?

I don't see what userspace could rely on it returning EINVAL, since it
won't on a kernel which has THP enabled.

> Also this will make this inconsistent with e.g. MADV_COLLAPSE also?

Not sure how ...



  reply	other threads:[~2025-05-02 14:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02  9:31 Ignacio Moreno Gonzalez via B4 Relay
2025-05-02 12:46 ` Lorenzo Stoakes
2025-05-02 20:53   ` Yang Shi
2025-05-03  9:50     ` Lorenzo Stoakes
2025-05-05 17:53       ` Yang Shi
2025-05-06 12:26       ` Ignacio Moreno Gonzalez
2025-05-02 13:03 ` Matthew Wilcox
2025-05-02 13:12   ` Lorenzo Stoakes
2025-05-02 14:16     ` Matthew Wilcox [this message]
2025-05-02 14:24       ` 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=aBTT1JIz17g_2pM7@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=Ignacio.MorenoGonzalez@kuka.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lorenzo.stoakes@oracle.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