blob: 6c990e658f4ed33dc2244b1b8ef5d1649cc22a31 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#ifndef _LINUX_SWAP_H
2#define _LINUX_SWAP_H
3
Linus Torvalds1da177e2005-04-16 15:20:36 -07004#include <linux/spinlock.h>
5#include <linux/linkage.h>
6#include <linux/mmzone.h>
7#include <linux/list.h>
Balbir Singh66e17072008-02-07 00:13:56 -08008#include <linux/memcontrol.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009#include <linux/sched.h>
Lee Schermerhornaf936a12008-10-18 20:26:53 -070010#include <linux/node.h>
Andrew Morton542d1c82005-07-12 13:58:31 -070011
Linus Torvalds1da177e2005-04-16 15:20:36 -070012#include <asm/atomic.h>
13#include <asm/page.h>
14
Martin Schwidefsky8bc719d2006-09-25 23:31:20 -070015struct notifier_block;
16
Andrew Mortonab954162006-09-25 23:32:42 -070017struct bio;
18
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#define SWAP_FLAG_PREFER 0x8000 /* set if swap priority specified */
20#define SWAP_FLAG_PRIO_MASK 0x7fff
21#define SWAP_FLAG_PRIO_SHIFT 0
22
23static inline int current_is_kswapd(void)
24{
25 return current->flags & PF_KSWAPD;
26}
27
28/*
29 * MAX_SWAPFILES defines the maximum number of swaptypes: things which can
30 * be swapped to. The swap type and the offset into that swap type are
31 * encoded into pte's and into pgoff_t's in the swapcache. Using five bits
32 * for the type means that the maximum number of swapcache pages is 27 bits
33 * on 32-bit-pgoff_t architectures. And that assumes that the architecture packs
34 * the type/offset into the pte as 5/27 as well.
35 */
36#define MAX_SWAPFILES_SHIFT 5
Christoph Lameter06972122006-06-23 02:03:35 -070037#ifndef CONFIG_MIGRATION
Linus Torvalds1da177e2005-04-16 15:20:36 -070038#define MAX_SWAPFILES (1 << MAX_SWAPFILES_SHIFT)
Christoph Lameter06972122006-06-23 02:03:35 -070039#else
40/* Use last two entries for page migration swap entries */
41#define MAX_SWAPFILES ((1 << MAX_SWAPFILES_SHIFT)-2)
42#define SWP_MIGRATION_READ MAX_SWAPFILES
43#define SWP_MIGRATION_WRITE (MAX_SWAPFILES + 1)
44#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -070045
46/*
47 * Magic header for a swap area. The first part of the union is
48 * what the swap magic looks like for the old (limited to 128MB)
49 * swap area format, the second part of the union adds - in the
50 * old reserved area - some extra information. Note that the first
51 * kilobyte is reserved for boot loader or disk label stuff...
52 *
53 * Having the magic at the end of the PAGE_SIZE makes detecting swap
54 * areas somewhat tricky on machines that support multiple page sizes.
55 * For 2.5 we'll probably want to move the magic to just beyond the
56 * bootbits...
57 */
58union swap_header {
59 struct {
60 char reserved[PAGE_SIZE - 10];
61 char magic[10]; /* SWAP-SPACE or SWAPSPACE2 */
62 } magic;
63 struct {
Andreas Dilgere8f03d02006-06-23 02:03:14 -070064 char bootbits[1024]; /* Space for disklabel etc. */
65 __u32 version;
66 __u32 last_page;
67 __u32 nr_badpages;
68 unsigned char sws_uuid[16];
69 unsigned char sws_volume[16];
70 __u32 padding[117];
71 __u32 badpages[1];
Linus Torvalds1da177e2005-04-16 15:20:36 -070072 } info;
73};
74
75 /* A swap entry has to fit into a "unsigned long", as
76 * the entry is hidden in the "index" field of the
77 * swapper address space.
78 */
79typedef struct {
80 unsigned long val;
81} swp_entry_t;
82
83/*
84 * current->reclaim_state points to one of these when a task is running
85 * memory reclaim
86 */
87struct reclaim_state {
88 unsigned long reclaimed_slab;
89};
90
91#ifdef __KERNEL__
92
93struct address_space;
94struct sysinfo;
95struct writeback_control;
96struct zone;
97
98/*
99 * A swap extent maps a range of a swapfile's PAGE_SIZE pages onto a range of
100 * disk blocks. A list of swap extents maps the entire swapfile. (Where the
101 * term `swapfile' refers to either a blockdevice or an IS_REG file. Apart
102 * from setup, they're handled identically.
103 *
104 * We always assume that blocks are of size PAGE_SIZE.
105 */
106struct swap_extent {
107 struct list_head list;
108 pgoff_t start_page;
109 pgoff_t nr_pages;
110 sector_t start_block;
111};
112
113/*
114 * Max bad pages in the new format..
115 */
116#define __swapoffset(x) ((unsigned long)&((union swap_header *)0)->x)
117#define MAX_SWAP_BADPAGES \
118 ((__swapoffset(magic.magic) - __swapoffset(info.badpages)) / sizeof(int))
119
120enum {
121 SWP_USED = (1 << 0), /* is slot in swap_info[] used? */
122 SWP_WRITEOK = (1 << 1), /* ok to write to this swap? */
Hugh Dickins6a6ba832009-01-06 14:39:51 -0800123 SWP_DISCARDABLE = (1 << 2), /* blkdev supports discard */
Hugh Dickins7992fde2009-01-06 14:39:53 -0800124 SWP_DISCARDING = (1 << 3), /* now discarding a free cluster */
Hugh Dickins20137a42009-01-06 14:39:54 -0800125 SWP_SOLIDSTATE = (1 << 4), /* blkdev seeks are cheap */
Hugh Dickins52b7efdb2005-09-03 15:54:39 -0700126 /* add others here before... */
127 SWP_SCANNING = (1 << 8), /* refcount in scan_swap_map */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700128};
129
130#define SWAP_CLUSTER_MAX 32
131
KAMEZAWA Hiroyuki355cfa72009-06-16 15:32:53 -0700132#define SWAP_MAP_MAX 0x7ffe
133#define SWAP_MAP_BAD 0x7fff
134#define SWAP_HAS_CACHE 0x8000 /* There is a swap cache of entry. */
135#define SWAP_COUNT_MASK (~SWAP_HAS_CACHE)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136/*
137 * The in-memory structure used to track swap areas.
Linus Torvalds1da177e2005-04-16 15:20:36 -0700138 */
139struct swap_info_struct {
Hugh Dickinsebebbbe2009-01-06 14:39:50 -0800140 unsigned long flags;
Hugh Dickins5d337b92005-09-03 15:54:41 -0700141 int prio; /* swap priority */
Hugh Dickinsebebbbe2009-01-06 14:39:50 -0800142 int next; /* next entry on swap list */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700143 struct file *swap_file;
144 struct block_device *bdev;
145 struct list_head extent_list;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700146 struct swap_extent *curr_swap_extent;
Hugh Dickinsebebbbe2009-01-06 14:39:50 -0800147 unsigned short *swap_map;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700148 unsigned int lowest_bit;
149 unsigned int highest_bit;
Hugh Dickins7992fde2009-01-06 14:39:53 -0800150 unsigned int lowest_alloc; /* while preparing discard cluster */
151 unsigned int highest_alloc; /* while preparing discard cluster */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700152 unsigned int cluster_next;
153 unsigned int cluster_nr;
Hugh Dickins6eb396d2005-09-03 15:54:35 -0700154 unsigned int pages;
155 unsigned int max;
156 unsigned int inuse_pages;
Hugh Dickinsebebbbe2009-01-06 14:39:50 -0800157 unsigned int old_block_size;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700158};
159
160struct swap_list_t {
161 int head; /* head of priority-ordered swapfile list */
162 int next; /* swapfile to be used next */
163};
164
165/* Swap 50% full? Release swapcache more aggressively.. */
166#define vm_swap_full() (nr_swap_pages*2 < total_swap_pages)
167
Linus Torvalds1da177e2005-04-16 15:20:36 -0700168/* linux/mm/page_alloc.c */
169extern unsigned long totalram_pages;
Hideo AOKIcb45b0e2006-04-10 22:52:59 -0700170extern unsigned long totalreserve_pages;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700171extern unsigned int nr_free_buffer_pages(void);
172extern unsigned int nr_free_pagecache_pages(void);
173
Christoph Lameter96177292007-02-10 01:43:03 -0800174/* Definition of global_page_state not available yet */
175#define nr_free_pages() global_page_state(NR_FREE_PAGES)
176
177
Linus Torvalds1da177e2005-04-16 15:20:36 -0700178/* linux/mm/swap.c */
KOSAKI Motohirof04e9eb2008-10-18 20:26:19 -0700179extern void __lru_cache_add(struct page *, enum lru_list lru);
180extern void lru_cache_add_lru(struct page *, enum lru_list lru);
Harvey Harrisonb3c97522008-02-13 15:03:15 -0800181extern void activate_page(struct page *);
182extern void mark_page_accessed(struct page *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700183extern void lru_add_drain(void);
Nick Piggin053837f2006-01-18 17:42:27 -0800184extern int lru_add_drain_all(void);
Miklos Szerediac6aadb2008-04-28 02:12:38 -0700185extern void rotate_reclaimable_page(struct page *page);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186extern void swap_setup(void);
187
Lee Schermerhorn894bc312008-10-18 20:26:39 -0700188extern void add_page_to_unevictable_list(struct page *page);
189
KOSAKI Motohirof04e9eb2008-10-18 20:26:19 -0700190/**
191 * lru_cache_add: add a page to the page lists
192 * @page: the page to add
193 */
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700194static inline void lru_cache_add_anon(struct page *page)
KOSAKI Motohirof04e9eb2008-10-18 20:26:19 -0700195{
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700196 __lru_cache_add(page, LRU_INACTIVE_ANON);
KOSAKI Motohirof04e9eb2008-10-18 20:26:19 -0700197}
198
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700199static inline void lru_cache_add_active_anon(struct page *page)
KOSAKI Motohirof04e9eb2008-10-18 20:26:19 -0700200{
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700201 __lru_cache_add(page, LRU_ACTIVE_ANON);
202}
203
204static inline void lru_cache_add_file(struct page *page)
205{
206 __lru_cache_add(page, LRU_INACTIVE_FILE);
207}
208
209static inline void lru_cache_add_active_file(struct page *page)
210{
211 __lru_cache_add(page, LRU_ACTIVE_FILE);
KOSAKI Motohirof04e9eb2008-10-18 20:26:19 -0700212}
213
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214/* linux/mm/vmscan.c */
Mel Gormandac1d272008-04-28 02:12:12 -0700215extern unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
KAMEZAWA Hiroyuki327c0e92009-03-31 15:23:31 -0700216 gfp_t gfp_mask, nodemask_t *mask);
Balbir Singhe1a1cd52008-02-07 00:14:02 -0800217extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem,
KOSAKI Motohiroa7885eb2009-01-07 18:08:24 -0800218 gfp_t gfp_mask, bool noswap,
219 unsigned int swappiness);
Rik van Riel4f98a2f2008-10-18 20:26:32 -0700220extern int __isolate_lru_page(struct page *page, int mode, int file);
Andrew Morton69e05942006-03-22 00:08:19 -0800221extern unsigned long shrink_all_memory(unsigned long nr_pages);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222extern int vm_swappiness;
Christoph Lameterb20a3502006-03-22 00:09:12 -0800223extern int remove_mapping(struct address_space *mapping, struct page *page);
Andrew Mortonbd1e22b2006-06-23 02:03:47 -0700224extern long vm_total_pages;
Christoph Lameterb20a3502006-03-22 00:09:12 -0800225
Christoph Lameter9eeff232006-01-18 17:42:31 -0800226#ifdef CONFIG_NUMA
227extern int zone_reclaim_mode;
Christoph Lameter96146342006-07-03 00:24:13 -0700228extern int sysctl_min_unmapped_ratio;
Christoph Lameter0ff38492006-09-25 23:31:52 -0700229extern int sysctl_min_slab_ratio;
Christoph Lameter9eeff232006-01-18 17:42:31 -0800230extern int zone_reclaim(struct zone *, gfp_t, unsigned int);
231#else
232#define zone_reclaim_mode 0
233static inline int zone_reclaim(struct zone *z, gfp_t mask, unsigned int order)
234{
235 return 0;
236}
237#endif
238
Lee Schermerhorn894bc312008-10-18 20:26:39 -0700239extern int page_evictable(struct page *page, struct vm_area_struct *vma);
Lee Schermerhorn89e004ea2008-10-18 20:26:43 -0700240extern void scan_mapping_unevictable_pages(struct address_space *);
Lee Schermerhornaf936a12008-10-18 20:26:53 -0700241
242extern unsigned long scan_unevictable_pages;
243extern int scan_unevictable_handler(struct ctl_table *, int, struct file *,
244 void __user *, size_t *, loff_t *);
245extern int scan_unevictable_register_node(struct node *node);
246extern void scan_unevictable_unregister_node(struct node *node);
Lee Schermerhorn894bc312008-10-18 20:26:39 -0700247
Yasunori Goto3218ae12006-06-27 02:53:33 -0700248extern int kswapd_run(int nid);
249
Linus Torvalds1da177e2005-04-16 15:20:36 -0700250#ifdef CONFIG_MMU
251/* linux/mm/shmem.c */
252extern int shmem_unuse(swp_entry_t entry, struct page *page);
253#endif /* CONFIG_MMU */
254
255extern void swap_unplug_io_fn(struct backing_dev_info *, struct page *);
256
257#ifdef CONFIG_SWAP
258/* linux/mm/page_io.c */
Minchan Kimaca8bf32009-06-16 15:33:02 -0700259extern int swap_readpage(struct page *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700260extern int swap_writepage(struct page *page, struct writeback_control *wbc);
NeilBrown6712ecf2007-09-27 12:47:43 +0200261extern void end_swap_bio_read(struct bio *bio, int err);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262
263/* linux/mm/swap_state.c */
264extern struct address_space swapper_space;
265#define total_swapcache_pages swapper_space.nrpages
266extern void show_swap_cache_info(void);
Hugh Dickinsac47b002009-01-06 14:39:39 -0800267extern int add_to_swap(struct page *);
Hugh Dickins73b12622008-02-04 22:28:50 -0800268extern int add_to_swap_cache(struct page *, swp_entry_t, gfp_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700269extern void __delete_from_swap_cache(struct page *);
270extern void delete_from_swap_cache(struct page *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700271extern void free_page_and_swap_cache(struct page *);
272extern void free_pages_and_swap_cache(struct page **, int);
Hugh Dickins46017e92008-02-04 22:28:41 -0800273extern struct page *lookup_swap_cache(swp_entry_t);
Hugh Dickins02098fe2008-02-04 22:28:42 -0800274extern struct page *read_swap_cache_async(swp_entry_t, gfp_t,
Hugh Dickins46017e92008-02-04 22:28:41 -0800275 struct vm_area_struct *vma, unsigned long addr);
Hugh Dickins02098fe2008-02-04 22:28:42 -0800276extern struct page *swapin_readahead(swp_entry_t, gfp_t,
Hugh Dickins46017e92008-02-04 22:28:41 -0800277 struct vm_area_struct *vma, unsigned long addr);
278
Linus Torvalds1da177e2005-04-16 15:20:36 -0700279/* linux/mm/swapfile.c */
Hugh Dickinsb9627162009-01-06 14:39:41 -0800280extern long nr_swap_pages;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700281extern long total_swap_pages;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700282extern void si_swapinfo(struct sysinfo *);
283extern swp_entry_t get_swap_page(void);
Rafael J. Wysockif577eb32006-03-23 02:59:59 -0800284extern swp_entry_t get_swap_page_of_type(int);
KAMEZAWA Hiroyuki355cfa72009-06-16 15:32:53 -0700285extern void swap_duplicate(swp_entry_t);
KAMEZAWA Hiroyukicb4b86b2009-06-16 15:32:52 -0700286extern int swapcache_prepare(swp_entry_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700287extern int valid_swaphandles(swp_entry_t, unsigned long *);
288extern void swap_free(swp_entry_t);
KAMEZAWA Hiroyukicb4b86b2009-06-16 15:32:52 -0700289extern void swapcache_free(swp_entry_t, struct page *page);
Hugh Dickins2509ef22009-01-06 14:40:10 -0800290extern int free_swap_and_cache(swp_entry_t);
Rafael J. Wysocki7bf23682007-01-05 16:36:28 -0800291extern int swap_type_of(dev_t, sector_t, struct block_device **);
Rafael J. Wysockif577eb32006-03-23 02:59:59 -0800292extern unsigned int count_swap_pages(int, int);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700293extern sector_t map_swap_page(struct swap_info_struct *, pgoff_t);
Rafael J. Wysocki3aef83e2006-12-06 20:34:10 -0800294extern sector_t swapdev_block(int, pgoff_t);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700295extern struct swap_info_struct *get_swap_info_struct(unsigned);
Hugh Dickins7b1fe592009-01-06 14:39:34 -0800296extern int reuse_swap_page(struct page *);
Hugh Dickinsa2c43ee2009-01-06 14:39:36 -0800297extern int try_to_free_swap(struct page *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700298struct backing_dev_info;
299
Linus Torvalds1da177e2005-04-16 15:20:36 -0700300/* linux/mm/thrash.c */
Hugh Dickinsa5c9b692009-06-23 12:36:58 -0700301extern struct mm_struct *swap_token_mm;
302extern void grab_swap_token(struct mm_struct *);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700303extern void __put_swap_token(struct mm_struct *);
304
305static inline int has_swap_token(struct mm_struct *mm)
306{
307 return (mm == swap_token_mm);
308}
309
310static inline void put_swap_token(struct mm_struct *mm)
311{
312 if (has_swap_token(mm))
313 __put_swap_token(mm);
314}
315
Rik van Rielf7b7fd82005-11-28 13:44:07 -0800316static inline void disable_swap_token(void)
317{
318 put_swap_token(swap_token_mm);
319}
320
KAMEZAWA Hiroyukid13d1442009-01-07 18:07:56 -0800321#ifdef CONFIG_CGROUP_MEM_RES_CTLR
KAMEZAWA Hiroyuki8a9478c2009-06-17 16:27:17 -0700322extern void
323mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout);
KAMEZAWA Hiroyukid13d1442009-01-07 18:07:56 -0800324#else
KAMEZAWA Hiroyuki8c7c6e342009-01-07 18:08:00 -0800325static inline void
KAMEZAWA Hiroyuki8a9478c2009-06-17 16:27:17 -0700326mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent, bool swapout)
KAMEZAWA Hiroyuki8c7c6e342009-01-07 18:08:00 -0800327{
328}
329#endif
330#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
331extern void mem_cgroup_uncharge_swap(swp_entry_t ent);
332#else
333static inline void mem_cgroup_uncharge_swap(swp_entry_t ent)
KAMEZAWA Hiroyukid13d1442009-01-07 18:07:56 -0800334{
335}
336#endif
337
Linus Torvalds1da177e2005-04-16 15:20:36 -0700338#else /* CONFIG_SWAP */
339
Hugh Dickinsb9627162009-01-06 14:39:41 -0800340#define nr_swap_pages 0L
341#define total_swap_pages 0L
Linus Torvalds1da177e2005-04-16 15:20:36 -0700342#define total_swapcache_pages 0UL
343
344#define si_swapinfo(val) \
345 do { (val)->freeswap = (val)->totalswap = 0; } while (0)
Olaf Hering9ae5b3c2005-08-07 09:42:24 -0700346/* only sparc can not include linux/pagemap.h in this file
347 * so leave page_cache_release and release_pages undeclared... */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700348#define free_page_and_swap_cache(page) \
349 page_cache_release(page)
350#define free_pages_and_swap_cache(pages, nr) \
351 release_pages((pages), (nr), 0);
352
Con Kolivasbd96b9e2006-06-23 02:03:42 -0700353static inline void show_swap_cache_info(void)
354{
355}
356
Hugh Dickins2509ef22009-01-06 14:40:10 -0800357#define free_swap_and_cache(swp) is_migration_entry(swp)
KAMEZAWA Hiroyukicb4b86b2009-06-16 15:32:52 -0700358#define swapcache_prepare(swp) is_migration_entry(swp)
Con Kolivasbd96b9e2006-06-23 02:03:42 -0700359
KAMEZAWA Hiroyuki355cfa72009-06-16 15:32:53 -0700360static inline void swap_duplicate(swp_entry_t swp)
361{
362}
363
Con Kolivasbd96b9e2006-06-23 02:03:42 -0700364static inline void swap_free(swp_entry_t swp)
365{
366}
367
KAMEZAWA Hiroyukicb4b86b2009-06-16 15:32:52 -0700368static inline void swapcache_free(swp_entry_t swp, struct page *page)
369{
370}
371
Hugh Dickins02098fe2008-02-04 22:28:42 -0800372static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask,
Con Kolivasbd96b9e2006-06-23 02:03:42 -0700373 struct vm_area_struct *vma, unsigned long addr)
374{
375 return NULL;
376}
377
Hugh Dickins9fab5612009-03-31 15:23:33 -0700378static inline int swap_writepage(struct page *p, struct writeback_control *wbc)
379{
380 return 0;
381}
382
Con Kolivasbd96b9e2006-06-23 02:03:42 -0700383static inline struct page *lookup_swap_cache(swp_entry_t swp)
384{
385 return NULL;
386}
387
Hugh Dickins60371d92009-01-06 14:39:40 -0800388static inline int add_to_swap(struct page *page)
389{
390 return 0;
391}
392
Hugh Dickins73b12622008-02-04 22:28:50 -0800393static inline int add_to_swap_cache(struct page *page, swp_entry_t entry,
394 gfp_t gfp_mask)
Con Kolivasbd96b9e2006-06-23 02:03:42 -0700395{
Hugh Dickins73b12622008-02-04 22:28:50 -0800396 return -1;
Con Kolivasbd96b9e2006-06-23 02:03:42 -0700397}
398
399static inline void __delete_from_swap_cache(struct page *page)
400{
401}
402
403static inline void delete_from_swap_cache(struct page *page)
404{
405}
406
Hugh Dickins7b1fe592009-01-06 14:39:34 -0800407#define reuse_swap_page(page) (page_mapcount(page) == 1)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700408
Hugh Dickinsa2c43ee2009-01-06 14:39:36 -0800409static inline int try_to_free_swap(struct page *page)
Rik van Riel68a223942008-10-18 20:26:23 -0700410{
411 return 0;
412}
413
Linus Torvalds1da177e2005-04-16 15:20:36 -0700414static inline swp_entry_t get_swap_page(void)
415{
416 swp_entry_t entry;
417 entry.val = 0;
418 return entry;
419}
420
421/* linux/mm/thrash.c */
Johannes Weinera5abeea2009-09-21 17:01:13 -0700422static inline void put_swap_token(struct mm_struct *mm)
423{
424}
425
426static inline void grab_swap_token(struct mm_struct *mm)
427{
428}
429
430static inline int has_swap_token(struct mm_struct *mm)
431{
432 return 0;
433}
434
435static inline void disable_swap_token(void)
436{
437}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700438
Daisuke Nishimurae767e052009-05-28 14:34:28 -0700439static inline void
440mem_cgroup_uncharge_swapcache(struct page *page, swp_entry_t ent)
441{
442}
443
Linus Torvalds1da177e2005-04-16 15:20:36 -0700444#endif /* CONFIG_SWAP */
445#endif /* __KERNEL__*/
446#endif /* _LINUX_SWAP_H */