lkml.org 
[lkml]   [2010]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V2 4/4] cpuset,mm: update task's mems_allowed lazily
On Wed, 31 Mar 2010, Miao Xie wrote:

> diff --git a/mm/mmzone.c b/mm/mmzone.c
> index f5b7d17..43ac21b 100644
> --- a/mm/mmzone.c
> +++ b/mm/mmzone.c
> @@ -58,6 +58,7 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
> nodemask_t *nodes,
> struct zone **zone)
> {
> + nodemask_t tmp_nodes;
> /*
> * Find the next suitable zone to use for the allocation.
> * Only filter based on nodemask if it's set
> @@ -65,10 +66,16 @@ struct zoneref *next_zones_zonelist(struct zoneref *z,
> if (likely(nodes == NULL))
> while (zonelist_zone_idx(z) > highest_zoneidx)
> z++;
> - else
> - while (zonelist_zone_idx(z) > highest_zoneidx ||
> - (z->zone && !zref_in_nodemask(z, nodes)))
> - z++;
> + else {
> + tmp_nodes = *nodes;
> + if (nodes_empty(tmp_nodes))
> + while (zonelist_zone_idx(z) > highest_zoneidx)
> + z++;
> + else
> + while (zonelist_zone_idx(z) > highest_zoneidx ||
> + (z->zone && !zref_in_nodemask(z, &tmp_nodes)))
> + z++;
> + }
>
> *zone = zonelist_zone(z);
> return z;

Unfortunately, you can't allocate a nodemask_t on the stack here because
this is used in the iteration for get_page_from_freelist() which can occur
very deep in the stack already and there's a probability of overflow.
Dynamically allocating a nodemask_t simply wouldn't scale here, either,
since it would allocate on every iteration of a zonelist.


\
 
 \ /
  Last update: 2010-03-31 12:37    [W:0.136 / U:1.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site