[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8ea288f2-5196-41f9-bd65-e29f22bb29e8@lucifer.local>
Date: Thu, 15 May 2025 19:08:48 +0100
From: Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
To: David Hildenbrand <david@...hat.com>
Cc: Usama Arif <usamaarif642@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
hannes@...xchg.org, shakeel.butt@...ux.dev, riel@...riel.com,
ziy@...dia.com, laoar.shao@...il.com, baolin.wang@...ux.alibaba.com,
Liam.Howlett@...cle.com, npache@...hat.com, ryan.roberts@....com,
linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
kernel-team@...a.com
Subject: Re: [PATCH 1/6] prctl: introduce PR_THP_POLICY_DEFAULT_HUGE for the
process
On Thu, May 15, 2025 at 06:11:55PM +0200, David Hildenbrand wrote:
> > > > So if you're not overriding VM_NOHUGEPAGE, the whole point of this exercise
> > > > is to override global 'never'?
> > > >
> > >
> > > Again, I am not overriding never.
> > >
> > > hugepage_global_always and hugepage_global_enabled will evaluate to false
> > > and you will not get a hugepage.
> >
> > Yeah, again ack, but I kind of hate that we set VM_HUGEPAGE everywhere even
> > if the policy is never.
>
> I think it should behave just as if someone does manually an madvise(). So
> whatever we do here during an madvise, we should try to do the same thing
> here.
Ack I agree with this.
It actually simplifies things a LOT to view it this way - we're saying 'by
default apply madvise(...) to new VMAs'.
Hm I wonder if we could have a more generic version of this...
Note though that we're not _quite_ doing this.
So in hugepage_madvise():
int hugepage_madvise(struct vm_area_struct *vma,
unsigned long *vm_flags, int advice)
{
...
switch (advice) {
case MADV_HUGEPAGE:
*vm_flags &= ~VM_NOHUGEPAGE;
*vm_flags |= VM_HUGEPAGE;
...
break;
...
}
...
}
So here we're actually clearing VM_NOHUGEPAGE and overriding it, but in the
proposed code we're not.
So we're back into confusing territory again :)
I wonder if we could...
1. Add an MADV_xxx that mimics the desired behaviour here.
2. Add a generic 'madvise() by default' thing at a process level?
Is this crazy?
>
> --
> Cheers,
>
> David / dhildenb
>
Powered by blists - more mailing lists