[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.1.10.0810281922320.32430@chino.kir.corp.google.com>
Date: Tue, 28 Oct 2008 19:24:33 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Peter Zijlstra <peterz@...radead.org>
cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux-foundation.org>,
Nick Piggin <npiggin@...e.de>, Paul Menage <menage@...gle.com>,
Derek Fults <dfults@....com>, linux-kernel@...r.kernel.org
Subject: Re: [patch 1/7] cpusets: add dirty map to struct address_space
On Tue, 28 Oct 2008, David Rientjes wrote:
> diff --git a/kernel/cpuset.c b/kernel/cpuset.c
> --- a/kernel/cpuset.c
> +++ b/kernel/cpuset.c
> @@ -2413,10 +2413,7 @@ EXPORT_SYMBOL_GPL(cpuset_mem_spread_node);
> #if MAX_NUMNODES > BITS_PER_LONG
> /*
> * Special functions for NUMA systems with a large number of nodes. The
> - * nodemask is pointed to from the address_space structure. The attachment of
> - * the dirty_nodes nodemask is protected by the tree_lock. The nodemask is
> - * freed only when the inode is cleared (and therefore unused, thus no locking
> - * is necessary).
> + * nodemask is pointed to from the address_space structure.
> */
> void cpuset_update_dirty_nodes(struct address_space *mapping,
> struct page *page)
> @@ -2424,14 +2421,18 @@ void cpuset_update_dirty_nodes(struct address_space *mapping,
> nodemask_t *nodes = mapping->dirty_nodes;
> int node = page_to_nid(page);
>
> + spin_lock_irq(&mapping->dirty_nodes_lock);
> if (!nodes) {
> nodes = kmalloc(sizeof(nodemask_t), GFP_ATOMIC);
> - if (!nodes)
> + if (!nodes) {
> + spin_unlock_irq(&mapping->dirty_nodes_lock);
> return;
> + }
>
> *nodes = NODE_MASK_NONE;
> mapping->dirty_nodes = nodes;
> }
> + spin_unlock_irq(&mapping->dirty_nodes_lock);
> node_set(node, *nodes);
> }
>
Would need to be
spin_lock_irq(&mapping->dirty_nodes_lock);
nodes = mapping->dirty_nodes;
if (!nodes) {
nodes = kmalloc(sizeof(nodemask_t), GFP_ATOMIC);
if (!nodes) {
spin_unlock_irq(&mapping->dirty_nodes_lock);
return;
}
...
}
spin_unlock_irq(&mapping->dirty_nodes_lock);
but this shouldn't add much locking overhead without mapping->tree_lock.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists