lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ