How does a contiguous memory block reduce memory access time?

When we use kmalloc (), this function returns adjacent physical memory blocks (if available) and with vmalloc (), we get an endless memory block (if any).

It is further indicated that access to the contiguous memory unit is faster compared to the non-contiguous memory unit [Source Link] .

To be more specific, consider two cases:

Let 1 physical frame = 4 KB, page size = 4 KB

Case 1: In my modular code, I use kmalloc () to allocate 20 KB of memory to the char array; The call completed successfully.

Case 2: I made the request above using vmalloc (), and the call succeeded.

My questions:

a) How to execute kmalloc () to execute the request less time in comparison with vmalloc ()?

b) How does continuous allocation result in faster memory access compared to non-contiguous allocation?

In each case, the CPU generates a virtual address, gives the MMU (if it misses the TLB), scans the page, identifies the frame number, and then translates the virtual address into a physical address. How important is if the address is adjacent or non-adjacent?

+4
source share
1 answer

kmalloc 1:1 1 N + PAGE_OFFSET. kmalloc , vmalloc, vmalloc , .

kmalloc vs. vmalloc, , , .

1 , , .

0

Source: https://habr.com/ru/post/1676640/


All Articles