From: Badari Pulavarty <pbadari@us.ibm.com>
To: linux-mm@kvack.org, Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] 2.6.9-rc3-mm2 alloc_percpu fix for non-NUMA
Date: 07 Oct 2004 08:06:25 -0700 [thread overview]
Message-ID: <1097161585.12861.240.camel@dyn318077bld.beaverton.ibm.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 752 bytes --]
Hi,
alloc_percpu() calls kmem_cache_alloc_node() to allocate memory
on a particular node. But for non-NUMA cases, it doesn't matter
all the memory comes from same node. This patch short-cuts and
calls kmalloc() if its non-NUMA. I hate to add #ifdefs in the
mainline code, but I don't see easy way around.
kmem_cache_alloc_node()allocates a new slab to satisfy allocation
from that node instead of doing it from a partial slab from that node
- which causes fragmentation (with my scsi-debug tests). Thats my
next problem to deal with.
BTW, with this patch size-64 cache is no longer fragmented for
scsi-debug test case.
size-64 76920 76921 64 61 1 : tunables 120 60
8 : slabdata 1261 1261 0
Thanks,
Badari
[-- Attachment #2: alloc_percpu_fix.patch --]
[-- Type: text/plain, Size: 550 bytes --]
Signed-off-by: pbadari@us.ibm.com
--- linux-2.6.9-rc3.org/mm/slab.c 2004-10-07 07:55:05.451137928 -0700
+++ linux-2.6.9-rc3/mm/slab.c 2004-10-07 07:55:56.990160360 -0700
@@ -2452,9 +2452,13 @@ void *__alloc_percpu(size_t size, size_t
for (i = 0; i < NR_CPUS; i++) {
if (!cpu_possible(i))
continue;
+#ifdef CONFIG_NUMA
pdata->ptrs[i] = kmem_cache_alloc_node(
kmem_find_general_cachep(size, GFP_KERNEL),
cpu_to_node(i));
+#else
+ pdata->ptrs[i] = kmalloc(size, GFP_KERNEL);
+#endif
if (!pdata->ptrs[i])
goto unwind_oom;
reply other threads:[~2004-10-07 15:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1097161585.12861.240.camel@dyn318077bld.beaverton.ibm.com \
--to=pbadari@us.ibm.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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