Re: [PATCH]: Adding a counter in vma to indicate the number of physical pages backing it

Rohit Seth
2006-06-13T18:09:28Z

On Tue, 2006-06-13 at 18:28 +0100, Hugh Dickins wrote:
> On Tue, 13 Jun 2006, Rohit Seth wrote:
> > On Tue, 2006-06-13 at 05:51 +0200, Andi Kleen wrote:
> > >
> > > I think we first need to identify the basic need.
> > > Don't see why we even need per VMA information so far.
> >
> > This information is for user land applications to have the knowledge of
> > which virtual ranges are getting actively used and which are not.
> > This information then can be fed into a new system call
> > sys_change_page_activation(pid, start_va, len, flag). The purpose of
> > this system call would be to give hints to kernel that certain physical
> > pages are okay to be inactivated (or vice versa).
>
> Then perhaps you want a sys_report_page_activation(pid, start_va, len, ...)
> which would examine and report on the range in question, instead of adding
> your count to so many vmas on which this will never be used.
>

That will reduce the cost of not traversing the whole process address
space. But still for a given length, we will need to traverse the PTs.
On a positive side, this interface can give more specific information to
user in terms of page attributes. I'm fine with this interface if
others are okay. Andi?

> Though your syscall sounds like pid_madvise: perhaps the call name
> should be less specific and left to the flags (come, gentle syscall
> multiplexing flames, and warm me).
>

Agreed.

> Looking through the existing fields of a vma, it seems a vm_area_struct
> would commonly be on clean cachelines: your count making one of them
> now commonly and bouncily dirty.

The additional cost of this counter will be long size of extra memory
per segment, an atomic operation when ptl is used and dirtying an
additional cache line. I overlooked the last two cost factors earlier.

-rohit