All of lore.kernel.org
 help / color / mirror / Atom feed
* + fix-spellings-of-slab-allocator-section-in-init-kconfig.patch added to -mm tree
@ 2007-05-08 23:02 akpm
  2007-05-09  0:23 ` Matt Mackall
  0 siblings, 1 reply; 38+ messages in thread
From: akpm @ 2007-05-08 23:02 UTC (permalink / raw)
  To: mm-commits; +Cc: clameter, mpm


The patch titled
     Fix spellings of slab allocator section in init/Kconfig
has been added to the -mm tree.  Its filename is
     fix-spellings-of-slab-allocator-section-in-init-kconfig.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: Fix spellings of slab allocator section in init/Kconfig
From: Christoph Lameter <clameter@sgi.com>

Fix some of the spelling issues. Fix sentences. Discourage SLOB use
since SLUB can pack objects denser.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 init/Kconfig |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diff -puN init/Kconfig~fix-spellings-of-slab-allocator-section-in-init-kconfig init/Kconfig
--- a/init/Kconfig~fix-spellings-of-slab-allocator-section-in-init-kconfig
+++ a/init/Kconfig
@@ -523,9 +523,9 @@ config SLAB
 	bool "SLAB"
 	help
 	  The regular slab allocator that is established and known to work
-	  well in all environments. It organizes chache hot objects in
+	  well in all environments. It organizes cache hot objects in
 	  per cpu and per node queues. SLAB is the default choice for
-	  slab allocator.
+	  a slab allocator.
 
 config SLUB
 	depends on EXPERIMENTAL && !ARCH_USES_SLAB_PAGE_STRUCT
@@ -535,21 +535,20 @@ config SLUB
 	   instead of managing queues of cached objects (SLAB approach).
 	   Per cpu caching is realized using slabs of objects instead
 	   of queues of objects. SLUB can use memory efficiently
-	   way and has enhanced diagnostics.
+	   and has enhanced diagnostics.
 
 config SLOB
 #
-#	SLOB cannot support SMP because SLAB_DESTROY_BY_RCU does not work
-#	properly.
+#	SLOB does not support SMP because SLAB_DESTROY_BY_RCU is unsupported
 #
 	depends on EMBEDDED && !SMP && !SPARSEMEM
 	bool "SLOB (Simple Allocator)"
 	help
 	   SLOB replaces the SLAB allocator with a drastically simpler
 	   allocator.  SLOB is more space efficient that SLAB but does not
-	   scale well (single lock for all operations) and is more susceptible
-	   to fragmentation. SLOB it is a great choice to reduce
-	   memory usage and code size for embedded systems.
+	   scale well (single lock for all operations) and is also highly
+	   susceptible to fragmentation. SLUB can accomplish a higher object
+	   density. It is usually better to use SLUB instead of SLOB.
 
 endchoice
 
_

Patches currently in -mm which might be from clameter@sgi.com are

origin.patch
slub-add-support-for-dynamic-cacheline-size-determination.patch
slub-add-support-for-dynamic-cacheline-size-determination-fix.patch
slub-after-object-padding-only-needed-for-redzoning.patch
slub-slabinfo-upgrade.patch
slub-use-check_valid_pointer-in-kmem_ptr_validate.patch
slub-clean-up-krealloc.patch
slub-clean-up-krealloc-fix.patch
slub-get-rid-of-finish_bootstrap.patch
slub-update-comments.patch
slub-add-macros-for-scanning-objects-in-a-slab.patch
slub-move-resiliency-check-into-sysfs-section.patch
slub-introduce-debugslabpage.patch
slub-consolidate-trace-code.patch
slub-move-tracking-definitions-and-check_valid_pointer-away-from-debug-code.patch
slub-add-config_slub_debug.patch
slub-include-lifetime-stats-and-sets-of-cpus--nodes-in-tracking-output.patch
slub-include-lifetime-stats-and-sets-of-cpus--nodes-in-tracking-output-fix.patch
slub-rework-slab-order-determination.patch
fix-spellings-of-slab-allocator-section-in-init-kconfig.patch
slub-support-concurrent-local-and-remote-frees-and-allocs-on-a-slab.patch
quicklist-support-for-ia64.patch
quicklist-support-for-x86_64.patch
slub-exploit-page-mobility-to-increase-allocation-order.patch
slub-mm-only-make-slub-the-default-slab-allocator.patch
slub-reduce-antifrag-max-order.patch
slub-i386-support.patch
remove-constructor-from-buffer_head.patch
slab-shutdown-cache_reaper-when-cpu-goes-down.patch
mm-implement-swap-prefetching.patch
revoke-core-code-slab-allocators-remove-slab_debug_initial-flag-revoke.patch
vmstat-use-our-own-timer-events.patch
vmstat-use-our-own-timer-events-fix.patch
make-vm-statistics-update-interval-configurable.patch
make-vm-statistics-update-interval-configurable-fix.patch
move-remote-node-draining-out-of-slab-allocators.patch

^ permalink raw reply	[flat|nested] 38+ messages in thread
* [patch] slob: implement RCU freeing
@ 2007-05-09  4:17 Nick Piggin
  0 siblings, 0 replies; 38+ messages in thread
From: Nick Piggin @ 2007-05-09  4:17 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Linux Memory Management

[-- Attachment #1: Type: text/plain, Size: 4 bytes --]

-- 

[-- Attachment #2: slob-add-rcu.patch --]
[-- Type: text/plain, Size: 3053 bytes --]

SLOB allocator should implement SLAB_DESTROY_BY_RCU correctly, because even
on UP, RCU freeing semantics are not equivalent to simply freeing immediately.
This also allows SLOB to be used on SMP.

Signed-off-by: Nick Piggin <npiggin@suse.de>

Index: linux-2.6/init/Kconfig
===================================================================
--- linux-2.6.orig/init/Kconfig	2007-05-09 11:54:11.000000000 +1000
+++ linux-2.6/init/Kconfig	2007-05-09 11:54:50.000000000 +1000
@@ -476,7 +476,7 @@
 
 config SLAB
 	default y
-	bool "Use full SLAB allocator" if (EMBEDDED && !SMP && !SPARSEMEM)
+	bool "Use full SLAB allocator" if (EMBEDDED && !SPARSEMEM)
 	help
 	  Disabling this replaces the advanced SLAB allocator and
 	  kmalloc support with the drastically simpler SLOB allocator.
Index: linux-2.6/mm/slob.c
===================================================================
--- linux-2.6.orig/mm/slob.c	2007-05-09 11:54:11.000000000 +1000
+++ linux-2.6/mm/slob.c	2007-05-09 11:54:55.000000000 +1000
@@ -35,6 +35,7 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/timer.h>
+#include <linux/rcupdate.h>
 
 struct slob_block {
 	int units;
@@ -53,6 +54,11 @@
 };
 typedef struct bigblock bigblock_t;
 
+struct slob_rcu {
+	struct rcu_head head;
+	int size;
+};
+
 static slob_t arena = { .next = &arena, .units = 1 };
 static slob_t *slobfree = &arena;
 static bigblock_t *bigblocks;
@@ -242,6 +248,7 @@
 
 struct kmem_cache {
 	unsigned int size, align;
+	unsigned long flags;
 	const char *name;
 	void (*ctor)(void *, struct kmem_cache *, unsigned long);
 	void (*dtor)(void *, struct kmem_cache *, unsigned long);
@@ -259,6 +266,12 @@
 	if (c) {
 		c->name = name;
 		c->size = size;
+		if (flags & SLAB_DESTROY_BY_RCU) {
+			BUG_ON(c->dtor);
+			/* leave room for rcu footer at the end of object */
+			c->size += sizeof(struct slob_rcu);
+		}
+		c->flags = flags;
 		c->ctor = ctor;
 		c->dtor = dtor;
 		/* ignore alignment unless it's forced */
@@ -303,15 +316,35 @@
 }
 EXPORT_SYMBOL(kmem_cache_zalloc);
 
-void kmem_cache_free(struct kmem_cache *c, void *b)
+static void __kmem_cache_free(void *b, int size)
 {
-	if (c->dtor)
-		c->dtor(b, c, 0);
-
-	if (c->size < PAGE_SIZE)
-		slob_free(b, c->size);
+	if (size < PAGE_SIZE)
+		slob_free(b, size);
 	else
-		free_pages((unsigned long)b, find_order(c->size));
+		free_pages((unsigned long)b, find_order(size));
+}
+
+static void kmem_rcu_free(struct rcu_head *head)
+{
+	struct slob_rcu *slob_rcu = (struct slob_rcu *)head;
+	void *b = (void *)slob_rcu - (slob_rcu->size - sizeof(struct slob_rcu));
+
+	__kmem_cache_free(b, slob_rcu->size);
+}
+
+void kmem_cache_free(struct kmem_cache *c, void *b)
+{
+	if (unlikely(c->flags & SLAB_DESTROY_BY_RCU)) {
+		struct slob_rcu *slob_rcu;
+		slob_rcu = b + (c->size - sizeof(struct slob_rcu));
+		INIT_RCU_HEAD(&slob_rcu->head);
+		slob_rcu->size = c->size;
+		call_rcu(&slob_rcu->head, kmem_rcu_free);
+	} else {
+		if (c->dtor)
+			c->dtor(b, c, 0);
+		__kmem_cache_free(b, c->size);
+	}
 }
 EXPORT_SYMBOL(kmem_cache_free);
 

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2007-05-10  8:29 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-08 23:02 + fix-spellings-of-slab-allocator-section-in-init-kconfig.patch added to -mm tree akpm
2007-05-09  0:23 ` Matt Mackall
2007-05-09  0:32   ` Alan Cox
2007-05-09  0:33     ` Matt Mackall
2007-05-09  0:43       ` Christoph Lameter
2007-05-09  0:51   ` Christoph Lameter
2007-05-09  1:27     ` Matt Mackall
2007-05-09  1:32       ` Christoph Lameter
2007-05-09  1:51         ` David Miller
2007-05-09  1:53           ` Christoph Lameter
2007-05-09  1:55             ` David Miller
2007-05-09  1:57               ` Christoph Lameter
2007-05-09  2:06                 ` David Miller
2007-05-09  2:10                   ` Nick Piggin
2007-05-09  2:20                     ` Christoph Lameter
2007-05-09  2:02           ` Nick Piggin
2007-05-09  2:56             ` Matt Mackall
2007-05-09  3:18               ` Nick Piggin
2007-05-09  3:27                 ` Christoph Lameter
2007-05-09  3:47                 ` Nick Piggin
2007-05-10  0:42             ` Andrew Morton
2007-05-10  1:00               ` Nick Piggin
2007-05-10  2:27                 ` Matt Mackall
2007-05-10  7:15                   ` [patch] slob: implement RCU freeing Nick Piggin
2007-05-10  7:19                     ` Nick Piggin
2007-05-10  8:22                     ` Peter Zijlstra
2007-05-10  8:26                       ` Nick Piggin
2007-05-10  8:29                         ` Peter Zijlstra
2007-05-09  2:19         ` + fix-spellings-of-slab-allocator-section-in-init-kconfig.patch added to -mm tree Matt Mackall
2007-05-09  2:24           ` Christoph Lameter
2007-05-09  2:43             ` Nick Piggin
2007-05-09  2:57               ` Christoph Lameter
2007-05-09  3:04                 ` Nick Piggin
2007-05-09  3:08                   ` Christoph Lameter
2007-05-09  3:25                 ` Matt Mackall
2007-05-09  3:16             ` Matt Mackall
2007-05-09  3:24               ` Christoph Lameter
  -- strict thread matches above, loose matches on Subject: below --
2007-05-09  4:17 [patch] slob: implement RCU freeing Nick Piggin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.