Skip to contentSkip to conversation

Swapping anonymous pages

DISCUSSION Keir Fraser 2 participants 2 messages Aug 8, 2001 Memory management

lore
Share & tools
lore
#0 lore raw

Hi,

Having spent some time reading the Linux VM code, I have a question about the swap_out algorithm in vmscan.c. It seems to me that the outer loop there is "backwards" -- the page tables of each address space are scanned and mapped to physical pages, rather than scanning physical pages and having a list of mappings of that page to be invalidated when the page is swapped.

This seems particularly strange when there is already infrastructure for scanning physical pages in the LRU cache: why do extra work to scan virtual address spaces as well? Seems to defeat one of the main reasons for moving to a unified paging mechanism :)

The only reasons I can see for doing the current way are:
* keeping the reverse (physical -> virtual) mappings would eat too much memory.
* since it's old (pre-2.4) code, perhaps noone has yet got round to rewriting it for the new design.

So, I'm curious to know which of the two it is (or whether the current way was found to be "good enough").

Best wishes,
Keir Fraser
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/

#1 lore raw
Quoted 8 lines · Keir Fraser

The only reasons I can see for doing the current way are:
* keeping the reverse (physical -> virtual) mappings would eat too much memory.
* since it's old (pre-2.4) code, perhaps noone has yet got round to rewriting it for the new design.

So, I'm curious to know which of the two it is (or whether the current way was found to be "good enough").

Both ;)

Even without the reverse mapping overhead (8 bytes per pte for shared pages in my current implementation) we have FAR too much pagetable overhead on large memory machines anyway.

This means we need to support 2MB / 4MB pages, after which the point about reverse mappings being too much overhead pretty much becomes moot...

I'm planning to implement some of this stuff for 2.5.

regards,

Rik
--
IA64: a worthy successor to the i860.

		http://www.surriel.com/

http://www.conectiva.com/ http://distro.conectiva.com/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/