Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1290229 > unrolled thread
| Started by | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| First post | 2015-12-12 17:40 +0100 |
| Last post | 2015-12-23 00:40 +0100 |
| Articles | 5 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 2/4] mm: memcontrol: reign in the CONFIG space madness Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-12-12 17:40 +0100
Re: [PATCH 2/4] mm: memcontrol: reign in the CONFIG space madness Johannes Weiner <hannes@cmpxchg.org> - 2015-12-12 18:30 +0100
Re: [PATCH 2/4] mm: memcontrol: reign in the CONFIG space madness Andrew Morton <akpm@linux-foundation.org> - 2015-12-23 00:20 +0100
Re: [PATCH 2/4] mm: memcontrol: reign in the CONFIG space madness Andrew Morton <akpm@linux-foundation.org> - 2015-12-23 00:20 +0100
Re: [PATCH 2/4] mm: memcontrol: reign in the CONFIG space madness Johannes Weiner <hannes@cmpxchg.org> - 2015-12-23 00:40 +0100
| From | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| Date | 2015-12-12 17:40 +0100 |
| Subject | Re: [PATCH 2/4] mm: memcontrol: reign in the CONFIG space madness |
| Message-ID | <qEVnb-4xa-13@gated-at.bofh.it> |
On Fri, Dec 11, 2015 at 02:54:11PM -0500, Johannes Weiner wrote:
> What CONFIG_INET and CONFIG_LEGACY_KMEM guard inside the memory
> controller code is insignificant, having these conditionals is not
> worth the complication and fragility that comes with them.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
> @@ -4374,17 +4342,11 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
> {
> struct mem_cgroup *memcg = mem_cgroup_from_css(css);
>
> -#ifdef CONFIG_INET
> if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
> static_branch_dec(&memcg_sockets_enabled_key);
> -#endif
> -
> - memcg_free_kmem(memcg);
I wonder where the second call to memcg_free_kmem comes from. Luckily,
it couldn't result in a breakage. And now it's removed.
>
> -#if defined(CONFIG_MEMCG_LEGACY_KMEM) && defined(CONFIG_INET)
> if (memcg->tcp_mem.active)
> static_branch_dec(&memcg_sockets_enabled_key);
> -#endif
>
> memcg_free_kmem(memcg);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2015-12-12 18:30 +0100 |
| Message-ID | <qEW9A-542-7@gated-at.bofh.it> |
| In reply to | #1290229 |
On Sat, Dec 12, 2015 at 07:33:32PM +0300, Vladimir Davydov wrote:
> On Fri, Dec 11, 2015 at 02:54:11PM -0500, Johannes Weiner wrote:
> > What CONFIG_INET and CONFIG_LEGACY_KMEM guard inside the memory
> > controller code is insignificant, having these conditionals is not
> > worth the complication and fragility that comes with them.
> >
> > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
>
> Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
>
> > @@ -4374,17 +4342,11 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
> > {
> > struct mem_cgroup *memcg = mem_cgroup_from_css(css);
> >
> > -#ifdef CONFIG_INET
> > if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
> > static_branch_dec(&memcg_sockets_enabled_key);
> > -#endif
> > -
> > - memcg_free_kmem(memcg);
>
> I wonder where the second call to memcg_free_kmem comes from. Luckily,
> it couldn't result in a breakage. And now it's removed.
Lol, I had to double check my trees to see what's going on as I don't
remember this being part of the patch. But it looks like the double
free came from the "net: drop tcp_memcontrol.c" patch and I must have
removed it again during conflict resolution when rebasing this patch
on top of yours. I must have thought git's auto-merge added it.
However, this causes an underflow of the kmem static branch, so we
will have to fix this directly in "net: drop tcp_memcontrol.c".
Andrew, could you please pick this up? However, it's important to also
then remove the hunk above from THIS patch, the one that deletes the
excessive memcg_free_kmem(). We need exactly one memcg_free_kmem() in
mem_cgroup_css_free(). :-)
From 94a14b7b0f7ed5b5ac88ca285a7e8ec3215ea59c Mon Sep 17 00:00:00 2001
From: Johannes Weiner <hannes@cmpxchg.org>
Date: Sat, 12 Dec 2015 12:14:31 -0500
Subject: [PATCH] net: drop tcp_memcontrol.c fix
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
---
mm/memcontrol.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 5cf7fd2..a4ce8d3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4386,8 +4386,6 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
static_branch_dec(&memcg_sockets_enabled_key);
#endif
- memcg_free_kmem(memcg);
-
__mem_cgroup_free(memcg);
}
--
2.6.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2015-12-23 00:20 +0100 |
| Message-ID | <qIEnL-1Tq-1@gated-at.bofh.it> |
| In reply to | #1290247 |
On Sat, 12 Dec 2015 12:20:57 -0500 Johannes Weiner <hannes@cmpxchg.org> wrote:
> On Sat, Dec 12, 2015 at 07:33:32PM +0300, Vladimir Davydov wrote:
> > On Fri, Dec 11, 2015 at 02:54:11PM -0500, Johannes Weiner wrote:
> > > What CONFIG_INET and CONFIG_LEGACY_KMEM guard inside the memory
> > > controller code is insignificant, having these conditionals is not
> > > worth the complication and fragility that comes with them.
> > >
> > > Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> >
> > Acked-by: Vladimir Davydov <vdavydov@virtuozzo.com>
> >
> > > @@ -4374,17 +4342,11 @@ static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
> > > {
> > > struct mem_cgroup *memcg = mem_cgroup_from_css(css);
> > >
> > > -#ifdef CONFIG_INET
> > > if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
> > > static_branch_dec(&memcg_sockets_enabled_key);
> > > -#endif
> > > -
> > > - memcg_free_kmem(memcg);
> >
> > I wonder where the second call to memcg_free_kmem comes from. Luckily,
> > it couldn't result in a breakage. And now it's removed.
>
> Lol, I had to double check my trees to see what's going on as I don't
> remember this being part of the patch. But it looks like the double
> free came from the "net: drop tcp_memcontrol.c" patch and I must have
> removed it again during conflict resolution when rebasing this patch
> on top of yours. I must have thought git's auto-merge added it.
>
> However, this causes an underflow of the kmem static branch, so we
> will have to fix this directly in "net: drop tcp_memcontrol.c".
>
> Andrew, could you please pick this up? However, it's important to also
> then remove the hunk above from THIS patch, the one that deletes the
> excessive memcg_free_kmem(). We need exactly one memcg_free_kmem() in
> mem_cgroup_css_free(). :-)
So you want to retain
mm-memcontrol-reign-in-the-config-space-madness.patch's removal of the
ifdef CONFIG_INET?
What I have is
Against net-drop-tcp_memcontrolc.patch:
--- a/mm/memcontrol.c~net-drop-tcp_memcontrolc-fix
+++ a/mm/memcontrol.c
@@ -4421,8 +4421,6 @@ static void mem_cgroup_css_free(struct c
static_branch_dec(&memcg_sockets_enabled_key);
#endif
- memcg_free_kmem(memcg);
-
__mem_cgroup_free(memcg);
}
and against mm-memcontrol-reign-in-the-config-space-madness.patch:
--- a/mm/memcontrol.c~mm-memcontrol-reign-in-the-config-space-madness-fix
+++ a/mm/memcontrol.c
@@ -4380,6 +4380,8 @@ static void mem_cgroup_css_free(struct c
if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
static_branch_dec(&memcg_sockets_enabled_key);
+ memcg_free_kmem(memcg);
+
if (memcg->tcp_mem.active)
static_branch_dec(&memcg_sockets_enabled_key);
Producing
static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
{
struct mem_cgroup *memcg = mem_cgroup_from_css(css);
if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
static_branch_dec(&memcg_sockets_enabled_key);
memcg_free_kmem(memcg);
if (memcg->tcp_mem.active)
static_branch_dec(&memcg_sockets_enabled_key);
__mem_cgroup_free(memcg);
}
And I did s/reign/rein/;)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Date | 2015-12-23 00:20 +0100 |
| Message-ID | <qIEnL-1Tq-11@gated-at.bofh.it> |
| In reply to | #1297141 |
On Tue, 22 Dec 2015 15:11:38 -0800 Andrew Morton <akpm@linux-foundation.org> wrote:
> What I have is
And after a bit of reject resolution in
mm-memcontrol-clean-up-alloc-online-offline-free-functions.patch we
have
static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
{
struct mem_cgroup *memcg = mem_cgroup_from_css(css);
if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
static_branch_dec(&memcg_sockets_enabled_key);
vmpressure_cleanup(&memcg->vmpressure);
cancel_work_sync(&memcg->high_work);
mem_cgroup_remove_from_trees(memcg);
memcg_free_kmem(memcg);
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && memcg->tcpmem_active)
static_branch_dec(&memcg_sockets_enabled_key);
mem_cgroup_free(memcg);
}
code looks a bit strange. Can we move the static_branch_dec's together
and run cgroup_subsys_on_dfl just once?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Johannes Weiner <hannes@cmpxchg.org> |
|---|---|
| Date | 2015-12-23 00:40 +0100 |
| Message-ID | <qIEH8-233-15@gated-at.bofh.it> |
| In reply to | #1297142 |
On Tue, Dec 22, 2015 at 03:15:27PM -0800, Andrew Morton wrote:
> On Tue, 22 Dec 2015 15:11:38 -0800 Andrew Morton <akpm@linux-foundation.org> wrote:
>
> > What I have is
>
> And after a bit of reject resolution in
> mm-memcontrol-clean-up-alloc-online-offline-free-functions.patch we
> have
>
>
> static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
> {
> struct mem_cgroup *memcg = mem_cgroup_from_css(css);
>
> if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
> static_branch_dec(&memcg_sockets_enabled_key);
>
> vmpressure_cleanup(&memcg->vmpressure);
> cancel_work_sync(&memcg->high_work);
> mem_cgroup_remove_from_trees(memcg);
> memcg_free_kmem(memcg);
>
> if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && memcg->tcpmem_active)
> static_branch_dec(&memcg_sockets_enabled_key);
>
> mem_cgroup_free(memcg);
> }
>
> code looks a bit strange. Can we move the static_branch_dec's together
> and run cgroup_subsys_on_dfl just once?
Thanks for fixing it up. I think we can at least put the branches next
to each other. Here is what I have in my local tree:
static void mem_cgroup_css_free(struct cgroup_subsys_state *css)
{
struct mem_cgroup *memcg = mem_cgroup_from_css(css);
if (cgroup_subsys_on_dfl(memory_cgrp_subsys) && !cgroup_memory_nosocket)
static_branch_dec(&memcg_sockets_enabled_key);
if (!cgroup_subsys_on_dfl(memory_cgrp_subsys) && memcg->tcpmem_active)
static_branch_dec(&memcg_sockets_enabled_key);
vmpressure_cleanup(&memcg->vmpressure);
cancel_work_sync(&memcg->high_work);
mem_cgroup_remove_from_trees(memcg);
memcg_free_kmem(memcg);
mem_cgroup_free(memcg);
}
However, I don't think turning it into this would be an improvement:
if (cgroup_subsys_on_dfl(memory_cgrp_subsys)) {
if (!cgroup_memory_nosocket)
static_branch_dec(&memcg_sockets_enabled_key);
} else if (memcg->tcpmem_active) {
static_branch_dec(&memcg_sockets_enabled_key);
}
Plus, I'm a little worried that conflating cgroup and cgroup2 blocks
will get us into trouble. Yeah, that code looks a little unusual, but
I can't help but think it's easier to follow the code flow for one
particular mode when the jump labels are always explicit. Then the
brain can easily pattern-match and ignore blocks of the other mode.
It doesn't work the same when we hide keywords in implicit else ifs.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web