Chan Kim
Chan Kim

Reputation: 5989

how does user program pin pages? and what is page buffer? (in an LWN article about get_user_pages)

While reading https://lwn.net/Articles/774411/ I found this sentence.

An application pins pages in memory, which causes the kernel to use get_user_pages() or similar to map the user-space memory into the kernel's address space.

I thought it is the driver that pins the page but this says the application pins the pages and the driver uses get_user_pages() from the pinned adderss. How can I pin the address in user space program?
And the article says,

The underlying problem is that the page buffers can be stripped off while the page is pinned and undergoing I/O;

Why is the page buffer stripped off when the page is pinned? Is the page buffer the one used for block devices(not the physical page)?

Upvotes: 1

Views: 835

Answers (1)

Harsh Mendapara
Harsh Mendapara

Reputation: 313

Page Buffer

Although the page cache and the buffer cache are different disk caches, in Version 2.4 of Linux, they are somewhat intertwined. In fact, for reasons of efficiency, buffers are not allocated as single memory objects; instead, buffers are stored in dedicated pages called buffer pages. All the buffers within a single buffer page must have the same size; hence, on the 80 x 86 architecture, a buffer page can include from one to eight buffers, depending on the block size.

Refer to these official websites for more details.

  1. https://www.halolinux.us/kernel-reference/buffer-pages.html
  2. https://www.kernel.org/doc/html/latest/core-api/pin_user_pages.html

Upvotes: 3

Related Questions