Re: Kmalloc



Norm Dresner <ndrez@xxxxxxx> wrote:
> "Peter T. Breuer" <ptb@xxxxxxxxxxxxxxx> wrote in message
> news:0gru93-le4.ln1@xxxxxxxxxxxxxxxxxx
>> Anand <anand.vt@xxxxxxxxx> wrote:
>>> Can any one help in knowing whether Kmalloc will always allocate
>>> contiguous memory.
>>
>> Yep, never. And you don't know anyway, since the addresses you see are
>> remapped from the physical addresses. So - non-question.

> Umm ... if the buffer in question is being allocated for DMA purposes, it's
> vital to know if it's physically contiguous or not. It's not a
> "non-question".

Actuallywise, I should apologize, because I read that as "malloc", for
some reason, not "kmalloc", thus changing the sense of the question.

Kmalloc does deliver contiguous lumps of underlying physical memory even
taking remapping into account, I believe, even if a 4K boundary is
crossed (at least, using the buddy allocater). But caveat emptor - I'm
only really sure up to 4KB.

Peter
.



Relevant Pages

  • [CFT] kmem_cache_alloc_node
    ... moves the cpu local structures within slab onto the right node. ... The cache to allocate from. ... * @flags: See kmalloc(). ... And it will allocate memory on the given node, ...
    (Linux-Kernel)
  • Re: Difference between kmalloc and __get_free_pages
    ... > terms of PAGES while kmalloc is used to allocate arbitrary sized ... Actually kmalloc use gfp to get the memory. ... > information from the kernel to the user space programs. ...
    (comp.os.linux.development.system)
  • Re: Looking for KMDF alternative to MmAllocateContiguousMemorySpecifyCache
    ... There is no direct KMDF equivalent of this function. ... I don't need contiguous memory. ... Since the buffer I'm planning to allocate is not exactly small I want ... Now thinking about it, may be, I should create TWO DMA enabler objects, ...
    (microsoft.public.development.device.drivers)
  • Re: Difference between kmalloc and __get_free_pages
    ... >> terms of PAGES while kmalloc is used to allocate arbitrary sized ... > Actually kmalloc use gfp to get the memory. ... >> information from the kernel to the user space programs. ...
    (comp.os.linux.development.system)
  • [PATCH] drivers/char: Conversions from kmalloc/memset to kzalloc.
    ... printk(KERN_ERR "Couldn't allocate memory for esp serial device information\n"); ... struct n_hdlc_buf *buf; ... * If kmalloc returns null, we just won't use that entropy ... failed to allocate device info" ...
    (Linux-Kernel)