Re: linux-next: build failure after merge of the final tree (slab tree related)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Christoph Lameter
Date: Thursday, August 26, 2010 - 7:41 am

On Wed, 25 Aug 2010, David Rientjes wrote:


So do I. Here is a slightly less hacky version through using
kmalloc_large instead:


Subject: Slub: UP bandaid

Since the percpu allocator does not provide early allocation in UP
mode (only in SMP configurations) use __get_free_page() to improvise
a compound page allocation that can be later freed via kfree().

Compound pages will be released when the cpu caches are resized.

Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Christoph Lameter <cl@linux.com>
---
 mm/slub.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c	2010-08-26 09:19:35.000000000 -0500
+++ linux-2.6/mm/slub.c	2010-08-26 09:36:29.000000000 -0500
@@ -2103,8 +2103,24 @@ init_kmem_cache_node(struct kmem_cache_n

 static inline int alloc_kmem_cache_cpus(struct kmem_cache *s)
 {
+#ifdef CONFIG_SMP
+	/*
+	 * Will use reserve that does not require slab operation during
+	 * early boot.
+	 */
 	BUILD_BUG_ON(PERCPU_DYNAMIC_EARLY_SIZE <
 			SLUB_PAGE_SHIFT * sizeof(struct kmem_cache_cpu));
+#else
+	/*
+	 * Special hack for UP mode. allocpercpu() falls back to kmalloc
+	 * operations. So we cannot use that before the slab allocator is up
+	 * Simply get the smallest possible compound page. The page will be
+	 * released via kfree() when the cpu caches are resized later.
+	 */
+	if (slab_state < UP)
+		s->cpu_slab = (__percpu void *)kmalloc_large(PAGE_SIZE << 1, GFP_NOWAIT);
+	else
+#endif

 	s->cpu_slab = alloc_percpu(struct kmem_cache_cpu);

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Tue Aug 24, 10:59 am)
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Tue Aug 24, 11:53 am)
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Wed Aug 25, 6:50 am)
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Wed Aug 25, 7:07 am)
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Wed Aug 25, 1:12 pm)
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Wed Aug 25, 2:37 pm)
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Wed Aug 25, 6:35 pm)
Re: linux-next: build failure after merge of the final tre ..., Christoph Lameter, (Thu Aug 26, 7:41 am)
Re: [PATCH 1/3] vmalloc: pcpu_get/free_vm_areas() aren't n ..., Christoph Lameter, (Fri Sep 3, 10:16 am)
Re: [PATCH 2/3] percpu: reduce PCPU_MIN_UNIT_SIZE to 32k, Christoph Lameter, (Fri Sep 3, 10:18 am)
Re: [PATCH 3/3] percpu: use percpu allocator on UP too, Christoph Lameter, (Fri Sep 3, 11:43 am)
Re: [PATCH 3/3] percpu: use percpu allocator on UP too, Pekka Enberg, (Fri Sep 3, 11:54 pm)
Re: [PATCH 3/3] percpu: use percpu allocator on UP too, Pekka Enberg, (Sat Sep 18, 10:47 am)