* [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css
[not found] <cover.1398147734.git.nasa4836@gmail.com>
@ 2014-04-22 6:30 ` Jianyu Zhan
2014-04-22 7:03 ` Jianyu Zhan
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jianyu Zhan @ 2014-04-22 6:30 UTC (permalink / raw)
To: hannes, mhocko, bsingharora, kamezawa.hiroyu
Cc: cgroups, linux-mm, linux-kernel, nasa4836
This is a prepared patch for converting from per-cgroup id to
per-subsystem id.
We should not access per-cgroup id directly, since this is implemetation
detail. Use the accessor css_from_id() instead.
This patch has no functional change.
Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
---
mm/memcontrol.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 80d9e38..46333cb 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -528,10 +528,10 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
{
/*
- * The ID of the root cgroup is 0, but memcg treat 0 as an
- * invalid ID, so we return (cgroup_id + 1).
+ * The ID of css for the root cgroup is 0, but memcg treat 0 as an
+ * invalid ID, so we return (id + 1).
*/
- return memcg->css.cgroup->id + 1;
+ return css_to_id(&memcg->css) + 1;
}
static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id)
@@ -6407,7 +6407,7 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css)
struct mem_cgroup *memcg = mem_cgroup_from_css(css);
struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(css));
- if (css->cgroup->id > MEM_CGROUP_ID_MAX)
+ if (css_to_id(css) > MEM_CGROUP_ID_MAX)
return -ENOSPC;
if (!parent)
--
2.0.0-rc0
--
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] 5+ messages in thread
* Re: [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css
2014-04-22 6:30 ` [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css Jianyu Zhan
@ 2014-04-22 7:03 ` Jianyu Zhan
2014-04-22 8:08 ` Jianyu Zhan
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jianyu Zhan @ 2014-04-22 7:03 UTC (permalink / raw)
To: Johannes Weiner, Michal Hocko, Balbir Singh, kamezawa.hiroyu
Cc: Cgroups, linux-mm, LKML, Jianyu Zhan, Andrew Morton
Cc Andrew.
Thanks,
Jianyu Zhan
On Tue, Apr 22, 2014 at 2:30 PM, Jianyu Zhan <nasa4836@gmail.com> wrote:
> This is a prepared patch for converting from per-cgroup id to
> per-subsystem id.
>
> We should not access per-cgroup id directly, since this is implemetation
> detail. Use the accessor css_from_id() instead.
>
> This patch has no functional change.
>
> Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
> ---
> mm/memcontrol.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 80d9e38..46333cb 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -528,10 +528,10 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
> {
> /*
> - * The ID of the root cgroup is 0, but memcg treat 0 as an
> - * invalid ID, so we return (cgroup_id + 1).
> + * The ID of css for the root cgroup is 0, but memcg treat 0 as an
> + * invalid ID, so we return (id + 1).
> */
> - return memcg->css.cgroup->id + 1;
> + return css_to_id(&memcg->css) + 1;
> }
>
> static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id)
> @@ -6407,7 +6407,7 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css)
> struct mem_cgroup *memcg = mem_cgroup_from_css(css);
> struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(css));
>
> - if (css->cgroup->id > MEM_CGROUP_ID_MAX)
> + if (css_to_id(css) > MEM_CGROUP_ID_MAX)
> return -ENOSPC;
>
> if (!parent)
> --
> 2.0.0-rc0
>
--
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] 5+ messages in thread
* Re: [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css
2014-04-22 6:30 ` [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css Jianyu Zhan
2014-04-22 7:03 ` Jianyu Zhan
@ 2014-04-22 8:08 ` Jianyu Zhan
2014-04-22 10:01 ` Michal Hocko
[not found] ` <20140422124920.e22ed65d33d2b982ef467372@linux-foundation.org>
3 siblings, 0 replies; 5+ messages in thread
From: Jianyu Zhan @ 2014-04-22 8:08 UTC (permalink / raw)
To: Johannes Weiner, Michal Hocko, Balbir Singh, kamezawa.hiroyu
Cc: Cgroups, linux-mm, LKML, Jianyu Zhan
On Tue, Apr 22, 2014 at 2:30 PM, Jianyu Zhan <nasa4836@gmail.com> wrote:
> This is a prepared patch for converting from per-cgroup id to
> per-subsystem id.
>
> We should not access per-cgroup id directly, since this is implemetation
> detail. Use the accessor css_from_id() instead.
>
> This patch has no functional change.
Hi, I'm sorry. This patch should be applied on top of its previous patch:
https://lkml.org/lkml/2014/4/22/54
Sorry for my fault , not cc'ing this mail-list in that patch.
Thanks,
Jianyu Zhan
--
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] 5+ messages in thread
* Re: [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css
2014-04-22 6:30 ` [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css Jianyu Zhan
2014-04-22 7:03 ` Jianyu Zhan
2014-04-22 8:08 ` Jianyu Zhan
@ 2014-04-22 10:01 ` Michal Hocko
[not found] ` <20140422124920.e22ed65d33d2b982ef467372@linux-foundation.org>
3 siblings, 0 replies; 5+ messages in thread
From: Michal Hocko @ 2014-04-22 10:01 UTC (permalink / raw)
To: Jianyu Zhan
Cc: hannes, bsingharora, kamezawa.hiroyu, cgroups, linux-mm, linux-kernel
On Tue 22-04-14 14:30:41, Jianyu Zhan wrote:
> This is a prepared patch for converting from per-cgroup id to
> per-subsystem id.
>
> We should not access per-cgroup id directly, since this is implemetation
> detail. Use the accessor css_from_id() instead.
>
> This patch has no functional change.
>
> Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Thanks!
> ---
> mm/memcontrol.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 80d9e38..46333cb 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -528,10 +528,10 @@ static inline bool mem_cgroup_is_root(struct mem_cgroup *memcg)
> static inline unsigned short mem_cgroup_id(struct mem_cgroup *memcg)
> {
> /*
> - * The ID of the root cgroup is 0, but memcg treat 0 as an
> - * invalid ID, so we return (cgroup_id + 1).
> + * The ID of css for the root cgroup is 0, but memcg treat 0 as an
> + * invalid ID, so we return (id + 1).
> */
> - return memcg->css.cgroup->id + 1;
> + return css_to_id(&memcg->css) + 1;
> }
>
> static inline struct mem_cgroup *mem_cgroup_from_id(unsigned short id)
> @@ -6407,7 +6407,7 @@ mem_cgroup_css_online(struct cgroup_subsys_state *css)
> struct mem_cgroup *memcg = mem_cgroup_from_css(css);
> struct mem_cgroup *parent = mem_cgroup_from_css(css_parent(css));
>
> - if (css->cgroup->id > MEM_CGROUP_ID_MAX)
> + if (css_to_id(css) > MEM_CGROUP_ID_MAX)
> return -ENOSPC;
>
> if (!parent)
> --
> 2.0.0-rc0
>
--
Michal Hocko
SUSE Labs
--
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] 5+ messages in thread
* Re: [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css
[not found] ` <20140422124920.e22ed65d33d2b982ef467372@linux-foundation.org>
@ 2014-04-23 6:41 ` Jianyu Zhan
0 siblings, 0 replies; 5+ messages in thread
From: Jianyu Zhan @ 2014-04-23 6:41 UTC (permalink / raw)
To: Andrew Morton, LKML, linux-mm; +Cc: Tejun Heo
On Wed, Apr 23, 2014 at 3:49 AM, Andrew Morton
<akpm@linux-foundation.org> wrote:
> I'd expect Tejun to process this series, but you didn't cc him on 2/4.
Oh, I reposed too much confidence in get_maintainer.pl. I thought it
would cc tj as usual. :-)
Tj said he has a patchset queued for addressing this problem and will
be sent out soon,
so just forget this patch and wait.
Thanks,
Jianyu Zhan
--
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] 5+ messages in thread
end of thread, other threads:[~2014-04-23 6:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <cover.1398147734.git.nasa4836@gmail.com>
2014-04-22 6:30 ` [PATCH 2/4] mm/memcontrol.c: use accessor to get id from css Jianyu Zhan
2014-04-22 7:03 ` Jianyu Zhan
2014-04-22 8:08 ` Jianyu Zhan
2014-04-22 10:01 ` Michal Hocko
[not found] ` <20140422124920.e22ed65d33d2b982ef467372@linux-foundation.org>
2014-04-23 6:41 ` Jianyu Zhan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox