On Tue, 2009-02-17 at 15:20 +0800, Peter Teoh wrote:
> looking into kernel source, it seemed quite simple:
>
> ./sound/pci/emu10k1/memory.c:
> #define get_aligned_page(offset)((offset) >> PAGE_SHIFT)
> blk->first_page = get_aligned_page(blk->mem.offset);
> blk->last_page = get_aligned_
sorry my mistake.should be 0xF instead :-).
On Wed, Feb 18, 2009 at 1:31 PM, Pei Lin wrote:
> 2009/2/17 Peter Teoh :
> > i think just & 0x1F, after allocating from kmalloc(), but must ensure
> that
>
> &1F, is that right? 0x1F & 0x1F = 0x1F = 31
> > the new address have sufficient space aft
2009/2/17 Peter Teoh :
> i think just & 0x1F, after allocating from kmalloc(), but must ensure that
&1F, is that right? 0x1F & 0x1F = 0x1F = 31
> the new address have sufficient space after alignment.
>
> correct?
>
> On Sun, Feb 15, 2009 at 5:41 PM, Ramagudi Naziir wrote:
>>
>> hello everyone
>>
i think just & 0x1F, after allocating from kmalloc(), but must ensure that
the new address have sufficient space after alignment.
correct?
On Sun, Feb 15, 2009 at 5:41 PM, Ramagudi Naziir wrote:
> hello everyone
>
> i need to allocate memory aligned 16 bytes.
>
> how can i do that ?
>
> can I u
looking into kernel source, it seemed quite simple:
./sound/pci/emu10k1/memory.c:
#define get_aligned_page(offset)((offset) >> PAGE_SHIFT)
blk->first_page = get_aligned_page(blk->mem.offset);
blk->last_page = get_aligned_page(blk->mem.offset + blk->mem.size - 1);
psize = get_aligne
i think slab can do that,look at
mm/slab.c:
"struct kmem_cache *
kmem_cache_create (const char *name, size_t size, size_t align,
unsigned long flags,
void (*ctor)(struct kmem_cache *, void *))"
the parameter "align" for what?
And kmalloc is page aligned, "4096/16 = 256", is it also 16 aligned?
M
>>And kmalloc is page aligned, "4096/16 = 256", is it also 16 aligned?
>>>Maybe i misunderstand about "aligned" meaning.
Oh,sorry vmalloc is page aligned kmalloc is not.
2009/2/17 Pei Lin :
> i think slab can do that,look at
> mm/slab.c:
> "struct kmem_cache *
> kmem_cache_create (const char *n
On Sun, Feb 15, 2009 at 4:41 PM, Ramagudi Naziir wrote:
> hello everyone
>
> i need to allocate memory aligned 16 bytes.
>
> how can i do that ?
>
> can I use kmalloc for that ?
Uhm, kmalloc use slab so I don't think it will be aligned. My wild
guess is you have use alloc_page(s) or use _aligned_
hello everyone
i need to allocate memory aligned 16 bytes.
how can i do that ?
can I use kmalloc for that ?
thank you in advance
naziir
--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecar...@nl.linux.org
Please read the FAQ at http://kernelnewbies.org/FAQ