linux kernel - Howto create 100M Byte Buffer -
i testing throughput of interface on linux. using dma todo data transfer. dma needs contiguous memory location. kmalloc unable allocate more 1mb. there other way create big buffer location upto 100m bytes?
i thought kmalloc couldn't allocate on 128kb, how did allocate 1mb ?
anyway, assuming you're working on freshly booted system, can reserve 2048 contiguous pages. pages 4k, makes 8mb.
_get_free_pages(_gfp_dma, get_order(2048));
however, if need more memory, should allocation @ boot-time. if writing driver, can achieved alloc_bootmem_*
functions. if writing module, have pass mem=
argument kernel , later use ioremap
.
for example, if have 2gb, can pass mem=1gb
forbid kernel using upper 1gb, , later call ioremap(0x40000000, 0x40000000)
access upper 1gb, you.
but know, should split huge buffer many small ones, it'll easier , more real-life applications.
Comments
Post a Comment