diff options
author | KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> | 2009-06-16 18:32:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-16 22:47:42 -0400 |
commit | cb4b86ba47bb0937b71fb825b3ed88adf7a190f0 (patch) | |
tree | 4b8528ba914a315e5857e7fe2a6e7d415f2e6650 /include/linux/swap.h | |
parent | 6837765963f1723e80ca97b1fae660f3a60d77df (diff) |
mm: add swap cache interface for swap reference
In a following patch, the usage of swap cache is recorded into swap_map.
This patch is for necessary interface changes to do that.
2 interfaces:
- swapcache_prepare()
- swapcache_free()
are added for allocating/freeing refcnt from swap-cache to existing swap
entries. But implementation itself is not changed under this patch. At
adding swapcache_free(), memcg's hook code is moved under
swapcache_free(). This is better than using scattered hooks.
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@in.ibm.com>
Cc: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Cc: YAMAMOTO Takashi <yamamoto@valinux.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r-- | include/linux/swap.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h index f30c06908f09..259e96c150ef 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -282,8 +282,10 @@ extern void si_swapinfo(struct sysinfo *); | |||
282 | extern swp_entry_t get_swap_page(void); | 282 | extern swp_entry_t get_swap_page(void); |
283 | extern swp_entry_t get_swap_page_of_type(int); | 283 | extern swp_entry_t get_swap_page_of_type(int); |
284 | extern int swap_duplicate(swp_entry_t); | 284 | extern int swap_duplicate(swp_entry_t); |
285 | extern int swapcache_prepare(swp_entry_t); | ||
285 | extern int valid_swaphandles(swp_entry_t, unsigned long *); | 286 | extern int valid_swaphandles(swp_entry_t, unsigned long *); |
286 | extern void swap_free(swp_entry_t); | 287 | extern void swap_free(swp_entry_t); |
288 | extern void swapcache_free(swp_entry_t, struct page *page); | ||
287 | extern int free_swap_and_cache(swp_entry_t); | 289 | extern int free_swap_and_cache(swp_entry_t); |
288 | extern int swap_type_of(dev_t, sector_t, struct block_device **); | 290 | extern int swap_type_of(dev_t, sector_t, struct block_device **); |
289 | extern unsigned int count_swap_pages(int, int); | 291 | extern unsigned int count_swap_pages(int, int); |
@@ -352,11 +354,16 @@ static inline void show_swap_cache_info(void) | |||
352 | 354 | ||
353 | #define free_swap_and_cache(swp) is_migration_entry(swp) | 355 | #define free_swap_and_cache(swp) is_migration_entry(swp) |
354 | #define swap_duplicate(swp) is_migration_entry(swp) | 356 | #define swap_duplicate(swp) is_migration_entry(swp) |
357 | #define swapcache_prepare(swp) is_migration_entry(swp) | ||
355 | 358 | ||
356 | static inline void swap_free(swp_entry_t swp) | 359 | static inline void swap_free(swp_entry_t swp) |
357 | { | 360 | { |
358 | } | 361 | } |
359 | 362 | ||
363 | static inline void swapcache_free(swp_entry_t swp, struct page *page) | ||
364 | { | ||
365 | } | ||
366 | |||
360 | static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, | 367 | static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, |
361 | struct vm_area_struct *vma, unsigned long addr) | 368 | struct vm_area_struct *vma, unsigned long addr) |
362 | { | 369 | { |