aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/swap.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/swap.h')
-rw-r--r--include/linux/swap.h45
1 files changed, 26 insertions, 19 deletions
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 7cdd63366f88..a273468f8285 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -155,6 +155,15 @@ enum {
155#define SWAP_CLUSTER_MAX 32 155#define SWAP_CLUSTER_MAX 32
156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX 156#define COMPACT_CLUSTER_MAX SWAP_CLUSTER_MAX
157 157
158/*
159 * Ratio between the present memory in the zone and the "gap" that
160 * we're allowing kswapd to shrink in addition to the per-zone high
161 * wmark, even for zones that already have the high wmark satisfied,
162 * in order to provide better per-zone lru behavior. We are ok to
163 * spend not more than 1% of the memory for this zone balancing "gap".
164 */
165#define KSWAPD_ZONE_BALANCE_GAP_RATIO 100
166
158#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */ 167#define SWAP_MAP_MAX 0x3e /* Max duplication count, in first swap_map */
159#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */ 168#define SWAP_MAP_BAD 0x3f /* Note pageblock is bad, in first swap_map */
160#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */ 169#define SWAP_HAS_CACHE 0x40 /* Flag page is cached, in first swap_map */
@@ -208,11 +217,14 @@ extern unsigned int nr_free_pagecache_pages(void);
208/* linux/mm/swap.c */ 217/* linux/mm/swap.c */
209extern void __lru_cache_add(struct page *, enum lru_list lru); 218extern void __lru_cache_add(struct page *, enum lru_list lru);
210extern void lru_cache_add_lru(struct page *, enum lru_list lru); 219extern void lru_cache_add_lru(struct page *, enum lru_list lru);
220extern void lru_add_page_tail(struct zone* zone,
221 struct page *page, struct page *page_tail);
211extern void activate_page(struct page *); 222extern void activate_page(struct page *);
212extern void mark_page_accessed(struct page *); 223extern void mark_page_accessed(struct page *);
213extern void lru_add_drain(void); 224extern void lru_add_drain(void);
214extern int lru_add_drain_all(void); 225extern int lru_add_drain_all(void);
215extern void rotate_reclaimable_page(struct page *page); 226extern void rotate_reclaimable_page(struct page *page);
227extern void deactivate_page(struct page *page);
216extern void swap_setup(void); 228extern void swap_setup(void);
217 229
218extern void add_page_to_unevictable_list(struct page *page); 230extern void add_page_to_unevictable_list(struct page *page);
@@ -245,7 +257,8 @@ extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
245extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, 257extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem,
246 gfp_t gfp_mask, bool noswap, 258 gfp_t gfp_mask, bool noswap,
247 unsigned int swappiness, 259 unsigned int swappiness,
248 struct zone *zone); 260 struct zone *zone,
261 unsigned long *nr_scanned);
249extern int __isolate_lru_page(struct page *page, int mode, int file); 262extern int __isolate_lru_page(struct page *page, int mode, int file);
250extern unsigned long shrink_all_memory(unsigned long nr_pages); 263extern unsigned long shrink_all_memory(unsigned long nr_pages);
251extern int vm_swappiness; 264extern int vm_swappiness;
@@ -271,24 +284,22 @@ extern void scan_mapping_unevictable_pages(struct address_space *);
271extern unsigned long scan_unevictable_pages; 284extern unsigned long scan_unevictable_pages;
272extern int scan_unevictable_handler(struct ctl_table *, int, 285extern int scan_unevictable_handler(struct ctl_table *, int,
273 void __user *, size_t *, loff_t *); 286 void __user *, size_t *, loff_t *);
287#ifdef CONFIG_NUMA
274extern int scan_unevictable_register_node(struct node *node); 288extern int scan_unevictable_register_node(struct node *node);
275extern void scan_unevictable_unregister_node(struct node *node); 289extern void scan_unevictable_unregister_node(struct node *node);
290#else
291static inline int scan_unevictable_register_node(struct node *node)
292{
293 return 0;
294}
295static inline void scan_unevictable_unregister_node(struct node *node)
296{
297}
298#endif
276 299
277extern int kswapd_run(int nid); 300extern int kswapd_run(int nid);
278extern void kswapd_stop(int nid); 301extern void kswapd_stop(int nid);
279 302
280#ifdef CONFIG_MMU
281/* linux/mm/shmem.c */
282extern int shmem_unuse(swp_entry_t entry, struct page *page);
283#endif /* CONFIG_MMU */
284
285#ifdef CONFIG_CGROUP_MEM_RES_CTLR
286extern void mem_cgroup_get_shmem_target(struct inode *inode, pgoff_t pgoff,
287 struct page **pagep, swp_entry_t *ent);
288#endif
289
290extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
291
292#ifdef CONFIG_SWAP 303#ifdef CONFIG_SWAP
293/* linux/mm/page_io.c */ 304/* linux/mm/page_io.c */
294extern int swap_readpage(struct page *); 305extern int swap_readpage(struct page *);
@@ -337,6 +348,7 @@ struct backing_dev_info;
337extern struct mm_struct *swap_token_mm; 348extern struct mm_struct *swap_token_mm;
338extern void grab_swap_token(struct mm_struct *); 349extern void grab_swap_token(struct mm_struct *);
339extern void __put_swap_token(struct mm_struct *); 350extern void __put_swap_token(struct mm_struct *);
351extern void disable_swap_token(struct mem_cgroup *memcg);
340 352
341static inline int has_swap_token(struct mm_struct *mm) 353static inline int has_swap_token(struct mm_struct *mm)
342{ 354{
@@ -349,11 +361,6 @@ static inline void put_swap_token(struct mm_struct *mm)
349 __put_swap_token(mm); 361 __put_swap_token(mm);
350} 362}
351 363
352static inline void disable_swap_token(void)
353{
354 put_swap_token(swap_token_mm);
355}
356
357#ifdef CONFIG_CGROUP_MEM_RES_CTLR 364#ifdef CONFIG_CGROUP_MEM_RES_CTLR
358extern void 365extern void
359mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout); 366mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
@@ -479,7 +486,7 @@ static inline int has_swap_token(struct mm_struct *mm)
479 return 0; 486 return 0;
480} 487}
481 488
482static inline void disable_swap_token(void) 489static inline void disable_swap_token(struct mem_cgroup *memcg)
483{ 490{
484} 491}
485 492