mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: akpm@digeo.com, torvalds@transmeta.com, linux-kernel@vger.kernel.org
Cc: manfred@colorfullife.com
Subject: [PATCH] fix weird kmalloc bug
Date: Sun, 15 Jun 2003 12:28:05 +1000	[thread overview]
Message-ID: <16107.55733.155825.17744@cargo.ozlabs.ibm.com> (raw)

Last night, Manfred and I found an interesting bug with kmalloc on
ppc32, where the kmalloc in alloc_super() (fs/super.c) was requesting
432 bytes but only getting 256 bytes.  The reason was that PAGE_SIZE
wasn't defined at the point where the kmalloc() inline function
occurs.  Thus the CACHE(32) entry got omitted from the list in
kmalloc_sizes.h, and kmalloc therefore used the entry in
malloc_sizes[] before the correct entry.

This patch fixes it by including asm/page.h and asm/cache.h in
linux/slab.h.  The list in kmalloc_sizes.h depends on L1_CACHE_BYTES
as well as PAGE_SIZE, which is why I added asm/cache.h.

Paul.

diff -urN linux-2.5/include/linux/slab.h pmac-2.5-smp/include/linux/slab.h
--- linux-2.5/include/linux/slab.h	2003-06-12 10:43:55.000000000 +1000
+++ pmac-2.5/include/linux/slab.h	2003-06-14 22:16:14.000000000 +1000
@@ -13,6 +13,8 @@
 
 #include	<linux/gfp.h>
 #include	<linux/types.h>
+#include	<asm/page.h>
+#include	<asm/cache.h>
 
 /* flags for kmem_cache_alloc() */
 #define	SLAB_NOFS		GFP_NOFS

             reply	other threads:[~2003-06-15  2:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-15  2:28 Paul Mackerras [this message]
2003-06-15  6:07 ` David S. Miller

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=16107.55733.155825.17744@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manfred@colorfullife.com \
    --cc=torvalds@transmeta.com \
    /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

all inboxes | Powered by JetHome®