mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
	Torsten Kaiser <just.for.lkml@googlemail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Christoph Lameter <clameter@sgi.com>
Subject: Re: Linux 2.6.25-rc2
Date: Tue, 19 Feb 2008 15:57:19 +0100	[thread overview]
Message-ID: <20080219145719.GA22898@elte.hu> (raw)
In-Reply-To: <20080219145554.GE21176@elte.hu>


* Ingo Molnar <mingo@elte.hu> wrote:

> If this (or my other patch) indeed solves the problem i'd still favor 
> a full revert of the SLUB_FASTPATH (commit 1f84260c8ce3b1ce26d4), it 
> looks quite un-cooked and quite un-tested for multiple independent 
> reasons.
> 
> Sigh, why do i again have to be the messenger who brings the bad news 
> to SLUB land, and again when poor Christoph went on vacation? :-/

the revert patch is below. (manually done due to other changes since 
1f84260c8ce3b1ce26d4 was commited, but trivial)

	Ingo

----------------->
Subject: slub: fastpath optimization revert
From: Ingo Molnar <mingo@elte.hu>
Date: Tue Feb 19 15:46:37 CET 2008

revert:

  commit 1f84260c8ce3b1ce26d4c1d6dedc2f33a3a29c0c
  Author: Christoph Lameter <clameter@sgi.com>
  Date:   Mon Jan 7 23:20:30 2008 -0800

      SLUB: Alternate fast paths using cmpxchg_local

it was causing problems (crashes) and was incomplete.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 mm/slub.c |   87 --------------------------------------------------------------
 1 file changed, 87 deletions(-)

Index: linux-x86.q/mm/slub.c
===================================================================
--- linux-x86.q.orig/mm/slub.c
+++ linux-x86.q/mm/slub.c
@@ -149,13 +149,6 @@ static inline void ClearSlabDebug(struct
 /* Enable to test recovery from slab corruption on boot */
 #undef SLUB_RESILIENCY_TEST
 
-/*
- * Currently fastpath is not supported if preemption is enabled.
- */
-#if defined(CONFIG_FAST_CMPXCHG_LOCAL) && !defined(CONFIG_PREEMPT)
-#define SLUB_FASTPATH
-#endif
-
 #if PAGE_SHIFT <= 12
 
 /*
@@ -1514,11 +1507,6 @@ static void *__slab_alloc(struct kmem_ca
 {
 	void **object;
 	struct page *new;
-#ifdef SLUB_FASTPATH
-	unsigned long flags;
-
-	local_irq_save(flags);
-#endif
 	if (!c->page)
 		goto new_slab;
 
@@ -1541,9 +1529,6 @@ load_freelist:
 unlock_out:
 	slab_unlock(c->page);
 	stat(c, ALLOC_SLOWPATH);
-#ifdef SLUB_FASTPATH
-	local_irq_restore(flags);
-#endif
 	return object;
 
 another_slab:
@@ -1575,9 +1560,6 @@ new_slab:
 		c->page = new;
 		goto load_freelist;
 	}
-#ifdef SLUB_FASTPATH
-	local_irq_restore(flags);
-#endif
 	/*
 	 * No memory available.
 	 *
@@ -1619,34 +1601,6 @@ static __always_inline void *slab_alloc(
 {
 	void **object;
 	struct kmem_cache_cpu *c;
-
-/*
- * The SLUB_FASTPATH path is provisional and is currently disabled if the
- * kernel is compiled with preemption or if the arch does not support
- * fast cmpxchg operations. There are a couple of coming changes that will
- * simplify matters and allow preemption. Ultimately we may end up making
- * SLUB_FASTPATH the default.
- *
- * 1. The introduction of the per cpu allocator will avoid array lookups
- *    through get_cpu_slab(). A special register can be used instead.
- *
- * 2. The introduction of per cpu atomic operations (cpu_ops) means that
- *    we can realize the logic here entirely with per cpu atomics. The
- *    per cpu atomic ops will take care of the preemption issues.
- */
-
-#ifdef SLUB_FASTPATH
-	c = get_cpu_slab(s, raw_smp_processor_id());
-	do {
-		object = c->freelist;
-		if (unlikely(is_end(object) || !node_match(c, node))) {
-			object = __slab_alloc(s, gfpflags, node, addr, c);
-			break;
-		}
-		stat(c, ALLOC_FASTPATH);
-	} while (cmpxchg_local(&c->freelist, object, object[c->offset])
-								!= object);
-#else
 	unsigned long flags;
 
 	local_irq_save(flags);
@@ -1661,7 +1615,6 @@ static __always_inline void *slab_alloc(
 		stat(c, ALLOC_FASTPATH);
 	}
 	local_irq_restore(flags);
-#endif
 
 	if (unlikely((gfpflags & __GFP_ZERO) && object))
 		memset(object, 0, c->objsize);
@@ -1698,11 +1651,6 @@ static void __slab_free(struct kmem_cach
 	void **object = (void *)x;
 	struct kmem_cache_cpu *c;
 
-#ifdef SLUB_FASTPATH
-	unsigned long flags;
-
-	local_irq_save(flags);
-#endif
 	c = get_cpu_slab(s, raw_smp_processor_id());
 	stat(c, FREE_SLOWPATH);
 	slab_lock(page);
@@ -1734,9 +1682,6 @@ checks_ok:
 
 out_unlock:
 	slab_unlock(page);
-#ifdef SLUB_FASTPATH
-	local_irq_restore(flags);
-#endif
 	return;
 
 slab_empty:
@@ -1749,9 +1694,6 @@ slab_empty:
 	}
 	slab_unlock(page);
 	stat(c, FREE_SLAB);
-#ifdef SLUB_FASTPATH
-	local_irq_restore(flags);
-#endif
 	discard_slab(s, page);
 	return;
 
@@ -1777,34 +1719,6 @@ static __always_inline void slab_free(st
 {
 	void **object = (void *)x;
 	struct kmem_cache_cpu *c;
-
-#ifdef SLUB_FASTPATH
-	void **freelist;
-
-	c = get_cpu_slab(s, raw_smp_processor_id());
-	debug_check_no_locks_freed(object, s->objsize);
-	do {
-		freelist = c->freelist;
-		barrier();
-		/*
-		 * If the compiler would reorder the retrieval of c->page to
-		 * come before c->freelist then an interrupt could
-		 * change the cpu slab before we retrieve c->freelist. We
-		 * could be matching on a page no longer active and put the
-		 * object onto the freelist of the wrong slab.
-		 *
-		 * On the other hand: If we already have the freelist pointer
-		 * then any change of cpu_slab will cause the cmpxchg to fail
-		 * since the freelist pointers are unique per slab.
-		 */
-		if (unlikely(page != c->page || c->node < 0)) {
-			__slab_free(s, page, x, addr, c->offset);
-			break;
-		}
-		object[c->offset] = freelist;
-		stat(c, FREE_FASTPATH);
-	} while (cmpxchg_local(&c->freelist, freelist, object) != freelist);
-#else
 	unsigned long flags;
 
 	local_irq_save(flags);
@@ -1818,7 +1732,6 @@ static __always_inline void slab_free(st
 		__slab_free(s, page, x, addr, c->offset);
 
 	local_irq_restore(flags);
-#endif
 }
 
 void kmem_cache_free(struct kmem_cache *s, void *x)

  reply	other threads:[~2008-02-19 14:57 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 21:23 Linus Torvalds
2008-02-16  2:08 ` Rafael J. Wysocki
2008-02-16  5:44 ` [BUG] Linux 2.6.25-rc2 - Kernel Ooops while running dbench Kamalesh Babulal
2008-02-18 12:59   ` Andrew Morton
2008-02-18 14:25     ` Jeff Garzik
2008-02-18 16:11       ` Frans Pop
2008-03-03 11:51     ` Pekka Enberg
2008-03-04  4:03       ` Kamalesh Babulal
2008-02-16  6:10 ` [BUG] Linux 2.6.25-rc2 - Regression from 2.6.24-rc1-git1 softlockup while bootup on powerpc Kamalesh Babulal
2008-02-17 19:29   ` Jens Axboe
2008-02-19  8:04     ` KAMEZAWA Hiroyuki
2008-02-19  8:36       ` Jens Axboe
2008-02-19  8:47         ` KAMEZAWA Hiroyuki
2008-02-19  8:58           ` Jens Axboe
2008-02-19  9:07             ` KAMEZAWA Hiroyuki
2008-02-19  9:09               ` Jens Axboe
2008-02-19  9:02         ` KAMEZAWA Hiroyuki
2008-02-19  9:01           ` Jens Axboe
2008-02-19 13:19         ` Kamalesh Babulal
2008-02-22  7:24         ` Andrew Morton
2008-02-22  7:40           ` Jens Axboe
2008-02-17 20:08   ` Rafael J. Wysocki
2008-02-16 16:52 ` Linux 2.6.25-rc2 Jan Engelhardt
2008-02-16 19:14 ` Linux 2.6.25-rc2 regression: LVM cannot find volume group Tilman Schmidt
2008-02-16 20:12   ` Alan Cox
2008-02-16 22:37     ` Jiri Slaby
2008-02-18  0:57       ` Tilman Schmidt
2008-02-18  1:22         ` Jeff Chua
2008-02-18 10:35           ` Tilman Schmidt
2008-02-19  1:53       ` Alasdair G Kergon
2008-02-19  8:56         ` Tilman Schmidt
2008-02-16 21:38 ` Linux 2.6.25-rc2 Torsten Kaiser
2008-02-17 20:25   ` Rafael J. Wysocki
2008-02-17 21:32     ` Torsten Kaiser
2008-02-18 23:54   ` Linus Torvalds
2008-02-19  6:44     ` Torsten Kaiser
2008-02-19  6:11   ` Ingo Molnar
2008-02-19  6:54     ` Torsten Kaiser
2008-02-19  7:21       ` Pekka Enberg
2008-02-19 10:27         ` Ingo Molnar
2008-02-19 10:45           ` Pekka Enberg
2008-02-19 13:02           ` Mathieu Desnoyers
2008-02-19 14:00             ` Ingo Molnar
2008-02-19 14:02         ` Mathieu Desnoyers
2008-02-19 14:21           ` Pekka Enberg
2008-02-19 14:38             ` Pekka Enberg
2008-02-19 14:55               ` Ingo Molnar
2008-02-19 14:57                 ` Ingo Molnar [this message]
2008-02-19 15:54                   ` Pekka Enberg
2008-02-19 15:52                 ` Pekka Enberg
2008-02-20  0:36                   ` Zhang, Yanmin
2008-02-20  2:08                     ` Zhang, Yanmin
2008-02-20  6:53                       ` Zhang, Yanmin
2008-02-20  7:10                         ` Pekka Enberg
2008-02-19 16:20               ` Linus Torvalds
2008-02-19 16:45                 ` Ingo Molnar
2008-02-19 16:48                   ` Ingo Molnar
2008-02-19 19:27                 ` Torsten Kaiser
2008-02-19 20:08             ` Mathieu Desnoyers
2008-02-27 23:32               ` Christoph Lameter
2008-02-28  1:57                 ` Andrew Morton
2008-02-28  2:43                   ` Christoph Lameter
2008-02-28  8:14                   ` Ingo Molnar
2008-02-28 11:15                     ` Alan Cox
2008-02-28 11:13                   ` Jiri Kosina
2008-02-19 16:27           ` Eric Dumazet
2008-02-19 16:38             ` Linus Torvalds
2008-02-19 20:03             ` Mathieu Desnoyers
2008-02-27 23:34               ` Christoph Lameter
2008-02-28  5:55                 ` [PATCH] Implement slub fastpath in terms of freebase and freeoffset Mathieu Desnoyers
2008-02-28 19:08                   ` Christoph Lameter
2008-02-28 23:25                     ` Mathieu Desnoyers
2008-02-29  0:57                       ` Christoph Lameter
2008-02-29  1:56                         ` Mathieu Desnoyers
2008-02-29  2:12                           ` Christoph Lameter
2008-02-29  3:32                             ` Mathieu Desnoyers
2008-02-29  5:11                               ` Christoph Lameter
2008-02-29 13:03                                 ` Mathieu Desnoyers
2008-02-29 19:57                                   ` Christoph Lameter
2008-02-29 13:28                                 ` [PATCH] Slub Freeoffset check overflow Mathieu Desnoyers
2008-03-04  6:17                                   ` [PATCH] Slub Freeoffset check overflow (updated) Mathieu Desnoyers
2008-03-04  7:15                                     ` Christoph Lameter
2008-02-27 23:32             ` Linux 2.6.25-rc2 Christoph Lameter
2008-02-19 18:39           ` Torsten Kaiser

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=20080219145719.GA22898@elte.hu \
    --to=mingo@elte.hu \
    --cc=clameter@sgi.com \
    --cc=just.for.lkml@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@polymtl.ca \
    --cc=penberg@cs.helsinki.fi \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®