Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux kernel function page_address()

I'm confused with the function:

void * page_address(struct page *page)

which (1) "convert a given page to its logical address" according to "Linux Kerenl developement 3rd edition" (2) "returns the linear address associated with the page frame" according to "understanding the linux kernel>>" (3) "returns the physical address of the page" according to "understanding the linux virtual memory manager"

which one is correct then?

Let's take (1): this function takes a pointer to the physical page (page frame), isn't that pointer the "logical address associated with that page frame" already? what's the difference between that pointer value and the returned value then? thanks.

like image 787
user1544314 Avatar asked Nov 05 '25 04:11

user1544314


1 Answers

1 and 2 are both correct - they are two ways of saying the same thing (although explanation 2 is clearer). Explanation 3 is incorrect - page_address() returns the virtual address, not the physical address, of the page frame.

page_address() does not take a pointer to the page / page frame. It takes a pointer to the struct page, which is a kernel data object that represents the page.

like image 53
caf Avatar answered Nov 07 '25 03:11

caf



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!