diff options
author | Lee Schermerhorn <Lee.Schermerhorn@hp.com> | 2008-10-18 23:26:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-20 11:50:26 -0400 |
commit | 894bc310419ac95f4fa4142dc364401a7e607f65 (patch) | |
tree | 15d56a7333b41620016b845d2323dd06e822b621 /include/linux/mm_inline.h | |
parent | 8a7a8544a4f6554ec2d8048ac9f9672f442db5a2 (diff) |
Unevictable LRU Infrastructure
When the system contains lots of mlocked or otherwise unevictable pages,
the pageout code (kswapd) can spend lots of time scanning over these
pages. Worse still, the presence of lots of unevictable pages can confuse
kswapd into thinking that more aggressive pageout modes are required,
resulting in all kinds of bad behaviour.
Infrastructure to manage pages excluded from reclaim--i.e., hidden from
vmscan. Based on a patch by Larry Woodman of Red Hat. Reworked to
maintain "unevictable" pages on a separate per-zone LRU list, to "hide"
them from vmscan.
Kosaki Motohiro added the support for the memory controller unevictable
lru list.
Pages on the unevictable list have both PG_unevictable and PG_lru set.
Thus, PG_unevictable is analogous to and mutually exclusive with
PG_active--it specifies which LRU list the page is on.
The unevictable infrastructure is enabled by a new mm Kconfig option
[CONFIG_]UNEVICTABLE_LRU.
A new function 'page_evictable(page, vma)' in vmscan.c tests whether or
not a page may be evictable. Subsequent patches will add the various
!evictable tests. We'll want to keep these tests light-weight for use in
shrink_active_list() and, possibly, the fault path.
To avoid races between tasks putting pages [back] onto an LRU list and
tasks that might be moving the page from non-evictable to evictable state,
the new function 'putback_lru_page()' -- inverse to 'isolate_lru_page()'
-- tests the "evictability" of a page after placing it on the LRU, before
dropping the reference. If the page has become unevictable,
putback_lru_page() will redo the 'putback', thus moving the page to the
unevictable list. This way, we avoid "stranding" evictable pages on the
unevictable list.
[akpm@linux-foundation.org: fix fallout from out-of-order merge]
[riel@redhat.com: fix UNEVICTABLE_LRU and !PROC_PAGE_MONITOR build]
[nishimura@mxp.nes.nec.co.jp: remove redundant mapping check]
[kosaki.motohiro@jp.fujitsu.com: unevictable-lru-infrastructure: putback_lru_page()/unevictable page handling rework]
[kosaki.motohiro@jp.fujitsu.com: kill unnecessary lock_page() in vmscan.c]
[kosaki.motohiro@jp.fujitsu.com: revert migration change of unevictable lru infrastructure]
[kosaki.motohiro@jp.fujitsu.com: revert to unevictable-lru-infrastructure-kconfig-fix.patch]
[kosaki.motohiro@jp.fujitsu.com: restore patch failure of vmstat-unevictable-and-mlocked-pages-vm-events.patch]
Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Debugged-by: Benjamin Kidwell <benjkidwell@yahoo.com>
Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/mm_inline.h')
-rw-r--r-- | include/linux/mm_inline.h | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index f451fedd1e75..67d7697fd019 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h | |||
@@ -91,11 +91,16 @@ del_page_from_lru(struct zone *zone, struct page *page) | |||
91 | enum lru_list l = LRU_BASE; | 91 | enum lru_list l = LRU_BASE; |
92 | 92 | ||
93 | list_del(&page->lru); | 93 | list_del(&page->lru); |
94 | if (PageActive(page)) { | 94 | if (PageUnevictable(page)) { |
95 | __ClearPageActive(page); | 95 | __ClearPageUnevictable(page); |
96 | l += LRU_ACTIVE; | 96 | l = LRU_UNEVICTABLE; |
97 | } else { | ||
98 | if (PageActive(page)) { | ||
99 | __ClearPageActive(page); | ||
100 | l += LRU_ACTIVE; | ||
101 | } | ||
102 | l += page_is_file_cache(page); | ||
97 | } | 103 | } |
98 | l += page_is_file_cache(page); | ||
99 | __dec_zone_state(zone, NR_LRU_BASE + l); | 104 | __dec_zone_state(zone, NR_LRU_BASE + l); |
100 | } | 105 | } |
101 | 106 | ||
@@ -110,9 +115,13 @@ static inline enum lru_list page_lru(struct page *page) | |||
110 | { | 115 | { |
111 | enum lru_list lru = LRU_BASE; | 116 | enum lru_list lru = LRU_BASE; |
112 | 117 | ||
113 | if (PageActive(page)) | 118 | if (PageUnevictable(page)) |
114 | lru += LRU_ACTIVE; | 119 | lru = LRU_UNEVICTABLE; |
115 | lru += page_is_file_cache(page); | 120 | else { |
121 | if (PageActive(page)) | ||
122 | lru += LRU_ACTIVE; | ||
123 | lru += page_is_file_cache(page); | ||
124 | } | ||
116 | 125 | ||
117 | return lru; | 126 | return lru; |
118 | } | 127 | } |