Re: kmalloc > 128k

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/09/06, Ricard Wanderlof <ricard.wanderlof@xxxxxxxx> wrote:

Hi,

I came across a problem in the mtd nand flash driver for Linux 2.6.16,
where the driver tries to allocate about 135k using kmalloc. Now, it used
to be that kmalloc couldn't handle more than 128k, but for instance
looking in the 3rd edition of Linux Device Drivers, it more cryptically
says that 128k is guaranteed, but the depending on the architecture and
kernel version.

I have not yet dived into the code, but does anyone know what this
limitation was historically, why it has changed and what governs it in the
later kernels?

kmalloc() allocates physically contiguous pages, so fragmentation of
memory over time limits how large chunks you can get.
If you don't require the memory to be physically contiguous but merely
that it be logically contiguous, then you can use vmalloc() which
allocates memory that is not guarenteed to be physically contiguous
(so you can't use it for DMA for instance, and it's a bit slower), but
it'll be logically contiguous. vmalloc() can get you larger chunks
than kmalloc().

--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux