blob: a12dd1c3966c909be0c15ac9b08245f12f739d36 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Johannes Weiner5d1ea482014-12-10 15:44:55 -08002#ifndef __LINUX_SWAP_CGROUP_H
3#define __LINUX_SWAP_CGROUP_H
KAMEZAWA Hiroyuki52d4b9a2008-10-18 20:28:16 -07004
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -08005#include <linux/swap.h>
Jaswinder Singh Rajput97572752009-09-20 16:20:44 +05306
Andrew Mortonc255a452012-07-31 16:43:02 -07007#ifdef CONFIG_MEMCG_SWAP
Johannes Weiner5d1ea482014-12-10 15:44:55 -08008
Daisuke Nishimura02491442010-03-10 15:22:17 -08009extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent,
10 unsigned short old, unsigned short new);
Huang Ying38d8b4e2017-07-06 15:37:18 -070011extern unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
12 unsigned int nr_ents);
Bob Liu9fb4b7c2012-01-12 17:18:48 -080013extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent);
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080014extern int swap_cgroup_swapon(int type, unsigned long max_pages);
15extern void swap_cgroup_swapoff(int type);
Johannes Weiner5d1ea482014-12-10 15:44:55 -080016
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080017#else
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080018
19static inline
Huang Ying38d8b4e2017-07-06 15:37:18 -070020unsigned short swap_cgroup_record(swp_entry_t ent, unsigned short id,
21 unsigned int nr_ents)
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080022{
KAMEZAWA Hiroyukia3b2d692009-04-02 16:57:45 -070023 return 0;
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080024}
25
26static inline
Bob Liu9fb4b7c2012-01-12 17:18:48 -080027unsigned short lookup_swap_cgroup_id(swp_entry_t ent)
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080028{
KAMEZAWA Hiroyukia3b2d692009-04-02 16:57:45 -070029 return 0;
KAMEZAWA Hiroyuki27a7faa2009-01-07 18:07:58 -080030}
31
32static inline int
33swap_cgroup_swapon(int type, unsigned long max_pages)
34{
35 return 0;
36}
37
38static inline void swap_cgroup_swapoff(int type)
39{
40 return;
41}
42
Andrew Mortonc255a452012-07-31 16:43:02 -070043#endif /* CONFIG_MEMCG_SWAP */
Johannes Weiner6b3ae582011-03-23 16:42:30 -070044
Johannes Weiner5d1ea482014-12-10 15:44:55 -080045#endif /* __LINUX_SWAP_CGROUP_H */