[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <38aea444-a404-4176-8702-496362c88cfa@redhat.com>
Date: Fri, 4 Jul 2025 12:34:47 +0200
From: David Hildenbrand <david@...hat.com>
To: SeongJae Park <sj@...nel.org>, Usama Arif <usamaarif642@...il.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Shakeel Butt <shakeel.butt@...ux.dev>,
"Liam R . Howlett" <Liam.Howlett@...cle.com>,
Vlastimil Babka <vbabka@...e.cz>, Jann Horn <jannh@...gle.com>,
Arnd Bergmann <arnd@...db.de>, Christian Brauner <brauner@...nel.org>,
Mike Rapoport <rppt@...nel.org>, Johannes Weiner <hannes@...xchg.org>,
Barry Song <21cnbao@...il.com>, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-api@...r.kernel.org,
Pedro Falcato <pfalcato@...e.de>, Matthew Wilcox <willy@...radead.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Subject: Re: [DISCUSSION] proposed mctl() API
On 02.07.25 19:38, SeongJae Park wrote:
> On Wed, 2 Jul 2025 15:15:01 +0100 Usama Arif <usamaarif642@...il.com> wrote:
>
> [...]
>> In terms of the approach of doing this, IMHO, I dont think the way to do this
>> is controversial. After the great feedback from Lorenzo on the prctl series, the
>> approach would be for userpsace to make a call that just does for_each_vma of the process,
>> madvises the VMAs,
>
> One dirty hack that I can think off the top of my head for doing this without
> new kernel changes is, unsurprisingly, using DAMOS. Using DAMOS, users can do
> madvise(MADV_HUGEPAGE) to virtual address ranges of specific access patterns.
> It is aimed to be used for hot regions, while using similar one of
> MADV_NOHUGEPAGE for cold regions. An experiment with a prototype[1] showed it
> eliminates about 80% of internal fragmentation caused memory overhead while
> keeping 46% of performance improvement under a constrained situation.
>
> If you set the access pattern as any pattern, hence, you can do
> madvise(MADV_HUGEPAGE) for effectively entire virtual address space of the
> process. DAMON user-space tool supports periodically tracking childs and
> applying same DAMOS scheme to those. So, for example, below hack could be
> tried.
>
> # damo start $(pidof XXX) --damos_action hugepage --include_child_tasks
IIRC, setting MADV_HUGEPAGE on arbitrary VMAs from arbitrary processes
has the potential of breaking applications.
Just imagine them deliberately setting MADV_NOHUGEPAGE and are intending
of using userfaultfd, where it is crucial that we don't over-allocate
memory even before userfaultdf is actually registered.
(QEMU does that)
--
Cheers,
David / dhildenb
Powered by blists - more mailing lists