* [BUGFIX][PATCH] memcg: fix thresholds with use_hierarchy == 1
@ 2010-09-29 12:27 Kirill A. Shutsemov
2010-09-29 14:02 ` Daisuke Nishimura
0 siblings, 1 reply; 3+ messages in thread
From: Kirill A. Shutsemov @ 2010-09-29 12:27 UTC (permalink / raw)
To: linux-mm
Cc: Balbir Singh, Daisuke Nishimura, KAMEZAWA Hiroyuki,
Andrew Morton, linux-kernel, Kirill A. Shutemov
From: Kirill A. Shutemov <kirill@shutemov.name>
We need to check parent's thresholds if parent has use_hierarchy == 1 to
be sure that parent's threshold events will be triggered even if parent
itself is not active (no MEM_CGROUP_EVENTS).
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
mm/memcontrol.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 3eed583..196f710 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3587,9 +3587,20 @@ unlock:
static void mem_cgroup_threshold(struct mem_cgroup *memcg)
{
- __mem_cgroup_threshold(memcg, false);
- if (do_swap_account)
- __mem_cgroup_threshold(memcg, true);
+ struct cgroup *parent;
+
+ while (1) {
+ __mem_cgroup_threshold(memcg, false);
+ if (do_swap_account)
+ __mem_cgroup_threshold(memcg, true);
+
+ parent = memcg->css.cgroup->parent;
+ if (!parent)
+ break;
+ memcg = mem_cgroup_from_cont(parent);
+ if (!memcg->use_hierarchy)
+ break;
+ }
}
static int compare_thresholds(const void *a, const void *b)
--
1.7.2.3
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUGFIX][PATCH] memcg: fix thresholds with use_hierarchy == 1
2010-09-29 12:27 [BUGFIX][PATCH] memcg: fix thresholds with use_hierarchy == 1 Kirill A. Shutsemov
@ 2010-09-29 14:02 ` Daisuke Nishimura
2010-09-29 14:06 ` Daisuke Nishimura
0 siblings, 1 reply; 3+ messages in thread
From: Daisuke Nishimura @ 2010-09-29 14:02 UTC (permalink / raw)
To: Kirill A. Shutsemov
Cc: linux-mm, Balbir Singh, Daisuke Nishimura, KAMEZAWA Hiroyuki,
Andrew Morton, linux-kernel
On Wed, 29 Sep 2010 15:27:25 +0300
"Kirill A. Shutsemov" <kirill@shutemov.name> wrote:
> From: Kirill A. Shutemov <kirill@shutemov.name>
>
> We need to check parent's thresholds if parent has use_hierarchy == 1 to
> be sure that parent's threshold events will be triggered even if parent
> itself is not active (no MEM_CGROUP_EVENTS).
>
> Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
> ---
> mm/memcontrol.c | 17 ++++++++++++++---
> 1 files changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 3eed583..196f710 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -3587,9 +3587,20 @@ unlock:
>
> static void mem_cgroup_threshold(struct mem_cgroup *memcg)
> {
> - __mem_cgroup_threshold(memcg, false);
> - if (do_swap_account)
> - __mem_cgroup_threshold(memcg, true);
> + struct cgroup *parent;
> +
> + while (1) {
> + __mem_cgroup_threshold(memcg, false);
> + if (do_swap_account)
> + __mem_cgroup_threshold(memcg, true);
> +
> + parent = memcg->css.cgroup->parent;
> + if (!parent)
> + break;
> + memcg = mem_cgroup_from_cont(parent);
> + if (!memcg->use_hierarchy)
> + break;
> + }
I think you can simplify this part by using parent_mem_cgroup() like:
parent = parent_mem_cgroup(memcg);
if (!memcg)
break;
Thanks,
Daisuke Nishimura.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [BUGFIX][PATCH] memcg: fix thresholds with use_hierarchy == 1
2010-09-29 14:02 ` Daisuke Nishimura
@ 2010-09-29 14:06 ` Daisuke Nishimura
0 siblings, 0 replies; 3+ messages in thread
From: Daisuke Nishimura @ 2010-09-29 14:06 UTC (permalink / raw)
To: Kirill A. Shutsemov
Cc: linux-mm, Balbir Singh, Daisuke Nishimura, KAMEZAWA Hiroyuki,
Andrew Morton, linux-kernel
> I think you can simplify this part by using parent_mem_cgroup() like:
>
> parent = parent_mem_cgroup(memcg);
> if (!memcg)
^^^^^^^^ must be !parent of course :)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-09-29 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-29 12:27 [BUGFIX][PATCH] memcg: fix thresholds with use_hierarchy == 1 Kirill A. Shutsemov
2010-09-29 14:02 ` Daisuke Nishimura
2010-09-29 14:06 ` Daisuke Nishimura
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox