Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Johannes Weiner | 5d1ea48 | 2014-12-10 15:44:55 -0800 | [diff] [blame] | 2 | #ifndef __LINUX_SWAP_CGROUP_H |
| 3 | #define __LINUX_SWAP_CGROUP_H |
KAMEZAWA Hiroyuki | 52d4b9a | 2008-10-18 20:28:16 -0700 | [diff] [blame] | 4 | |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 5 | #include <linux/swap.h> |
Jaswinder Singh Rajput | 9757275 | 2009-09-20 16:20:44 +0530 | [diff] [blame] | 6 | |
Andrew Morton | c255a45 | 2012-07-31 16:43:02 -0700 | [diff] [blame] | 7 | #ifdef CONFIG_MEMCG_SWAP |
Johannes Weiner | 5d1ea48 | 2014-12-10 15:44:55 -0800 | [diff] [blame] | 8 | |
Daisuke Nishimura | 0249144 | 2010-03-10 15:22:17 -0800 | [diff] [blame] | 9 | extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent, |
| 10 | unsigned short old, unsigned short new); |
Huang Ying | 38d8b4e | 2017-07-06 15:37:18 -0700 | [diff] [blame] | 11 | extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id, |
| 12 | unsigned int nr_ents); |
Bob Liu | 9fb4b7c | 2012-01-12 17:18:48 -0800 | [diff] [blame] | 13 | extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent); |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 14 | extern int swap_cgroup_swapon(int type, unsigned long max_pages); |
| 15 | extern void swap_cgroup_swapoff(int type); |
Johannes Weiner | 5d1ea48 | 2014-12-10 15:44:55 -0800 | [diff] [blame] | 16 | |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 17 | #else |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 18 | |
| 19 | static inline |
Huang Ying | 38d8b4e | 2017-07-06 15:37:18 -0700 | [diff] [blame] | 20 | unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id, |
| 21 | unsigned int nr_ents) |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 22 | { |
KAMEZAWA Hiroyuki | a3b2d69 | 2009-04-02 16:57:45 -0700 | [diff] [blame] | 23 | return 0; |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 24 | } |
| 25 | |
| 26 | static inline |
Bob Liu | 9fb4b7c | 2012-01-12 17:18:48 -0800 | [diff] [blame] | 27 | unsigned short lookup_swap_cgroup_id(swp_entry_t ent) |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 28 | { |
KAMEZAWA Hiroyuki | a3b2d69 | 2009-04-02 16:57:45 -0700 | [diff] [blame] | 29 | return 0; |
KAMEZAWA Hiroyuki | 27a7faa | 2009-01-07 18:07:58 -0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | static inline int |
| 33 | swap_cgroup_swapon(int type, unsigned long max_pages) |
| 34 | { |
| 35 | return 0; |
| 36 | } |
| 37 | |
| 38 | static inline void swap_cgroup_swapoff(int type) |
| 39 | { |
| 40 | return; |
| 41 | } |
| 42 | |
Andrew Morton | c255a45 | 2012-07-31 16:43:02 -0700 | [diff] [blame] | 43 | #endif /* CONFIG_MEMCG_SWAP */ |
Johannes Weiner | 6b3ae58 | 2011-03-23 16:42:30 -0700 | [diff] [blame] | 44 | |
Johannes Weiner | 5d1ea48 | 2014-12-10 15:44:55 -0800 | [diff] [blame] | 45 | #endif /* __LINUX_SWAP_CGROUP_H */ |