From: Ralf Baechle <ralf@linux-mips.org>
To: naveen yadav <yad.naveen@gmail.com>
Cc: linux-mips@linux-mips.org
Subject: Re: kmalloc issue on MIPS target
Date: Wed, 18 Aug 2010 14:33:36 +0100 [thread overview]
Message-ID: <20100818133336.GA25740@linux-mips.org> (raw)
In-Reply-To: <AANLkTiniH42L=-DdJ_XHOm1Uo_=YoAqE-j9Jrm45imtG@mail.gmail.com>
On Wed, Aug 18, 2010 at 06:07:12PM +0530, naveen yadav wrote:
> To: majordomo@kvack.org, linux-mips@linux-mips.org
Your sentences are to complex for majordomo to understand. Also its
area of expertise is generally limited to mailing list related issues.
> We are using MIPS(mips32r2) target. when I alloc memory using kmalloc
> suppose 28 bytes, the kernel still consume 128 bytes.
>
> So when I check File on kernel source mach-ip32/kmalloc.h
>
> Since it is allign to 128 bytes so i understand that even if I
> consume 1 byte it will waste 128 bytes.
>
> #ifndef __ASM_MACH_IP32_KMALLOC_H
> #define __ASM_MACH_IP32_KMALLOC_H
Eh... That's an IP32-specific header. I have no idea why you're looking
at it. It's not being used for your platform.
> So I could not understand why it is allign to 128 bytes. Is there any
> specific reason for it. ?
Each allocation needs some memory for kmalloc's internal bookkeeping,
the memory you actually asked for and for cacheline alignment. For very
small allocations the later is likely to be larger than the other two
so will be the deciding factor in actual memory allocation.
The cacheline aligment results in better performance and on non-coherent
platforms such as probably yours it is necessary to get get DMA transfers
to work right.
It would appear that in your case CONFIG_MIPS_L1_CACHE_SHIFT is set to 7.
For a MIPS32-based platform (you didn' say what actual processor core!)
that appears to be an excessively large number. 32 bytes would be a more
typical figure. Just check the kernel bootup messages for the cacheline
size if you don't know.
Ralf
next prev parent reply other threads:[~2010-08-18 13:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-18 12:37 kmalloc issue on MIPS target naveen yadav
2010-08-18 12:44 ` naveen yadav
2010-08-18 13:33 ` Ralf Baechle [this message]
2010-08-18 14:26 ` naveen yadav
2010-08-18 14:43 ` Ralf Baechle
2010-08-18 15:22 ` naveen yadav
2010-08-18 16:09 ` Sergei Shtylyov
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=20100818133336.GA25740@linux-mips.org \
--to=ralf@linux-mips.org \
--cc=linux-mips@linux-mips.org \
--cc=yad.naveen@gmail.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 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.