[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAA1CXcCg1EjY5fP=uR9EUpQtwXy1VJJEho8PA1VmG4E03tvBdg@mail.gmail.com>
Date: Mon, 17 Feb 2025 12:24:50 -0700
From: Nico Pache <npache@...hat.com>
To: Usama Arif <usamaarif642@...il.com>
Cc: linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
linux-kselftest@...r.kernel.org, linux-mm@...ck.org, ryan.roberts@....com,
anshuman.khandual@....com, catalin.marinas@....com, cl@...two.org,
vbabka@...e.cz, mhocko@...e.com, apopple@...dia.com,
dave.hansen@...ux.intel.com, will@...nel.org, baohua@...nel.org, jack@...e.cz,
srivatsa@...il.mit.edu, haowenchao22@...il.com, hughd@...gle.com,
aneesh.kumar@...nel.org, yang@...amperecomputing.com, peterx@...hat.com,
ioworker0@...il.com, wangkefeng.wang@...wei.com, ziy@...dia.com,
jglisse@...gle.com, surenb@...gle.com, vishal.moola@...il.com,
zokeefe@...gle.com, zhengqi.arch@...edance.com, jhubbard@...dia.com,
21cnbao@...il.com, willy@...radead.org, kirill.shutemov@...ux.intel.com,
david@...hat.com, aarcange@...hat.com, raquini@...hat.com, dev.jain@....com,
sunnanyong@...wei.com, audra@...hat.com, akpm@...ux-foundation.org,
rostedt@...dmis.org, mathieu.desnoyers@...icios.com, tiwai@...e.de,
baolin.wang@...ux.alibaba.com, corbet@....net, shuah@...nel.org
Subject: Re: [RFC v2 1/5] mm: defer THP insertion to khugepaged
On Mon, Feb 17, 2025 at 7:59 AM Usama Arif <usamaarif642@...il.com> wrote:
>
>
>
> On 11/02/2025 00:40, Nico Pache wrote:
> > setting /transparent_hugepages/enabled=always allows applications
> > to benefit from THPs without having to madvise. However, the pf handler
> > takes very few considerations to decide weather or not to actually use a
> > THP. This can lead to a lot of wasted memory. khugepaged only operates
> > on memory that was either allocated with enabled=always or MADV_HUGEPAGE.
> >
> > Introduce the ability to set enabled=defer, which will prevent THPs from
> > being allocated by the page fault handler unless madvise is set,
> > leaving it up to khugepaged to decide which allocations will collapse to a
> > THP. This should allow applications to benefits from THPs, while curbing
> > some of the memory waste.
> >
> > Signed-off-by: Nico Pache <npache@...hat.com>
> > ---
> > include/linux/huge_mm.h | 15 +++++++++++++--
> > mm/huge_memory.c | 31 +++++++++++++++++++++++++++----
> > 2 files changed, 40 insertions(+), 6 deletions(-)
> >
> > diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h
> > index 93e509b6c00e..fb381ca720ea 100644
> > --- a/include/linux/huge_mm.h
> > +++ b/include/linux/huge_mm.h
> > @@ -44,6 +44,7 @@ enum transparent_hugepage_flag {
> > TRANSPARENT_HUGEPAGE_UNSUPPORTED,
> > TRANSPARENT_HUGEPAGE_FLAG,
> > TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
> > + TRANSPARENT_HUGEPAGE_DEFER_PF_INST_FLAG,
>
> No strong preference, but maybe just TRANSPARENT_HUGEPAGE_DEFER_FLAG might be better?
Not a bad idea, TRANSPARENT_HUGEPAGE_DEFER_PF_INST_FLAG is pretty long!
>
Powered by blists - more mailing lists