mm: memcontrol: Let mem_cgroup_move_account() have effect only if MMU enabled
Subsystems (4)
PATCH 1/1 mm: memcontrol: Let mem_cgroup_move_account() have effect only if MMU enabled
When !MMU, it will report warning. The related warning with allmodconfig under c6x:
CC mm/memcontrol.o
mm/memcontrol.c:2802:12: warning: 'mem_cgroup_move_account' defined but not used [-Wunused-function]
static int mem_cgroup_move_account(struct page *page,
^
--- mm/memcontrol.c | 172 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 86 insertions(+), 86 deletions(-)
mm/memcontrol.c +86 -86
@@ -2785,92 +2785,6 @@ void mem_cgroup_split_huge_fixup(struct page *head) }#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ -/** -* mem_cgroup_move_account - move account of the page -* @page: the page -* @nr_pages: number of regular pages (>1 for huge pages) -* @from: mem_cgroup which the page is moved from. -* @to: mem_cgroup which the page is moved to. @from != @to. -* -* The caller must confirm following. -* - page is not on LRU (isolate_page() is useful.) -* - compound_lock is held when nr_pages > 1 -* -* This function doesn't do "charge" to new cgroup and doesn't do "uncharge" -* from old cgroup. -*/ -static int mem_cgroup_move_account (struct page *page, -unsigned int nr_pages, -struct mem_cgroup *from, -struct mem_cgroup *to) -{ -unsigned long flags; -int ret; - -VM_BUG_ON (from == to); -VM_BUG_ON_PAGE (PageLRU (page), page); -/* -* The page is isolated from LRU. So, collapse function -* will not handle this page. But page splitting can happen. -* Do this check under compound_page_lock(). The caller should -* hold it. -*/ - ret = -EBUSY ; -if (nr_pages >1 && !PageTransHuge (page)) - goto out; - -/* -* Prevent mem_cgroup_migrate() from looking at page->mem_cgroup -* of its source page while we change it: page migration takes -* both pages off the LRU, but page cache replacement doesn't. -*/ -if (!trylock_page (page)) - goto out; - - ret = -EINVAL ; -if (page->mem_cgroup != from) - goto out_unlock; - -spin_lock_irqsave (&from->move_lock, flags); - -if (!PageAnon (page) &&page_mapped (page)) { -__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], - nr_pages); -__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], - nr_pages); - } - -if (PageWriteback (page)) { -__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_WRITEBACK ], - nr_pages); -__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_WRITEBACK ], - nr_pages); - } - -/* -* It is safe to change page->mem_cgroup here because the page -* is referenced, charged, and isolated - we can't race with -* uncharging, charging, migration, or LRU putback. -*/ - -/* caller should have done css_get */ - page->mem_cgroup = to; -spin_unlock_irqrestore (&from->move_lock, flags); - - ret =0 ; - -local_irq_disable (); -mem_cgroup_charge_statistics (to, page, nr_pages); -memcg_check_events (to, page); -mem_cgroup_charge_statistics (from, page, -nr_pages); -memcg_check_events (from, page); -local_irq_enable (); -out_unlock: -unlock_page (page); -out: -return ret; -} -#ifdef CONFIG_MEMCG_SWAP static void mem_cgroup_swap_statistics (struct mem_cgroup *memcg,bool charge)
@@ -4822,6 +4736,92 @@ static struct page *mc_handle_file_pte(struct vm_area_struct *vma,return page; } +/** +* mem_cgroup_move_account - move account of the page +* @page: the page +* @nr_pages: number of regular pages (>1 for huge pages) +* @from: mem_cgroup which the page is moved from. +* @to: mem_cgroup which the page is moved to. @from != @to. +* +* The caller must confirm following. +* - page is not on LRU (isolate_page() is useful.) +* - compound_lock is held when nr_pages > 1 +* +* This function doesn't do "charge" to new cgroup and doesn't do "uncharge" +* from old cgroup. +*/ +static int mem_cgroup_move_account (struct page *page, +unsigned int nr_pages, +struct mem_cgroup *from, +struct mem_cgroup *to) +{ +unsigned long flags; +int ret; + +VM_BUG_ON (from == to); +VM_BUG_ON_PAGE (PageLRU (page), page); +/* +* The page is isolated from LRU. So, collapse function +* will not handle this page. But page splitting can happen. +* Do this check under compound_page_lock(). The caller should +* hold it. +*/ + ret = -EBUSY ; +if (nr_pages >1 && !PageTransHuge (page)) + goto out; + +/* +* Prevent mem_cgroup_migrate() from looking at page->mem_cgroup +* of its source page while we change it: page migration takes +* both pages off the LRU, but page cache replacement doesn't. +*/ +if (!trylock_page (page)) + goto out; + + ret = -EINVAL ; +if (page->mem_cgroup != from) + goto out_unlock; + +spin_lock_irqsave (&from->move_lock, flags); + +if (!PageAnon (page) &&page_mapped (page)) { +__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], + nr_pages); +__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], + nr_pages); + } + +if (PageWriteback (page)) { +__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_WRITEBACK ], + nr_pages); +__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_WRITEBACK ], + nr_pages); + } + +/* +* It is safe to change page->mem_cgroup here because the page +* is referenced, charged, and isolated - we can't race with +* uncharging, charging, migration, or LRU putback. +*/ + +/* caller should have done css_get */ + page->mem_cgroup = to; +spin_unlock_irqrestore (&from->move_lock, flags); + + ret =0 ; + +local_irq_disable (); +mem_cgroup_charge_statistics (to, page, nr_pages); +memcg_check_events (to, page); +mem_cgroup_charge_statistics (from, page, -nr_pages); +memcg_check_events (from, page); +local_irq_enable (); +out_unlock: +unlock_page (page); +out: +return ret; +} +static enum mc_target_type get_mctgt_type (struct vm_area_struct *vma,unsigned long addr,pte_t ptent,union mc_target *target) {
Signature · 8 lines
1.9.3 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH 1/1 mm: memcontrol: Let mem_cgroup_move_account() have effect only if MMU enabled
Just forward mail.
-------- Forwarded Message --------
Subject: [PATCH] mm: memcontrol: Let mem_cgroup_move_account() have effect only if MMU enabled
Date: Tue, 03 Mar 2015 06:42:01 +0800
From: Chen Gang <[email protected]>
To: [email protected], [email protected]
CC: [email protected], [email protected], [email protected] <[email protected]>
When !MMU, it will report warning. The related warning with allmodconfig under c6x:
CC mm/memcontrol.o
mm/memcontrol.c:2802:12: warning: 'mem_cgroup_move_account' defined but not used [-Wunused-function]
static int mem_cgroup_move_account(struct page *page,
^
--- mm/memcontrol.c | 172 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 86 insertions(+), 86 deletions(-)
mm/memcontrol.c +86 -86
@@ -2785,92 +2785,6 @@ void mem_cgroup_split_huge_fixup(struct page *head) }#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ -/** -* mem_cgroup_move_account - move account of the page -* @page: the page -* @nr_pages: number of regular pages (>1 for huge pages) -* @from: mem_cgroup which the page is moved from. -* @to: mem_cgroup which the page is moved to. @from != @to. -* -* The caller must confirm following. -* - page is not on LRU (isolate_page() is useful.) -* - compound_lock is held when nr_pages > 1 -* -* This function doesn't do "charge" to new cgroup and doesn't do "uncharge" -* from old cgroup. -*/ -static int mem_cgroup_move_account (struct page *page, -unsigned int nr_pages, -struct mem_cgroup *from, -struct mem_cgroup *to) -{ -unsigned long flags; -int ret; - -VM_BUG_ON (from == to); -VM_BUG_ON_PAGE (PageLRU (page), page); -/* -* The page is isolated from LRU. So, collapse function -* will not handle this page. But page splitting can happen. -* Do this check under compound_page_lock(). The caller should -* hold it. -*/ - ret = -EBUSY ; -if (nr_pages >1 && !PageTransHuge (page)) - goto out; - -/* -* Prevent mem_cgroup_migrate() from looking at page->mem_cgroup -* of its source page while we change it: page migration takes -* both pages off the LRU, but page cache replacement doesn't. -*/ -if (!trylock_page (page)) - goto out; - - ret = -EINVAL ; -if (page->mem_cgroup != from) - goto out_unlock; - -spin_lock_irqsave (&from->move_lock, flags); - -if (!PageAnon (page) &&page_mapped (page)) { -__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], - nr_pages); -__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], - nr_pages); - } - -if (PageWriteback (page)) { -__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_WRITEBACK ], - nr_pages); -__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_WRITEBACK ], - nr_pages); - } - -/* -* It is safe to change page->mem_cgroup here because the page -* is referenced, charged, and isolated - we can't race with -* uncharging, charging, migration, or LRU putback. -*/ - -/* caller should have done css_get */ - page->mem_cgroup = to; -spin_unlock_irqrestore (&from->move_lock, flags); - - ret =0 ; - -local_irq_disable (); -mem_cgroup_charge_statistics (to, page, nr_pages); -memcg_check_events (to, page); -mem_cgroup_charge_statistics (from, page, -nr_pages); -memcg_check_events (from, page); -local_irq_enable (); -out_unlock: -unlock_page (page); -out: -return ret; -} -#ifdef CONFIG_MEMCG_SWAP static void mem_cgroup_swap_statistics (struct mem_cgroup *memcg,bool charge)
@@ -4822,6 +4736,92 @@ static struct page *mc_handle_file_pte(struct vm_area_struct *vma,return page; } +/** +* mem_cgroup_move_account - move account of the page +* @page: the page +* @nr_pages: number of regular pages (>1 for huge pages) +* @from: mem_cgroup which the page is moved from. +* @to: mem_cgroup which the page is moved to. @from != @to. +* +* The caller must confirm following. +* - page is not on LRU (isolate_page() is useful.) +* - compound_lock is held when nr_pages > 1 +* +* This function doesn't do "charge" to new cgroup and doesn't do "uncharge" +* from old cgroup. +*/ +static int mem_cgroup_move_account (struct page *page, +unsigned int nr_pages, +struct mem_cgroup *from, +struct mem_cgroup *to) +{ +unsigned long flags; +int ret; + +VM_BUG_ON (from == to); +VM_BUG_ON_PAGE (PageLRU (page), page); +/* +* The page is isolated from LRU. So, collapse function +* will not handle this page. But page splitting can happen. +* Do this check under compound_page_lock(). The caller should +* hold it. +*/ + ret = -EBUSY ; +if (nr_pages >1 && !PageTransHuge (page)) + goto out; + +/* +* Prevent mem_cgroup_migrate() from looking at page->mem_cgroup +* of its source page while we change it: page migration takes +* both pages off the LRU, but page cache replacement doesn't. +*/ +if (!trylock_page (page)) + goto out; + + ret = -EINVAL ; +if (page->mem_cgroup != from) + goto out_unlock; + +spin_lock_irqsave (&from->move_lock, flags); + +if (!PageAnon (page) &&page_mapped (page)) { +__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], + nr_pages); +__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], + nr_pages); + } + +if (PageWriteback (page)) { +__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_WRITEBACK ], + nr_pages); +__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_WRITEBACK ], + nr_pages); + } + +/* +* It is safe to change page->mem_cgroup here because the page +* is referenced, charged, and isolated - we can't race with +* uncharging, charging, migration, or LRU putback. +*/ + +/* caller should have done css_get */ + page->mem_cgroup = to; +spin_unlock_irqrestore (&from->move_lock, flags); + + ret =0 ; + +local_irq_disable (); +mem_cgroup_charge_statistics (to, page, nr_pages); +memcg_check_events (to, page); +mem_cgroup_charge_statistics (from, page, -nr_pages); +memcg_check_events (from, page); +local_irq_enable (); +out_unlock: +unlock_page (page); +out: +return ret; +} +static enum mc_target_type get_mctgt_type (struct vm_area_struct *vma,unsigned long addr,pte_t ptent,union mc_target *target) {
Signature · 1 line
1.9.3
Quoted 2 lines · Chen Gang
When !MMU, it will report warning. The related warning with allmodconfig under c6x:
Does it even make any sense to enable CONFIG_MEMCG when !CONFIG_MMU? Is anybody using this configuration and is it actually usable? My knowledge about CONFIG_MMU is close to zero so I might be missing something but I do not see a point into fixing compile warnings when the whole subsystem is not usable in the first place.
Quoted 205 lines
CC
mm/memcontrol.o
mm/memcontrol.c:2802:12: warning: 'mem_cgroup_move_account' defined but not used [-Wunused-function]
static int mem_cgroup_move_account(struct page *page,^Signed-off-by Chen Gang <[email protected]>--- mm/memcontrol.c | 172 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 86 insertions(+), 86 deletions(-)mm/memcontrol.c +86
-86@@ -2785,92 +2785,6 @@ void mem_cgroup_split_huge_fixup(struct page *head) }#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ -/** -* mem_cgroup_move_account - move account of the page -* @page: the page -* @nr_pages: number of regular pages (>1 for huge pages) -* @from: mem_cgroup which the page is moved from. -* @to: mem_cgroup which the page is moved to. @from != @to. -* -* The caller must confirm following. -* - page is not on LRU (isolate_page() is useful.) -* - compound_lock is held when nr_pages > 1 -* -* This function doesn't do "charge" to new cgroup and doesn't do "uncharge" -* from old cgroup. -*/ -static int mem_cgroup_move_account (struct page *page, -unsigned int nr_pages, -struct mem_cgroup *from, -struct mem_cgroup *to) -{ -unsigned long flags; -int ret; - -VM_BUG_ON (from == to); -VM_BUG_ON_PAGE (PageLRU (page), page); -/* -* The page is isolated from LRU. So, collapse function -* will not handle this page. But page splitting can happen. -* Do this check under compound_page_lock(). The caller should -* hold it. -*/ - ret = -EBUSY ; -if (nr_pages >1 && !PageTransHuge (page)) - goto out; - -/* -* Prevent mem_cgroup_migrate() from looking at page->mem_cgroup -* of its source page while we change it: page migration takes -* both pages off the LRU, but page cache replacement doesn't. -*/ -if (!trylock_page (page)) - goto out; - - ret = -EINVAL ; -if (page->mem_cgroup != from) - goto out_unlock; - -spin_lock_irqsave (&from->move_lock, flags); - -if (!PageAnon (page) &&page_mapped (page)) { -__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], - nr_pages); -__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], - nr_pages); - } - -if (PageWriteback (page)) { -__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_WRITEBACK ], - nr_pages); -__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_WRITEBACK ], - nr_pages); - } - -/* -* It is safe to change page->mem_cgroup here because the page -* is referenced, charged, and isolated - we can't race with -* uncharging, charging, migration, or LRU putback. -*/ - -/* caller should have done css_get */ - page->mem_cgroup = to; -spin_unlock_irqrestore (&from->move_lock, flags); - - ret =0 ; - -local_irq_disable (); -mem_cgroup_charge_statistics (to, page, nr_pages); -memcg_check_events (to, page); -mem_cgroup_charge_statistics (from, page, -nr_pages); -memcg_check_events (from, page); -local_irq_enable (); -out_unlock: -unlock_page (page); -out: -return ret; -} -#ifdef CONFIG_MEMCG_SWAP static void mem_cgroup_swap_statistics (struct mem_cgroup *memcg,bool charge)@@ -4822,6 +4736,92 @@ static struct page *mc_handle_file_pte(struct vm_area_struct *vma,return page; } +/** +* mem_cgroup_move_account - move account of the page +* @page: the page +* @nr_pages: number of regular pages (>1 for huge pages) +* @from: mem_cgroup which the page is moved from. +* @to: mem_cgroup which the page is moved to. @from != @to. +* +* The caller must confirm following. +* - page is not on LRU (isolate_page() is useful.) +* - compound_lock is held when nr_pages > 1 +* +* This function doesn't do "charge" to new cgroup and doesn't do "uncharge" +* from old cgroup. +*/ +static int mem_cgroup_move_account (struct page *page, +unsigned int nr_pages, +struct mem_cgroup *from, +struct mem_cgroup *to) +{ +unsigned long flags; +int ret; + +VM_BUG_ON (from == to); +VM_BUG_ON_PAGE (PageLRU (page), page); +/* +* The page is isolated from LRU. So, collapse function +* will not handle this page. But page splitting can happen. +* Do this check under compound_page_lock(). The caller should +* hold it. +*/ + ret = -EBUSY ; +if (nr_pages >1 && !PageTransHuge (page)) + goto out; + +/* +* Prevent mem_cgroup_migrate() from looking at page->mem_cgroup +* of its source page while we change it: page migration takes +* both pages off the LRU, but page cache replacement doesn't. +*/ +if (!trylock_page (page)) + goto out; + + ret = -EINVAL ; +if (page->mem_cgroup != from) + goto out_unlock; + +spin_lock_irqsave (&from->move_lock, flags); + +if (!PageAnon (page) &&page_mapped (page)) { +__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], + nr_pages); +__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_FILE_MAPPED ], + nr_pages); + } + +if (PageWriteback (page)) { +__this_cpu_sub (from->stat->count[MEM_CGROUP_STAT_WRITEBACK ], + nr_pages); +__this_cpu_add (to->stat->count[MEM_CGROUP_STAT_WRITEBACK ], + nr_pages); + } + +/* +* It is safe to change page->mem_cgroup here because the page +* is referenced, charged, and isolated - we can't race with +* uncharging, charging, migration, or LRU putback. +*/ + +/* caller should have done css_get */ + page->mem_cgroup = to; +spin_unlock_irqrestore (&from->move_lock, flags); + + ret =0 ; + +local_irq_disable (); +mem_cgroup_charge_statistics (to, page, nr_pages); +memcg_check_events (to, page); +mem_cgroup_charge_statistics (from, page, -nr_pages); +memcg_check_events (from, page); +local_irq_enable (); +out_unlock: +unlock_page (page); +out: +return ret; +} +static enum mc_target_type get_mctgt_type (struct vm_area_struct *vma,unsigned long addr,pte_t ptent,union mc_target *target) {Signature · 1 line
1.9.3
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 10 lines · Michal Hocko
Quoted 2 lines · Chen Gang
When !MMU, it will report warning. The related warning with allmodconfig under c6x:
Does it even make any sense to enable
CONFIG_MEMCGwhen !CONFIG_MMU? Is anybody using this configuration and is it actually usable? My knowledge aboutCONFIG_MMUis close to zero so I might be missing something but I do not see a point into fixing compile warnings when the whole subsystem is not usable in the first place.
For me, only according to the current code, the original author assumes CONFIG_MEMCG can still have effect when !CONFIG_MMU: "or, he/she needn't use CONFIG_MMU switch macro in memcontrol.c".
Welcome any other members' ideas, too.
Thanks.
Signature · 9 lines
Chen Gang Open, share, and attitude like air, water, and life which God blessed -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
[CCing Balbir]
Quoted 12 lines · Chen Gang
Quoted 10 lines · Michal Hocko
Quoted 2 lines · Chen Gang
When !MMU, it will report warning. The related warning with allmodconfig under c6x:
Does it even make any sense to enable
CONFIG_MEMCGwhen !CONFIG_MMU? Is anybody using this configuration and is it actually usable? My knowledge aboutCONFIG_MMUis close to zero so I might be missing something but I do not see a point into fixing compile warnings when the whole subsystem is not usable in the first place.
Quoted 3 lines
For me, only according to the current code, the original author assumes
CONFIG_MEMCGcan still have effect when !CONFIG_MMU: "or, he/she needn't useCONFIG_MMUswitch macro inmemcontrol.c".
Well this was before my time. 024914477e15 (memcg: move charges of anonymous swap) added them because of lack of page tables (as per documentation). This is a good reason but a bigger question is whether we want to add small little changes to make compiler happy or face the reality and realize that MEMCG without MMU is so restricted (I am even not sure whether it is usable at all) and reflect that in the dependency. Balbir had actually mentioned this in early submissions:
https://lkml.org/lkml/2008/3/16/59. I haven't seen anybody objecting to this so I guess it went in without a good reason. So instead I suggest the following change instead.
---
From 396a311891b29189bf306d5dedd1608a2a06bda4 Mon Sep 17 00:00:00 2001
From: Michal Hocko <[email protected]>
Date: Wed, 4 Mar 2015 10:48:47 +0100
Subject: [PATCH] memcg: make CONFIG_MEMCG depend on CONFIG_MMU
CONFIG_MEMCG might be currently enabled also for !MMU architectures which was probably an omission because Balbir had this on the TODO list section (https://lkml.org/lkml/2008/3/16/59)
"
Only when CONFIG_MMU is enabled, is the virtual address space control enabled. Should we do this for nommu cases as well? My suspicion is that we don't have to.
"
I do not see any traces for !MMU requests after then. The code compiles with !MMU but I haven't heard about anybody using it in the real life so it is not clear to me whether it works and it is usable at all considering how !MMU configuration is restricted.
Let's make CONFIG_MEMCG depend on CONFIG_MMU to make our support explicit and also to get rid of few ifdefs in the code base.
--- Documentation/cgroups/memory.txt | 2 -- init/Kconfig | 1 + mm/memcontrol.c | 24 ------------------------ 3 files changed, 1 insertion(+), 26 deletions(-)
Documentation/cgroups/memory.txt +0 -2
@@ -667,8 +667,6 @@ NOTE2: It is recommended to set the soft limit always below the hard limit, Users can move charges associated with a task along with task migration, that is, uncharge task's pages from the old cgroup and charge them to the new cgroup. -This feature is not supported in !CONFIG_MMU environments because of lack of -page tables. 8.1 Interface
init/Kconfig +1 -0
@@ -979,6 +979,7 @@ config MEMCG bool "Memory Resource Controller for Control Groups" select PAGE_COUNTER select EVENTFD + depends on MMU help Provides a memory resource controller that manages both anonymous memory and page cache. (See Documentation/cgroups/memory.txt)
mm/memcontrol.c +0 -24
@@ -3467,7 +3467,6 @@ static u64 mem_cgroup_move_charge_read(struct cgroup_subsys_state *css,return mem_cgroup_from_css (css)->move_charge_at_immigrate; } -#ifdef CONFIG_MMU static int mem_cgroup_move_charge_write (struct cgroup_subsys_state *css,struct cftype *cft,u64 val) {
@@ -3485,13 +3484,6 @@ static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css, memcg->move_charge_at_immigrate = val;return 0 ; } -#else -static int mem_cgroup_move_charge_write (struct cgroup_subsys_state *css, -struct cftype *cft,u64 val) -{ -return -ENOSYS ; -} -#endif #ifdef CONFIG_NUMA static int memcg_numa_stat_show (struct seq_file *m,void *v)
@@ -4676,7 +4668,6 @@ static void mem_cgroup_css_reset(struct cgroup_subsys_state *css) memcg->soft_limit =PAGE_COUNTER_MAX ; } -#ifdef CONFIG_MMU /* Handlers for move charge at task migration. */ static int mem_cgroup_do_precharge (unsigned long count) {
@@ -5209,21 +5200,6 @@ static void mem_cgroup_move_task(struct cgroup_subsys_state *css,if (mc.to)mem_cgroup_clear_mc (); } -#else /* !CONFIG_MMU */ -static int mem_cgroup_can_attach (struct cgroup_subsys_state *css, -struct cgroup_taskset *tset) -{ -return 0 ; -} -static void mem_cgroup_cancel_attach (struct cgroup_subsys_state *css, -struct cgroup_taskset *tset) -{ -} -static void mem_cgroup_move_task (struct cgroup_subsys_state *css, -struct cgroup_taskset *tset) -{ -} -#endif /* * Cgroup retains root cgroups across [un]mount cycles making it necessary
Signature · 11 lines
2.1.4 -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 9 lines · Michal Hocko
Quoted 2 lines · Chen Gang
When !MMU, it will report warning. The related warning with allmodconfig under c6x:
Does it even make any sense to enable
CONFIG_MEMCGwhen !CONFIG_MMU? Is anybody using this configuration and is it actually usable? My knowledge aboutCONFIG_MMUis close to zero so I might be missing something but I do not see a point into fixing compile warnings when the whole subsystem is not usable in the first place.
It's very limited, and anonymous memory is not even charged right now, even though it could be -- see nommu.c::do_mmap_private(). But there is nothing inherent in the memcg functionality that would require an MMU I guess, except for these ridiculous charge moving pte walkers.
Quoted 1 line
Quoted 1 line
Signed-off-by Chen Gang <[email protected]>
Quoted 11 lines · Johannes Weiner
Quoted 9 lines · Michal Hocko
Quoted 2 lines · Chen Gang
When !MMU, it will report warning. The related warning with allmodconfig under c6x:
Does it even make any sense to enable
CONFIG_MEMCGwhen !CONFIG_MMU? Is anybody using this configuration and is it actually usable? My knowledge aboutCONFIG_MMUis close to zero so I might be missing something but I do not see a point into fixing compile warnings when the whole subsystem is not usable in the first place.
Quoted 8 lines
It's very limited, and anonymous memory is not even charged right now, even though it could be -- see
nommu.c::do_mmap_private(). But there is nothing inherent in the memcg functionality that would require an MMU I guess, except for these ridiculous charge moving pte walkers.Quoted 1 line
Quoted 1 line
Signed-off-by Chen Gang <[email protected]>Acked-by Johannes Weiner <[email protected]>
Thanks, I will post the patch to Andrew.
Signature · 2 lines
Michal Hocko SUSE Labs