aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2009-06-16 18:32:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-16 22:47:42 -0400
commitcb4b86ba47bb0937b71fb825b3ed88adf7a190f0 (patch)
tree4b8528ba914a315e5857e7fe2a6e7d415f2e6650 /include
parent6837765963f1723e80ca97b1fae660f3a60d77df (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')
-rw-r--r--include/linux/swap.h7
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 *);
282extern swp_entry_t get_swap_page(void); 282extern swp_entry_t get_swap_page(void);
283extern swp_entry_t get_swap_page_of_type(int); 283extern swp_entry_t get_swap_page_of_type(int);
284extern int swap_duplicate(swp_entry_t); 284extern int swap_duplicate(swp_entry_t);
285extern int swapcache_prepare(swp_entry_t);
285extern int valid_swaphandles(swp_entry_t, unsigned long *); 286extern int valid_swaphandles(swp_entry_t, unsigned long *);
286extern void swap_free(swp_entry_t); 287extern void swap_free(swp_entry_t);
288extern void swapcache_free(swp_entry_t, struct page *page);
287extern int free_swap_and_cache(swp_entry_t); 289extern int free_swap_and_cache(swp_entry_t);
288extern int swap_type_of(dev_t, sector_t, struct block_device **); 290extern int swap_type_of(dev_t, sector_t, struct block_device **);
289extern unsigned int count_swap_pages(int, int); 291extern 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
356static inline void swap_free(swp_entry_t swp) 359static inline void swap_free(swp_entry_t swp)
357{ 360{
358} 361}
359 362
363static inline void swapcache_free(swp_entry_t swp, struct page *page)
364{
365}
366
360static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, 367static 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{