Preventing Linux kernel from taking allocated memory from a process -
i want allocate large portion of memory using malloc() indefinite amount of time. may touch memory long time let 1 minute. how prevent kernel taking memory away process?
i can not re allocate memory because being used device outside of kernels control.
in linux, can allocate memory in user space, such malloc
or mmap
, pass down kernel, , in kernel, obtain references memory get_user_pages
. prevent pages going away, , allow them accessed address space struct page *
references (and requiring kmap
, kunmap
if config_highmem
in effect). these pages not contiguous physical memory, however, , may not in suitable range dma.
memory accessed devices allocated in kernel (e.g. using kmalloc
gfp_dma
. allocations larger page, kmalloc
finds consecutive physical pages, too. once obtained, kmalloc
-ed memory can mapped user space remap_pfn_range
.
Comments
Post a Comment