From: roel <roel.kluin@gmail.com>
To: linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: slab: too much allocated in bootstrap head arrays?
Date: Mon, 12 Dec 2011 23:16:21 +0100 [thread overview]
Message-ID: <4EE67D35.5000307@gmail.com> (raw)
In mm/slab.c kmem_cache_init() at /* 4) Replace the bootstrap head arrays */
it kmallocs *ptr and memcpy's with sizeof(struct arraycache_init). Is this
correct or should it maybe be with sizeof(struct arraycache) instead?
Please review, i.e. this change:
---
It appears we allocated and copied too much.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
mm/slab.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 83311c9a..6978cbf 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1617,11 +1617,11 @@ void __init kmem_cache_init(void)
{
struct array_cache *ptr;
- ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
+ ptr = kmalloc(sizeof(struct arraycache), GFP_NOWAIT);
BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
memcpy(ptr, cpu_cache_get(&cache_cache),
- sizeof(struct arraycache_init));
+ sizeof(struct arraycache));
/*
* Do not assume that spinlocks can be initialized via memcpy:
*/
@@ -1629,12 +1629,12 @@ void __init kmem_cache_init(void)
cache_cache.array[smp_processor_id()] = ptr;
- ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
+ ptr = kmalloc(sizeof(struct arraycache), GFP_NOWAIT);
BUG_ON(cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep)
!= &initarray_generic.cache);
memcpy(ptr, cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep),
- sizeof(struct arraycache_init));
+ sizeof(struct arraycache));
/*
* Do not assume that spinlocks can be initialized via memcpy:
*/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: roel <roel.kluin@gmail.com>
To: linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: slab: too much allocated in bootstrap head arrays?
Date: Mon, 12 Dec 2011 23:16:21 +0100 [thread overview]
Message-ID: <4EE67D35.5000307@gmail.com> (raw)
In mm/slab.c kmem_cache_init() at /* 4) Replace the bootstrap head arrays */
it kmallocs *ptr and memcpy's with sizeof(struct arraycache_init). Is this
correct or should it maybe be with sizeof(struct arraycache) instead?
Please review, i.e. this change:
---
It appears we allocated and copied too much.
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
mm/slab.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/slab.c b/mm/slab.c
index 83311c9a..6978cbf 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1617,11 +1617,11 @@ void __init kmem_cache_init(void)
{
struct array_cache *ptr;
- ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
+ ptr = kmalloc(sizeof(struct arraycache), GFP_NOWAIT);
BUG_ON(cpu_cache_get(&cache_cache) != &initarray_cache.cache);
memcpy(ptr, cpu_cache_get(&cache_cache),
- sizeof(struct arraycache_init));
+ sizeof(struct arraycache));
/*
* Do not assume that spinlocks can be initialized via memcpy:
*/
@@ -1629,12 +1629,12 @@ void __init kmem_cache_init(void)
cache_cache.array[smp_processor_id()] = ptr;
- ptr = kmalloc(sizeof(struct arraycache_init), GFP_NOWAIT);
+ ptr = kmalloc(sizeof(struct arraycache), GFP_NOWAIT);
BUG_ON(cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep)
!= &initarray_generic.cache);
memcpy(ptr, cpu_cache_get(malloc_sizes[INDEX_AC].cs_cachep),
- sizeof(struct arraycache_init));
+ sizeof(struct arraycache));
/*
* Do not assume that spinlocks can be initialized via memcpy:
*/
next reply other threads:[~2011-12-12 22:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 22:16 roel [this message]
2011-12-12 22:16 ` slab: too much allocated in bootstrap head arrays? roel
2011-12-13 16:15 ` Christoph Lameter
2011-12-13 16:15 ` Christoph Lameter
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=4EE67D35.5000307@gmail.com \
--to=roel.kluin@gmail.com \
--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 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.