linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	David Rientjes <rientjes@google.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH 1/3] slab common: Add functions for kmem_cache_node access
Date: Tue, 17 Jun 2014 14:17:13 -0700	[thread overview]
Message-ID: <20140617141713.08e290145d24ca95c487c330@linux-foundation.org> (raw)
In-Reply-To: <20140611191518.964245135@linux.com>

On Wed, 11 Jun 2014 14:15:11 -0500 Christoph Lameter <cl@linux.com> 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@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2014-06-17 21:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11 19:15 [PATCH 0/3] slab: common kmem_cache_cpu functions V2 Christoph Lameter
2014-06-11 19:15 ` [PATCH 1/3] slab common: Add functions for kmem_cache_node access Christoph Lameter
2014-06-11 23:07   ` David Rientjes
2014-06-12  6:10   ` Joonsoo Kim
2014-06-17 21:17   ` Andrew Morton [this message]
2014-06-17 21:45     ` David Rientjes
2014-06-11 19:15 ` [PATCH 2/3] slub: Use new node functions Christoph Lameter
2014-06-11 23:12   ` David Rientjes
2014-06-13 16:02     ` Christoph Lameter
2014-06-17 21:47       ` David Rientjes
2014-06-11 19:15 ` [PATCH 3/3] slab: Use get_node() and kmem_cache_node() functions Christoph Lameter
2014-06-11 23:15   ` David Rientjes
2014-06-12  6:35   ` Joonsoo Kim
2014-06-13 16:32     ` Christoph Lameter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140617141713.08e290145d24ca95c487c330@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox