#ifndef _LINUX_MEMCONTROL_H
#define _LINUX_MEMCONTROL_H
-
+#include <linux/cgroup.h>
struct mem_cgroup;
struct page_cgroup;
struct page;
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
extern int do_swap_account;
#endif
+
+static inline bool mem_cgroup_disabled(void)
+{
+ if (mem_cgroup_subsys.disabled)
+ return true;
+ return false;
+}
+
#else /* CONFIG_CGROUP_MEM_RES_CTLR */
struct mem_cgroup;
{
return 0;
}
+
+static inline bool mem_cgroup_disabled(void)
+{
+ return true;
+}
#endif /* CONFIG_CGROUP_MEM_CONT */
#endif /* _LINUX_MEMCONTROL_H */
struct mem_cgroup *mem;
struct mem_cgroup_per_zone *mz;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return;
pc = lookup_page_cgroup(page);
/* can happen while we handle swapcache. */
struct mem_cgroup_per_zone *mz;
struct page_cgroup *pc;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return;
pc = lookup_page_cgroup(page);
struct page_cgroup *pc;
struct mem_cgroup_per_zone *mz;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return;
pc = lookup_page_cgroup(page);
/* barrier to sync with "charge" */
void mem_cgroup_move_lists(struct page *page,
enum lru_list from, enum lru_list to)
{
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return;
mem_cgroup_del_lru_list(page, from);
mem_cgroup_add_lru_list(page, to);
int mem_cgroup_newpage_charge(struct page *page,
struct mm_struct *mm, gfp_t gfp_mask)
{
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return 0;
if (PageCompound(page))
return 0;
int mem_cgroup_cache_charge(struct page *page, struct mm_struct *mm,
gfp_t gfp_mask)
{
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return 0;
if (PageCompound(page))
return 0;
struct mem_cgroup *mem;
swp_entry_t ent;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return 0;
if (!do_swap_account)
{
int ret = 0;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return 0;
if (unlikely(!mm))
mm = &init_mm;
{
struct page_cgroup *pc;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return;
if (!ptr)
return;
void mem_cgroup_cancel_charge_swapin(struct mem_cgroup *mem)
{
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return;
if (!mem)
return;
struct mem_cgroup *mem = NULL;
struct mem_cgroup_per_zone *mz;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return NULL;
if (PageSwapCache(page))
struct mem_cgroup *mem = NULL;
int ret = 0;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return 0;
pc = lookup_page_cgroup(page);
int progress = 0;
int retry = MEM_CGROUP_RECLAIM_RETRIES;
- if (mem_cgroup_subsys.disabled)
+ if (mem_cgroup_disabled())
return 0;
if (!mm)
return 0;
#ifdef CONFIG_CGROUP_MEM_RES_CTLR_SWAP
static void __init enable_swap_cgroup(void)
{
- if (!mem_cgroup_subsys.disabled && really_do_swap_account)
+ if (!mem_cgroup_disabled() && really_do_swap_account)
do_swap_account = 1;
}
#else