linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* slab: too much allocated in bootstrap head arrays?
@ 2011-12-12 22:16 roel
  2011-12-13 16:15 ` Christoph Lameter
  0 siblings, 1 reply; 2+ messages in thread
From: roel @ 2011-12-12 22:16 UTC (permalink / raw)
  To: linux-mm, LKML

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>

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

end of thread, other threads:[~2011-12-13 16:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-12 22:16 slab: too much allocated in bootstrap head arrays? roel
2011-12-13 16:15 ` Christoph Lameter

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