Re: [PATCH 1/3] slab common: Add functions for kmem_cache_node access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Jun 2014 14:15:11 -0500 Christoph Lameter <cl@xxxxxxxxx> wrote:

> These functions allow to eliminate repeatedly used code in both
> SLAB and SLUB and also allow for the insertion of debugging code
> that may be needed in the development process.
> 
> ...
>
> --- linux.orig/mm/slab.h	2014-06-10 14:18:11.506956436 -0500
> +++ linux/mm/slab.h	2014-06-10 14:21:51.279893231 -0500
> @@ -294,5 +294,18 @@ struct kmem_cache_node {
>  
>  };
>  
> +static inline struct kmem_cache_node *get_node(struct kmem_cache *s, int node)
> +{
> +	return s->node[node];
> +}
> +
> +/*
> + * Iterator over all nodes. The body will be executed for each node that has
> + * a kmem_cache_node structure allocated (which is true for all online nodes)
> + */
> +#define for_each_kmem_cache_node(__s, __node, __n) \
> +	for (__node = 0; __n = get_node(__s, __node), __node < nr_node_ids; __node++) \
> +		 if (__n)

Clueless newbs would be aided if this comment were to describe the
iterator's locking requirements.


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]