public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
To: Christoph Lameter <christoph@lameter.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Eric Dumazet <dada1@cosmosbay.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux kernel <linux-kernel@vger.kernel.org>
Subject: non-NUMA cache_free_alien() (was Re: [RFC] SLAB : NUMA cache_free_alien() very expensive because of virt_to_slab(objp); nodeid = slabp->nodeid;)
Date: Thu, 22 Mar 2007 14:28:31 -0700	[thread overview]
Message-ID: <20070322212831.GA25665@linux-os.sc.intel.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0703202006230.20568@graphe.net>

Christoph,

While we are at this topic, recently I had reports that
cache_free_alien() is costly on non NUMA platforms too (similar
to the cache miss issues that Eric was referring to on NUMA)
and the appended patch seems to fix it for non NUMA atleast.

Appended patch gives a nice 1% perf improvement on non-NUMA platform
with database workload.

Please comment or Ack for mainline :)

thanks,
suresh
---

Subject: [patch] slab: skip cache_free_alien() on non NUMA
From: Suresh Siddha <suresh.b.siddha@intel.com>

set use_alien_caches to 0 on non NUMA platforms. And avoid calling
the cache_free_alien() when use_alien_caches is not set. This will avoid
the cache miss that happens while dereferencing slabp to get nodeid.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
---

diff --git a/mm/slab.c b/mm/slab.c
index 8fdaffa..146082d 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1146,7 +1146,7 @@ static inline int cache_free_alien(struct kmem_cache *cachep, void *objp)
 	 * Make sure we are not freeing a object from another node to the array
 	 * cache on this cpu.
 	 */
-	if (likely(slabp->nodeid == node) || unlikely(!use_alien_caches))
+	if (likely(slabp->nodeid == node))
 		return 0;
 
 	l3 = cachep->nodelists[node];
@@ -1394,6 +1394,9 @@ void __init kmem_cache_init(void)
 	int order;
 	int node;
 
+	if (num_online_nodes() == 1)
+		use_alien_caches = 0;
+
 	for (i = 0; i < NUM_INIT_LISTS; i++) {
 		kmem_list3_init(&initkmem_list3[i]);
 		if (i < MAX_NUMNODES)
@@ -3563,7 +3566,7 @@ static inline void __cache_free(struct kmem_cache *cachep, void *objp)
 	check_irq_off();
 	objp = cache_free_debugcheck(cachep, objp, __builtin_return_address(0));
 
-	if (cache_free_alien(cachep, objp))
+	if (use_alien_caches && cache_free_alien(cachep, objp))
 		return;
 
 	if (likely(ac->avail < ac->limit)) {

  reply	other threads:[~2007-03-22 21:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-20 17:12 [RFC] SLAB : NUMA cache_free_alien() very expensive because of virt_to_slab(objp); nodeid = slabp->nodeid; Eric Dumazet
2007-03-20 19:54 ` Christoph Lameter
2007-03-20 21:32   ` Andi Kleen
2007-03-20 22:09     ` Eric Dumazet
2007-03-21  0:16       ` Christoph Lameter
2007-03-21  6:27         ` Eric Dumazet
2007-03-21  6:57           ` [PATCH] SLAB : Use num_possible_cpus() in enable_cpucache() Eric Dumazet
2007-03-21  7:21             ` [PATCH] SLAB : Dont allocate empty shared caches Eric Dumazet
2007-03-21 13:13               ` Pekka Enberg
2007-03-21 13:02             ` [PATCH] SLAB : Use num_possible_cpus() in enable_cpucache() Pekka Enberg
2007-03-21 18:45             ` Christoph Lameter
2007-03-21  7:03           ` [RFC] SLAB : NUMA cache_free_alien() very expensive because of virt_to_slab(objp); nodeid = slabp->nodeid; Christoph Lameter
2007-03-21  7:14             ` Eric Dumazet
2007-03-21 14:35               ` Christoph Lameter
2007-03-21  0:18     ` Christoph Lameter
2007-03-21  2:44       ` Andi Kleen
2007-03-21  3:10         ` Christoph Lameter
2007-03-22 21:28           ` Siddha, Suresh B [this message]
2007-03-22 22:10             ` non-NUMA cache_free_alien() (was Re: [RFC] SLAB : NUMA cache_free_alien() very expensive because of virt_to_slab(objp); nodeid = slabp->nodeid;) Christoph Lameter
2007-03-22 22:12             ` Eric Dumazet
2007-03-22 22:40               ` Siddha, Suresh B
2007-03-22 22:56                 ` Eric Dumazet
2007-03-23  1:25                 ` Christoph Lameter
2007-03-23 14:14                   ` Andi Kleen
2007-03-23 14:12                 ` Andi Kleen
2007-04-02 22:55                   ` Siddha, Suresh B
2007-04-03  0:23                     ` Christoph Lameter
2007-04-03  0:31                       ` Siddha, Suresh B
2007-04-09 18:01                       ` [patch 1/2] x86_64: set node_possible_map at runtime Siddha, Suresh B
2007-04-09 18:07                         ` [patch 2/2] slab, x86_64: skip cache_free_alien() on non NUMA Siddha, Suresh B
2007-04-09 20:23                         ` [patch 1/2] x86_64: set node_possible_map at runtime Andrew Morton

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=20070322212831.GA25665@linux-os.sc.intel.com \
    --to=suresh.b.siddha@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=christoph@lameter.com \
    --cc=dada1@cosmosbay.com \
    --cc=linux-kernel@vger.kernel.org \
    /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