* kmalloc issue on MIPS target
@ 2010-08-18 12:37 naveen yadav
2010-08-18 12:44 ` naveen yadav
2010-08-18 13:33 ` Ralf Baechle
0 siblings, 2 replies; 7+ messages in thread
From: naveen yadav @ 2010-08-18 12:37 UTC (permalink / raw)
To: majordomo, linux-mips
Hi All,
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
#if defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_RM7000)
#define ARCH_KMALLOC_MINALIGN 32
#else
#define ARCH_KMALLOC_MINALIGN 128
#endif
#endif /* __ASM_MACH_IP32_KMALLOC_H */
So I could not understand why it is allign to 128 bytes. Is there any
specific reason for it. ?
thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: kmalloc issue on MIPS target
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
1 sibling, 0 replies; 7+ messages in thread
From: naveen yadav @ 2010-08-18 12:44 UTC (permalink / raw)
To: ralf, linux-mips
On Wed, Aug 18, 2010 at 6:07 PM, naveen yadav <yad.naveen@gmail.com> wrote:
> Hi All,
>
> 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
>
>
> #if defined(CONFIG_CPU_R5000) || defined(CONFIG_CPU_RM7000)
> #define ARCH_KMALLOC_MINALIGN 32
> #else
> #define ARCH_KMALLOC_MINALIGN 128
> #endif
>
> #endif /* __ASM_MACH_IP32_KMALLOC_H */
>
>
> So I could not understand why it is allign to 128 bytes. Is there any
> specific reason for it. ?
>
> thanks
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: kmalloc issue on MIPS target
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
2010-08-18 14:26 ` naveen yadav
1 sibling, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2010-08-18 13:33 UTC (permalink / raw)
To: naveen yadav; +Cc: linux-mips
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: kmalloc issue on MIPS target
2010-08-18 13:33 ` Ralf Baechle
@ 2010-08-18 14:26 ` naveen yadav
2010-08-18 14:43 ` Ralf Baechle
0 siblings, 1 reply; 7+ messages in thread
From: naveen yadav @ 2010-08-18 14:26 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
Thanks a lot Mr. Ralf Baechle for Quick answer.
I will give more info.
CONFIG_MIPS_L1_CACHE_SHIFT=5
CONFIG_DMA_NONCOHERENT=y
mips 34kc is processor
and File we are using is arch/mips/include/asm/mach-generic/kmalloc.h
#ifndef __ASM_MACH_GENERIC_KMALLOC_H
#define __ASM_MACH_GENERIC_KMALLOC_H
#ifndef CONFIG_DMA_COHERENT
/*
* Total overkill for most systems but need as a safe default.
* Set this one if any device in the system might do non-coherent DMA.
*/
#define ARCH_KMALLOC_MINALIGN 128
#endif
#endif /* __ASM_MACH_GENERIC_KMALLOC_H */
So shall we make value ARCH_KMALLOC_MINALIGN from 128 to 32. is
there any problem ?
Thanks
On Wed, Aug 18, 2010 at 7:03 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> 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
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: kmalloc issue on MIPS target
2010-08-18 14:26 ` naveen yadav
@ 2010-08-18 14:43 ` Ralf Baechle
2010-08-18 15:22 ` naveen yadav
0 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2010-08-18 14:43 UTC (permalink / raw)
To: naveen yadav; +Cc: linux-mips
On Wed, Aug 18, 2010 at 07:56:16PM +0530, naveen yadav wrote:
> I will give more info.
>
> CONFIG_MIPS_L1_CACHE_SHIFT=5
>
> CONFIG_DMA_NONCOHERENT=y
>
> mips 34kc is processor
>
> and File we are using is arch/mips/include/asm/mach-generic/kmalloc.h
>
> #ifndef __ASM_MACH_GENERIC_KMALLOC_H
> #define __ASM_MACH_GENERIC_KMALLOC_H
>
>
> #ifndef CONFIG_DMA_COHERENT
> /*
> * Total overkill for most systems but need as a safe default.
> * Set this one if any device in the system might do non-coherent DMA.
> */
> #define ARCH_KMALLOC_MINALIGN 128
> #endif
>
> #endif /* __ASM_MACH_GENERIC_KMALLOC_H */
>
>
> So shall we make value ARCH_KMALLOC_MINALIGN from 128 to 32. is
> there any problem ?
No, that's just what you should do. You do that by putting a file
that defines ARCH_KMALLOC_MINALIGN into your platforms's
arch/mips/include/asm/mach-<yourplatform>/kmalloc.h just like the ip32
file from your original posting.
Ralf
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: kmalloc issue on MIPS target
2010-08-18 14:43 ` Ralf Baechle
@ 2010-08-18 15:22 ` naveen yadav
2010-08-18 16:09 ` Sergei Shtylyov
0 siblings, 1 reply; 7+ messages in thread
From: naveen yadav @ 2010-08-18 15:22 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
Hi Ralf,
I understand that that I need to make kmalloc.h in my arch specific
folder. But I could not get answer, what should be appropriate
value of ARCH_KMALLOC_MINALIGN is it 32 or 128 ?
Thanks.
On Wed, Aug 18, 2010 at 8:13 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
> On Wed, Aug 18, 2010 at 07:56:16PM +0530, naveen yadav wrote:
>
>> I will give more info.
>>
>> CONFIG_MIPS_L1_CACHE_SHIFT=5
>>
>> CONFIG_DMA_NONCOHERENT=y
>>
>> mips 34kc is processor
>>
>> and File we are using is arch/mips/include/asm/mach-generic/kmalloc.h
>>
>> #ifndef __ASM_MACH_GENERIC_KMALLOC_H
>> #define __ASM_MACH_GENERIC_KMALLOC_H
>>
>>
>> #ifndef CONFIG_DMA_COHERENT
>> /*
>> * Total overkill for most systems but need as a safe default.
>> * Set this one if any device in the system might do non-coherent DMA.
>> */
>> #define ARCH_KMALLOC_MINALIGN 128
>> #endif
>>
>> #endif /* __ASM_MACH_GENERIC_KMALLOC_H */
>>
>>
>> So shall we make value ARCH_KMALLOC_MINALIGN from 128 to 32. is
>> there any problem ?
>
> No, that's just what you should do. You do that by putting a file
> that defines ARCH_KMALLOC_MINALIGN into your platforms's
> arch/mips/include/asm/mach-<yourplatform>/kmalloc.h just like the ip32
> file from your original posting.
>
> Ralf
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: kmalloc issue on MIPS target
2010-08-18 15:22 ` naveen yadav
@ 2010-08-18 16:09 ` Sergei Shtylyov
0 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2010-08-18 16:09 UTC (permalink / raw)
To: naveen yadav; +Cc: Ralf Baechle, linux-mips
Hello.
naveen yadav wrote:
> Hi Ralf,
> I understand that that I need to make kmalloc.h in my arch specific
> folder. But I could not get answer, what should be appropriate
> value of ARCH_KMALLOC_MINALIGN is it 32 or 128 ?
You've been replied already that you should set it to 32.
> Thanks.
> On Wed, Aug 18, 2010 at 8:13 PM, Ralf Baechle <ralf@linux-mips.org> wrote:
>> On Wed, Aug 18, 2010 at 07:56:16PM +0530, naveen yadav wrote:
>>
>>> I will give more info.
>>>
>>> CONFIG_MIPS_L1_CACHE_SHIFT=5
>>>
>>> CONFIG_DMA_NONCOHERENT=y
>>>
>>> mips 34kc is processor
>>>
>>> and File we are using is arch/mips/include/asm/mach-generic/kmalloc.h
>>>
>>> #ifndef __ASM_MACH_GENERIC_KMALLOC_H
>>> #define __ASM_MACH_GENERIC_KMALLOC_H
>>>
>>>
>>> #ifndef CONFIG_DMA_COHERENT
>>> /*
>>> * Total overkill for most systems but need as a safe default.
>>> * Set this one if any device in the system might do non-coherent DMA.
>>> */
>>> #define ARCH_KMALLOC_MINALIGN 128
>>> #endif
>>>
>>> #endif /* __ASM_MACH_GENERIC_KMALLOC_H */
>>> So shall we make value ARCH_KMALLOC_MINALIGN from 128 to 32. is
>>> there any problem ?
>> No, that's just what you should do. You do that by putting a file
>> that defines ARCH_KMALLOC_MINALIGN into your platforms's
>> arch/mips/include/asm/mach-<yourplatform>/kmalloc.h just like the ip32
>> file from your original posting.
>> Ralf
WBR, Sergei
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-08-18 16:10 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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.