linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <cl@linux.com>
To: David Rientjes <rientjes@google.com>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tejun Heo <tj@kernel.org>
Subject: Re: linux-next: build failure after merge of the final tree (slab tree related)
Date: Thu, 26 Aug 2010 09:41:19 -0500 (CDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1008260938360.16331@router.home> (raw)
In-Reply-To: <alpine.DEB.2.00.1008252014560.10986@chino.kir.corp.google.com>

On Wed, 25 Aug 2010, David Rientjes wrote:

> I'm really hoping that we can remove this hack soon when the percpu
> allocator can handle these allocations on UP without any specialized slab
> behavior.

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);

  reply	other threads:[~2010-08-26 14:41 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-24  2:07 linux-next: build failure after merge of the final tree (slab tree related) Stephen Rothwell
2010-08-24 17:41 ` Pekka Enberg
2010-08-24 17:59   ` Christoph Lameter
2010-08-24 18:32     ` Pekka Enberg
2010-08-24 18:53       ` Christoph Lameter
2010-08-25  8:18         ` Tejun Heo
2010-08-25  8:57           ` Pekka Enberg
2010-08-25 13:50             ` Christoph Lameter
2010-08-26  8:35               ` Tejun Heo
2010-09-03 16:25                 ` [PATCH 1/3] vmalloc: pcpu_get/free_vm_areas() aren't needed on UP Tejun Heo
2010-09-03 17:16                   ` Christoph Lameter
2010-09-03 16:26                 ` [PATCH 2/3] percpu: reduce PCPU_MIN_UNIT_SIZE to 32k Tejun Heo
2010-09-03 17:18                   ` Christoph Lameter
2010-09-03 16:26                 ` [PATCH 3/3] percpu: use percpu allocator on UP too Tejun Heo
2010-09-03 18:43                   ` Christoph Lameter
2010-09-04  6:54                   ` Pekka Enberg
2010-09-04  9:47                     ` Tejun Heo
2010-09-08  9:17                       ` Tejun Heo
2010-09-10 14:59                         ` Tejun Heo
2010-09-18 17:47                           ` Pekka Enberg
2010-09-03 16:27                 ` [PATCH RESEND 1/3] vmalloc: pcpu_get/free_vm_areas() aren't needed on UP Tejun Heo
2010-08-25 20:12           ` linux-next: build failure after merge of the final tree (slab tree related) Christoph Lameter
2010-08-25 21:37             ` Christoph Lameter
2010-08-25  0:13   ` Stephen Rothwell
2010-08-25  4:46     ` Pekka Enberg
2010-08-25 14:07       ` Christoph Lameter
2010-08-26  0:01         ` David Rientjes
2010-08-26  1:35           ` Christoph Lameter
2010-08-26  3:16             ` David Rientjes
2010-08-26 14:41               ` Christoph Lameter [this message]
2010-08-26 18:16                 ` Pekka Enberg
2013-08-14  7:53 Stephen Rothwell

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.00.1008260938360.16331@router.home \
    --to=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    --cc=rientjes@google.com \
    --cc=sfr@canb.auug.org.au \
    --cc=tj@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;
as well as URLs for NNTP newsgroup(s).