diff options
| author | Rik van Riel <riel@redhat.com> | 2005-11-28 16:44:07 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-28 17:42:25 -0500 |
| commit | f7b7fd8f3ebbb2810d6893295aa984acd0fd30db (patch) | |
| tree | 01afc1edafc50a3c65ec8576c05c60da53d8d242 /include/linux | |
| parent | a93a117eaa0bec426d4671a49bfa96a6fdcd2ac9 (diff) | |
[PATCH] temporarily disable swap token on memory pressure
Some users (hi Zwane) have seen a problem when running a workload that
eats nearly all of physical memory - th system does an OOM kill, even
when there is still a lot of swap free.
The problem appears to be a very big task that is holding the swap
token, and the VM has a very hard time finding any other page in the
system that is swappable.
Instead of ignoring the swap token when sc->priority reaches 0, we could
simply take the swap token away from the memory hog and make sure we
don't give it back to the memory hog for a few seconds.
This patch resolves the problem Zwane ran into.
Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/rmap.h | 4 | ||||
| -rw-r--r-- | include/linux/swap.h | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/rmap.h b/include/linux/rmap.h index 35b30e6c8cf8..33261f1d2239 100644 --- a/include/linux/rmap.h +++ b/include/linux/rmap.h | |||
| @@ -89,7 +89,7 @@ static inline void page_dup_rmap(struct page *page) | |||
| 89 | /* | 89 | /* |
| 90 | * Called from mm/vmscan.c to handle paging out | 90 | * Called from mm/vmscan.c to handle paging out |
| 91 | */ | 91 | */ |
| 92 | int page_referenced(struct page *, int is_locked, int ignore_token); | 92 | int page_referenced(struct page *, int is_locked); |
| 93 | int try_to_unmap(struct page *); | 93 | int try_to_unmap(struct page *); |
| 94 | 94 | ||
| 95 | /* | 95 | /* |
| @@ -109,7 +109,7 @@ unsigned long page_address_in_vma(struct page *, struct vm_area_struct *); | |||
| 109 | #define anon_vma_prepare(vma) (0) | 109 | #define anon_vma_prepare(vma) (0) |
| 110 | #define anon_vma_link(vma) do {} while (0) | 110 | #define anon_vma_link(vma) do {} while (0) |
| 111 | 111 | ||
| 112 | #define page_referenced(page,l,i) TestClearPageReferenced(page) | 112 | #define page_referenced(page,l) TestClearPageReferenced(page) |
| 113 | #define try_to_unmap(page) SWAP_FAIL | 113 | #define try_to_unmap(page) SWAP_FAIL |
| 114 | 114 | ||
| 115 | #endif /* CONFIG_MMU */ | 115 | #endif /* CONFIG_MMU */ |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 20c975642cab..508668f840b6 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
| @@ -239,6 +239,11 @@ static inline void put_swap_token(struct mm_struct *mm) | |||
| 239 | __put_swap_token(mm); | 239 | __put_swap_token(mm); |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | static inline void disable_swap_token(void) | ||
| 243 | { | ||
| 244 | put_swap_token(swap_token_mm); | ||
| 245 | } | ||
| 246 | |||
| 242 | #else /* CONFIG_SWAP */ | 247 | #else /* CONFIG_SWAP */ |
| 243 | 248 | ||
| 244 | #define total_swap_pages 0 | 249 | #define total_swap_pages 0 |
| @@ -283,6 +288,7 @@ static inline swp_entry_t get_swap_page(void) | |||
| 283 | #define put_swap_token(x) do { } while(0) | 288 | #define put_swap_token(x) do { } while(0) |
| 284 | #define grab_swap_token() do { } while(0) | 289 | #define grab_swap_token() do { } while(0) |
| 285 | #define has_swap_token(x) 0 | 290 | #define has_swap_token(x) 0 |
| 291 | #define disable_swap_token() do { } while(0) | ||
| 286 | 292 | ||
| 287 | #endif /* CONFIG_SWAP */ | 293 | #endif /* CONFIG_SWAP */ |
| 288 | #endif /* __KERNEL__*/ | 294 | #endif /* __KERNEL__*/ |
