1 #ifndef __LINUX_PAGE_CGROUP_H
2 #define __LINUX_PAGE_CGROUP_H
12 #ifndef __GENERATING_BOUNDS_H
13 #include <generated/bounds.h>
32 #ifdef CONFIG_SPARSEMEM
36 extern void __init page_cgroup_init(
void);
39 static inline void __init page_cgroup_init(
void)
45 struct page *lookup_cgroup_page(
struct page_cgroup *
pc);
47 #define TESTPCGFLAG(uname, lname) \
48 static inline int PageCgroup##uname(struct page_cgroup *pc) \
49 { return test_bit(PCG_##lname, &pc->flags); }
51 #define SETPCGFLAG(uname, lname) \
52 static inline void SetPageCgroup##uname(struct page_cgroup *pc)\
53 { set_bit(PCG_##lname, &pc->flags); }
55 #define CLEARPCGFLAG(uname, lname) \
56 static inline void ClearPageCgroup##uname(struct page_cgroup *pc) \
57 { clear_bit(PCG_##lname, &pc->flags); }
59 #define TESTCLEARPCGFLAG(uname, lname) \
60 static inline int TestClearPageCgroup##uname(struct page_cgroup *pc) \
61 { return test_and_clear_bit(PCG_##lname, &pc->flags); }
63 TESTPCGFLAG(Used,
USED)
64 CLEARPCGFLAG(Used,
USED)
65 SETPCGFLAG(Used,
USED)
67 SETPCGFLAG(Migration, MIGRATION)
68 CLEARPCGFLAG(Migration, MIGRATION)
69 TESTPCGFLAG(Migration, MIGRATION)
80 static inline void unlock_page_cgroup(
struct page_cgroup *
pc)
82 bit_spin_unlock(
PCG_LOCK, &pc->flags);
97 static inline void page_cgroup_init(
void)
109 #ifdef CONFIG_MEMCG_SWAP
111 unsigned short old,
unsigned short new);
112 extern unsigned short swap_cgroup_record(
swp_entry_t ent,
unsigned short id);
114 extern int swap_cgroup_swapon(
int type,
unsigned long max_pages);
115 extern void swap_cgroup_swapoff(
int type);
119 unsigned short swap_cgroup_record(
swp_entry_t ent,
unsigned short id)
131 swap_cgroup_swapon(
int type,
unsigned long max_pages)
136 static inline void swap_cgroup_swapoff(
int type)