linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@gentwo.org>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Pekka Enberg <penberg@kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Rientjes <rientjes@google.com>
Subject: Re: [PATCH 4/4] slab: Use for_each_kmem_cache_node function
Date: Mon, 2 Jun 2014 12:43:29 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.10.1406021236020.4737@gentwo.org> (raw)
In-Reply-To: <20140602051254.GD17964@js1304-P5Q-DELUXE>

On Mon, 2 Jun 2014, Joonsoo Kim wrote:

> Meanwhile, I think that this change is not good for readability. There
> are many for_each_online_node() usage that we can't replace, so I don't

We can replace many of them if we do not pass "node" around but a pointer
to the node structure. Like here:


Subject: slab: Use for_each_kmem_cache_work by reworking call chain fopr slab_set_lock_classes

Signed-off-by: Christoph Lameter <cl@linux.com>

Index: linux/mm/slab.c
===================================================================
--- linux.orig/mm/slab.c	2014-06-02 10:50:26.631319986 -0500
+++ linux/mm/slab.c	2014-06-02 12:34:15.279952487 -0500
@@ -455,16 +455,11 @@ static struct lock_class_key debugobj_al

 static void slab_set_lock_classes(struct kmem_cache *cachep,
 		struct lock_class_key *l3_key, struct lock_class_key *alc_key,
-		int q)
+		struct kmem_cache_node *n)
 {
 	struct array_cache **alc;
-	struct kmem_cache_node *n;
 	int r;

-	n = get_node(cachep, q);
-	if (!n)
-		return;
-
 	lockdep_set_class(&n->list_lock, l3_key);
 	alc = n->alien;
 	/*
@@ -482,17 +477,19 @@ static void slab_set_lock_classes(struct
 	}
 }

-static void slab_set_debugobj_lock_classes_node(struct kmem_cache *cachep, int node)
+static void slab_set_debugobj_lock_classes_node(struct kmem_cache *cachep,
+	struct kmem_cache_node *ne)
 {
-	slab_set_lock_classes(cachep, &debugobj_l3_key, &debugobj_alc_key, node);
+	slab_set_lock_classes(cachep, &debugobj_l3_key, &debugobj_alc_key, n);
 }

 static void slab_set_debugobj_lock_classes(struct kmem_cache *cachep)
 {
 	int node;
+	struct kmem_cache_node *n;

-	for_each_online_node(node)
-		slab_set_debugobj_lock_classes_node(cachep, node);
+	for_each_kmem_cache_node(cachep, node, h)
+		slab_set_debugobj_lock_classes_node(cachep, n);
 }

 static void init_node_lock_keys(int q)

--
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-02 17:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-30 18:27 [PATCH 0/4] slab: common kmem_cache_cpu functions V1 Christoph Lameter
2014-05-30 18:27 ` [PATCH 1/4] slab common: Add functions for kmem_cache_node access Christoph Lameter
2014-05-30 18:27 ` [PATCH 2/4] slub: Use new node functions Christoph Lameter
2014-06-02  4:59   ` Joonsoo Kim
2014-06-02 15:42     ` Christoph Lameter
2014-06-03  6:57       ` Joonsoo Kim
2014-06-03 14:47         ` Christoph Lameter
2014-05-30 18:27 ` [PATCH 3/4] slab: Use get_node function Christoph Lameter
2014-05-30 18:27 ` [PATCH 4/4] slab: Use for_each_kmem_cache_node function Christoph Lameter
2014-06-02  5:12   ` Joonsoo Kim
2014-06-02 15:45     ` Christoph Lameter
2014-06-02 15:53       ` Christoph Lameter
2014-06-02 17:43     ` Christoph Lameter [this message]

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=alpine.DEB.2.10.1406021236020.4737@gentwo.org \
    --to=cl@gentwo.org \
    --cc=akpm@linux-foundation.org \
    --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