On 22.09.23 17:48, Ryan Roberts wrote:
On 14/09/2023 09:16, Ryan Roberts wrote:
Hi All,
Thanks for participating in the discussion yesterday - it finally feels like we
are converging on the MVP feature set. Below are my notes from the call and a
modified proposal for controls and stats. It would be great if we can continue
to review and refine over email. I'm also planning to post an implementation
within the next couple of weeks, which I hope will also accelerate convergence.
I never had any feedback on the below; I'm not sure if that means everyone is
happy or that nobody read it??
I've got an implementation for all of the below ready to go, with a few tweeks
to the details (the main change is that anon_orders is now a bitfield where each
set bit represents an order in the set, rather than the originally proposed
comma-separated list of orders).
BUT I've had yet another idea on the controls front, which would enable exposing
this to user space as an extension to transparent_hugepage, while continuing to
support THP as is and also be able to control THP and ALF (anon large folio)
usage independently. On reflection, I think it is cleaner to do it this way for
a couple of reasons:
- We don't have to introduce a whole new feature (ALF) to the user. Most of
the concepts and controls overlap a lot with THP anyway, so if we can make
it look like an extension, I think it would be easier to communicate.
- The approach I have in mind would make it easy to extend to orders greater
than PMD_ORDER in future if that's a direction we want to eventually go.
Because >PMD_ORDER implies multiple PMD entries, it would half belong to THP
and half belong to ALF in the current proposal, which is nasty.
I'll lay out the new proposal now, but I suspect this will ultimately warrant
another mm alignment meeting...
Add 2 controls to sysfs:
/sys/kernel/mm/transparent_hugepage/anon_orders
- bitfield where set bits are orders that will be tried during allocation
- defaults to 1<<PMD_ORDER, which gives current THP behaviour with no ALF
- For now, 1<<PMD_ORDER is highest settable bit, but easy to expand in future
- To enable ALF, set the appropriate lower bits
- To disable THP, clear 1<<PMD_ORDER
- (In future we could add an "auto" option too)
I recall discussing that in the past -- where we also thought about
adding exactly that to debugfs -- but the consensus was that we should
keep THP alone.
I agree at this point that we better keep THP alone.
THP might be a subset of ALF (at some point, hopefully), but not the
other way around IMHO.
--
Cheers,
David / dhildenb