2005-01-06 21:03:46

by Ray Bryant

[permalink] [raw]
Subject: page migration patchset

Andi,

Under the topic of modifying a processes's mems_allowed bitmask,
Paul Jackson has been telling me that this is hard, in general.
This is unfortunate, as part of the page migration work I am
doing, it seems that part of the necessary work is to change
the NUMA memory policy so newly allocated pages go onto the
new nodes.

Now I know there is no locking protection around the mems_allowed
bitmask, so changing this while the process is still running
sounds hard. But part of the plan I am working under assumes
that the process is stopped before it is migrated. (Shared
pages that are only shared among processes all of whom are to be
moved would similarly be handled; pages shsared among migrated
and non-migrated processes, e. g. glibc pages, would not
typically need to be moved at all, since they likely reside
somewhere outside the set of nodes to be migrated from.)

But if the process is suspended, isn't all that is needed just
to do the obvious translation on the mems_allowed vector?
(Similarly for the dedicated node stuff, I forget the name for
that at the moment...)

Am I missing something big here that makes this task harder
than I am thinking it is?
--
Best Regards,
Ray
-----------------------------------------------
Ray Bryant
512-453-9679 (work) 512-507-7807 (cell)
[email protected] [email protected]
The box said: "Requires Windows 98 or better",
so I installed Linux.
-----------------------------------------------


2005-01-06 23:14:01

by Andi Kleen

[permalink] [raw]
Subject: Re: page migration patchset

On Thu, Jan 06, 2005 at 02:59:55PM -0600, Ray Bryant wrote:
> Now I know there is no locking protection around the mems_allowed
> bitmask, so changing this while the process is still running
> sounds hard. But part of the plan I am working under assumes
> that the process is stopped before it is migrated. (Shared
> pages that are only shared among processes all of whom are to be
> moved would similarly be handled; pages shsared among migrated
> and non-migrated processes, e. g. glibc pages, would not
> typically need to be moved at all, since they likely reside
> somewhere outside the set of nodes to be migrated from.)
>
> But if the process is suspended, isn't all that is needed just
> to do the obvious translation on the mems_allowed vector?

Probably yes. But I can't say for sure since I haven't followed
the design and code of mems_allowed very closely
(it's not in mainline and seems to be only added with the cpumemset
patches). I would take Paul's word more seriously than mine
on that.

I assume you stop the process while doing page migration,
and while a process is stopped it should be safe to touch
task_struct fields as long as you lock against yourself.

> (Similarly for the dedicated node stuff, I forget the name for
> that at the moment...)

You mean NUMA API? You would need to modify all the mempolicy
data structures.

They can be safely changed when the mm semaphore is hold.
However such policies can be attached to files too (e.g.
in tmpfs) with no association with a process. There are plans
to allow them at arbitary files.

-Andi