많은 이유가 있지만, 주 이유는 성능 때문이라고 한다.
아래 글을 참고해보자.
원문 : http://stackoverflow.com/questions/116343/what-is-the-difference-between-vmalloc-and-kmalloc
Linux Kernel Development by Robert Love (Chapter 12, page 244 in 3rd edition) answers this very clearly.
Yes, physically contiguous memory is not required in many of the cases. Main reason for kmalloc being used more than vmalloc in kernel is performance. The book explains, when big memory chunks are allocated using vmalloc, kernel has to map the physically non-contiguous chunks (pages) into a single contiguous virtual memory region. Since the memory is virtually contiguous and physically non-contiguous, several virtual-to-physical address mappings will have to be added to the page table. And in the worst case, there will be (size of buffer/page size) number of mappings added to the page table.
This also adds pressure on TLB (the cache entries storing recent virtual to physical address mappings) when accessing this buffer. This can lead to thrashing.
'Programming > Linux_Kernel' 카테고리의 다른 글
use fallocate in Android system (0) | 2015.04.06 |
---|---|
linux kernel 이 지원하는 system call list 보기 (0) | 2015.04.06 |
vmalloc 할당의 최대 크기는? (0) | 2015.04.02 |
linux kernel time resolution & hrtimer (0) | 2015.03.22 |
sleep and delay in linux kernel (0) | 2015.03.22 |