1 #ifndef __LINUX_PAGE_CGROUP_H
2 #define __LINUX_PAGE_CGROUP_H
5 /* flags for mem_cgroup */
6 PCG_USED
= 0x01, /* This page is charged to a memcg */
7 PCG_MEM
= 0x02, /* This page holds a memory charge */
8 PCG_MEMSW
= 0x04, /* This page holds a memory+swap charge */
12 #ifndef __GENERATING_BOUNDS_H
13 #include <generated/bounds.h>
16 #include <linux/bit_spinlock.h>
19 * Page Cgroup can be considered as an extended mem_map.
20 * A page_cgroup page is associated with every page descriptor. The
21 * page_cgroup helps us identify information about the cgroup
22 * All page cgroups are allocated at boot or memory hotplug event,
23 * then the page cgroup for pfn always exists.
27 struct mem_cgroup
*mem_cgroup
;
30 void __meminit
pgdat_page_cgroup_init(struct pglist_data
*pgdat
);
32 #ifdef CONFIG_SPARSEMEM
33 static inline void __init
page_cgroup_init_flatmem(void)
36 extern void __init
page_cgroup_init(void);
38 void __init
page_cgroup_init_flatmem(void);
39 static inline void __init
page_cgroup_init(void)
44 struct page_cgroup
*lookup_page_cgroup(struct page
*page
);
45 struct page
*lookup_cgroup_page(struct page_cgroup
*pc
);
47 static inline int PageCgroupUsed(struct page_cgroup
*pc
)
49 return !!(pc
->flags
& PCG_USED
);
52 #else /* CONFIG_MEMCG */
55 static inline void __meminit
pgdat_page_cgroup_init(struct pglist_data
*pgdat
)
59 static inline struct page_cgroup
*lookup_page_cgroup(struct page
*page
)
64 static inline void page_cgroup_init(void)
68 static inline void __init
page_cgroup_init_flatmem(void)
72 #endif /* CONFIG_MEMCG */
74 #include <linux/swap.h>
76 #ifdef CONFIG_MEMCG_SWAP
77 extern unsigned short swap_cgroup_cmpxchg(swp_entry_t ent
,
78 unsigned short old
, unsigned short new);
79 extern unsigned short swap_cgroup_record(swp_entry_t ent
, unsigned short id
);
80 extern unsigned short lookup_swap_cgroup_id(swp_entry_t ent
);
81 extern int swap_cgroup_swapon(int type
, unsigned long max_pages
);
82 extern void swap_cgroup_swapoff(int type
);
86 unsigned short swap_cgroup_record(swp_entry_t ent
, unsigned short id
)
92 unsigned short lookup_swap_cgroup_id(swp_entry_t ent
)
98 swap_cgroup_swapon(int type
, unsigned long max_pages
)
103 static inline void swap_cgroup_swapoff(int type
)
108 #endif /* CONFIG_MEMCG_SWAP */
110 #endif /* !__GENERATING_BOUNDS_H */
112 #endif /* __LINUX_PAGE_CGROUP_H */
This page took 0.213939 seconds and 6 git commands to generate.