diff options
author | Hugh Dickins <hugh@veritas.com> | 2009-01-06 17:39:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 18:59:03 -0500 |
commit | a2c43eed8334e878702fca713b212ae2a11d84b9 (patch) | |
tree | 4eb3f9b9153df5e7a638b15a6f7c9aa924066a94 /include | |
parent | 7b1fe59793e61f826bef053107b57b23954833bb (diff) |
mm: try_to_free_swap replaces remove_exclusive_swap_page
remove_exclusive_swap_page(): its problem is in living up to its name.
It doesn't matter if someone else has a reference to the page (raised
page_count); it doesn't matter if the page is mapped into userspace
(raised page_mapcount - though that hints it may be worth keeping the
swap): all that matters is that there be no more references to the swap
(and no writeback in progress).
swapoff (try_to_unuse) has been removing pages from swapcache for years,
with no concern for page count or page mapcount, and we used to have a
comment in lookup_swap_cache() recognizing that: if you go for a page of
swapcache, you'll get the right page, but it could have been removed from
swapcache by the time you get page lock.
So, give up asking for exclusivity: get rid of
remove_exclusive_swap_page(), and remove_exclusive_swap_page_ref() and
remove_exclusive_swap_page_count() which were spawned for the recent LRU
work: replace them by the simpler try_to_free_swap() which just checks
page_swapcount().
Similarly, remove the page_count limitation from free_swap_and_count(),
but assume that it's worth holding on to the swap if page is mapped and
swap nowhere near full. Add a vm_swap_full() test in free_swap_cache()?
It would be consistent, but I think we probably have enough for now.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Cc: Lee Schermerhorn <lee.schermerhorn@hp.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Robin Holt <holt@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/swap.h | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index 366556c5b148..c3ecd478840e 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -305,8 +305,7 @@ extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t); | |||
305 | extern sector_t swapdev_block(int, pgoff_t); | 305 | extern sector_t swapdev_block(int, pgoff_t); |
306 | extern struct swap_info_struct *get_swap_info_struct(unsigned); | 306 | extern struct swap_info_struct *get_swap_info_struct(unsigned); |
307 | extern int reuse_swap_page(struct page *); | 307 | extern int reuse_swap_page(struct page *); |
308 | extern int remove_exclusive_swap_page(struct page *); | 308 | extern int try_to_free_swap(struct page *); |
309 | extern int remove_exclusive_swap_page_ref(struct page *); | ||
310 | struct backing_dev_info; | 309 | struct backing_dev_info; |
311 | 310 | ||
312 | /* linux/mm/thrash.c */ | 311 | /* linux/mm/thrash.c */ |
@@ -388,12 +387,7 @@ static inline void delete_from_swap_cache(struct page *page) | |||
388 | 387 | ||
389 | #define reuse_swap_page(page) (page_mapcount(page) == 1) | 388 | #define reuse_swap_page(page) (page_mapcount(page) == 1) |
390 | 389 | ||
391 | static inline int remove_exclusive_swap_page(struct page *p) | 390 | static inline int try_to_free_swap(struct page *page) |
392 | { | ||
393 | return 0; | ||
394 | } | ||
395 | |||
396 | static inline int remove_exclusive_swap_page_ref(struct page *page) | ||
397 | { | 391 | { |
398 | return 0; | 392 | return 0; |
399 | } | 393 | } |