Re: [PATCH] cpuset: fix allocating page cache/slab object on the unallowed node when memory spread is set

Nick Piggin
2009-02-12T10:42:28Z

On Thursday 12 February 2009 19:27:16 Miao Xie wrote:
> on 2009-2-12 9:55 Nick Piggin wrote:
> > On Thursday 12 February 2009 12:19:11 Paul Menage wrote:
> >> On Wed, Feb 11, 2009 at 4:54 PM, Nick Piggin <nickpiggin@yahoo.com.au>
> >
> > wrote:
> >>> It would be possible, depending on timing, for the allocating thread to
> >>> see either pre or post mems_allowed even if access was fully locked.
> >>
> >> Right - seeing either the pre set or the post set is fine.
> >>
> >>> The only difference is that a partially changed mems_allowed could be
> >>> seen. But what does this really mean? Some combination of the new and
> >>> the old nodes. I don't think this is too much of a problem.
> >>
> >> But if the old and new nodes are disjoint, that could lead to seeing no
> >> nodes.
> >
> > Well we could structure updates as setting all new allowed nodes,
> > then clearing newly disallowed ones.
>
> But it still has the other problem. such as:
> Task1 Task2
> get_page_from_freelist() while(1) {
> {
> for_each_zone_zonelist_nodemask() {
> change Task1's mems_allowed
> if (!cpuset_zone_allowed_softwall())
> goto try_next_zone;
> try_next_zone:
> ...
> }
> } }
>
> In the extreme case, Task1 will be completely unable to allocate memory
> at worst. At least, it will lead to the delay of allocate pages. Though
> the probability of this case is very low, we have to take into account.

Hmm, but a task with that permission could kill task1 in a number
of ways. Is it really worth worrying about?