Re: [RFC V2 00/12] Define coherent device memory node

From: Jerome Glisse
Date: Tue Jan 31 2017 - 01:18:16 EST

On Tue, Jan 31, 2017 at 11:18:49AM +0530, Anshuman Khandual wrote:
> Hello Dave/Jerome/Mel,
> Here is the overall layout of the functions I am trying to put together
> through this patch series.
> (1) Define CDM from core VM and kernel perspective
> (2) Isolation/Special consideration for HugeTLB allocations
> (3) Isolation/Special consideration for buddy allocations
> (a) Zonelist modification based isolation (proposed)
> (b) Cpuset modification based isolation (proposed)
> (c) Buddy modification based isolation (working)
> (4) Define VMA containing CDM memory with a new flag VM_CDM
> (5) Special consideration for VM_CDM marked VMAs
> (a) Special consideration for auto NUMA
> (b) Special consideration for KSM

I believe (5) should not be done on per vma basis but on a page basis.
Thus rendering (4) pointless. A vma shouldn't be special because it has
some special kind of memory irespective of what the vma points to.

> Is there are any other area which needs to be taken care of before CDM
> node can be represented completely inside the kernel ?

Maybe thing like swap or suspend and resume (i know you are targetting big
computer and not laptop :)) but you can't presume what platform CDM might
be use latter on.

Also userspace might be confuse by looking a /proc/meminfo or any of the
sysfs file and see all this device memory without understanding that it
is special and might be unwise to be use for regular CPU only task.

I would probably want CDM memory be reported separatly from the rest of
memory. Which also most likely have repercution with memory cgroup.

My expectation is that you only want to use device memory in a process
if and only if that process also use the device to some extent. So
having new group hierarchy for this memory is probably a better path