On Wed, Mar 20, 2024 at 10:48:44AM +0800, Huang, Ying wrote: > Gregory Price <gourry.memverge@xxxxxxxxx> writes: > > > Doing this reverse-translation outside of the kernel requires considerable > > space and compute, and it will have to be performed again by the existing > > system calls. Much of this work can be avoided if the pages can be > > migrated directly with physical memory addressing. > > One difficulty of the idea of the physical address is that we lacks some > user space specified policy information to make decision. For example, > users may want to pin some pages in DRAM to improve latency, or pin some > pages in CXL memory to do some best effort work. To make the correct > decision, we need PID and virtual address. > I think of this as a second or third order problem. The core problem right now isn't the practicality of how userland would actually use this interface - the core problem is whether the data generated by offloaded monitoring is even worth collecting and operating on in the first place. So this is a quick hack to do some research about whether it's even worth developing the whole abstraction described by Willy. This is why it's labeled RFC. I upped a v3 because I know of two groups actively looking at using it for research, and because the folio updates broke the old version. It's also easier for me to engage through the list than via private channels for this particular work. Do I suggest we merge this interface as-is? No, too many concerns about side channels. However, it's a clean reuse of move_pages code to bootstrap the investigation, and it at least gets the gears turning. Example notes from a sidebar earlier today: * An interesting proposal from Dan Williams would be to provide some sort of `/sys/.../memory_tiering/tierN/promote_hot` interface, with a callback mechanism into the relevant hardware drivers that allows for this to be abstracted. This could be done on some interval and some threshhold (# pages, hotness threshhold, etc). The code to execute promotions ends up looking like what I have now 1) Validate the page is elgibile to be promoted by walking the vmas 2) invoking the existing move_pages code The above idea can be implemented trivially in userland without having to plumb through a whole brand new callback system. Sometimes you have to post stupid ideas to get to the good ones :] ~Gregory