Библиотека сайта или "Мой Linux Documentation Project"
The book is available and called simply "Understanding The Linux Virtual Memory Manager". There is a lot of additional material in the book that is not available here, including details on later 2.4 kernels, introductions to 2.6, a whole new chapter on the shared memory filesystem, coverage of TLB management, a lot more code commentary, countless other additions and clarifications and a CD with lots of cool stuff on it. This material (although now dated and lacking in comparison to the book) will remain available although I obviously encourge you to buy the book from your favourite book store :-) . As the book is under the Bruce Perens Open Book Series, it will be available 90 days after appearing on the book shelves which means it is not available right now. When it is available, it will be downloadable from http://www.phptr.com/perens so check there for more information.
To be fully clear, this webpage is not the actual book.
Next: 11.2 Page Cache Up: 11. Page Frame Reclamation Previous: 11. Page Frame Reclamation   Contents   Index
At system start, a kernel thread called kswapd is started
kswapd_init() which continuously executes the
mm/vmscan.c which usually
sleeps. This daemon is responsible for reclaiming pages when memory is
running low. Historically, kswapd used to wake up every 10
seconds but now it is only woken by the physical page allocator when the
pages_low number of free pages in a zone is reached (see Section
It is this daemon that performs most of the tasks needed to maintain
the page cache correctly, shrink slab caches and swap out processes
if necessary. Unlike swapout daemons such as Solaris [#!mauro01!#]
which is woken up with increasing frequency as there is memory pressure,
kswapd keeps freeing pages until the
watermark is reached. Under extreme memory pressure, processes will do the
work of kswapd synchronously by calling
try_to_free_pages_zone(). The physical page allocator
will also call
try_to_free_pages_zone() when the zone it is
allocating from is under heavy pressure.
When kswapd is woken up, it performs the following:
kswapd_can_sleep()which cycles through all zones checking the
need_balancefield in the
struct zone_t. If any of them are set, it can not sleep;
- If it cannot sleep, it is removed from the
kswapd_balance()is called which cycles through all zones. It will free pages in a zone with
need_balanceis set and will keep freeing until the
pages_highwatermark is reached;
- The task queue for
tq_diskis run so that pages queued will be written out;
- Add kswapd back to the
kswapd_waitqueue and go back to the first step.
Next: 11.2 Page Cache Up: 11. Page Frame Reclamation Previous: 11. Page Frame Reclamation   Contents   Index Mel 2004-02-15
Только зарегистрированные пользователи могут оценивать и комментировать статьи.