Re: about kmap_high function

From: Stephen C. Tweedie (
Date: Thu Jul 05 2001 - 05:41:21 EST


On Thu, Jul 05, 2001 at 10:28:35AM +0800, michaelc wrote:

> Thank you very much for your kindly guide, and I have two question to ask
> you, One question is, Is kmap_high intended to be called merely in the user
> context, so the highmem pages are mapped into user process page table, so
> on SMP, other processes ( including kernel and user process) that running
> on another cpu doesn't need to get that kmap virtual address.

No. In user context, at least for user data pages, the highmem pages
can be mapped into the local process's user page tables and we don't
need kmap to access them at all. kmap is only needed for pages which
are not already in the user page tables, such as when accessing the
page cache in read or write syscalls.

> Another question is, when kernel evicts old, unused kmap mapping and
> flushes the whole TLB range( call the flush_all_zero_pkmaps), the TLB won't
> keep those zero mappings, after that, when user process call kmap_high to
> get a new kmap mappings, and when the process access that virtual
> address, MMU component will get the page directory and page table from MEMORY
> instead of TLB to translate the virtual address into physical address.

No, user processes never access kmap addresses. They have direct page
table access to highmem pages in their address space. Only the kernel
uses kmap, and only for pages which are not in the calling process's
local page tables already. So we don't have to worry about keeping
kmap and page tables consistent --- they are totally different address
spaces, and the kmap virtual addresses are not visible to user

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Sat Jul 07 2001 - 21:00:15 EST