kmap() allows you to map a page to some address that functions in kernel or modules can access. While page_address() also allows you to retrieve the address to access the page.

It says that kmap() is used to deal with highmem issue, but as this question explained, highmem is no longer an issue in x64 system.

I've tried that if you get a page struct *p from a process (i.e. a userspace page), using kmap(p) and page_address(p) does nearly same thing.

What's the difference between them?

1 Answer 1


On x86-64, there is no practical difference; when given a non-highmem page, kmap delegates to page_address:

    if (!PageHighMem(page))
        addr = page_address(page);

The two functions do however serve two different purposes: page_address returns the page’s address, if it has one; kmap ensures that the page is mapped before returning its address, and should be balanced with a call to kunmap.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .