netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/4] netprio_cgroup: use accessor to get id from css
       [not found] <cover.1398147734.git.nasa4836@gmail.com>
@ 2014-04-22  6:31 ` Jianyu Zhan
  2014-04-22 11:27   ` Neil Horman
  2014-04-22 20:33   ` Tejun Heo
  0 siblings, 2 replies; 3+ messages in thread
From: Jianyu Zhan @ 2014-04-22  6:31 UTC (permalink / raw)
  To: davem, tj, lizefan, nhorman, daniel.wagner, nasa4836, jiri,
	gaofeng, stephen
  Cc: netdev, linux-kernel

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>
---
 net/core/netprio_cgroup.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
index ce285c6..fc21035 100644
--- a/net/core/netprio_cgroup.c
+++ b/net/core/netprio_cgroup.c
@@ -89,7 +89,7 @@ static int extend_netdev_table(struct net_device *dev, u32 target_idx)
 static u32 netprio_prio(struct cgroup_subsys_state *css, struct net_device *dev)
 {
 	struct netprio_map *map = rcu_dereference_rtnl(dev->priomap);
-	int id = css->cgroup->id;
+	int id = css_to_id(css);
 
 	if (map && id < map->priomap_len)
 		return map->priomap[id];
@@ -109,7 +109,7 @@ static int netprio_set_prio(struct cgroup_subsys_state *css,
 			    struct net_device *dev, u32 prio)
 {
 	struct netprio_map *map;
-	int id = css->cgroup->id;
+	int id = css_to_id(css);
 	int ret;
 
 	/* avoid extending priomap for zero writes */
@@ -170,7 +170,7 @@ static void cgrp_css_free(struct cgroup_subsys_state *css)
 
 static u64 read_prioidx(struct cgroup_subsys_state *css, struct cftype *cft)
 {
-	return css->cgroup->id;
+	return css_to_id(css);
 }
 
 static int read_priomap(struct seq_file *sf, void *v)
@@ -222,7 +222,7 @@ static void net_prio_attach(struct cgroup_subsys_state *css,
 			    struct cgroup_taskset *tset)
 {
 	struct task_struct *p;
-	void *v = (void *)(unsigned long)css->cgroup->id;
+	void *v = (void *)(unsigned long)css_to_id(css);
 
 	cgroup_taskset_for_each(p, tset) {
 		task_lock(p);
-- 
2.0.0-rc0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/4] netprio_cgroup: use accessor to get id from css
  2014-04-22  6:31 ` [PATCH 3/4] netprio_cgroup: use accessor to get id from css Jianyu Zhan
@ 2014-04-22 11:27   ` Neil Horman
  2014-04-22 20:33   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2014-04-22 11:27 UTC (permalink / raw)
  To: Jianyu Zhan
  Cc: davem, tj, lizefan, daniel.wagner, jiri, gaofeng, stephen, netdev,
	linux-kernel

On Tue, Apr 22, 2014 at 02:31:01PM +0800, 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>
> ---
>  net/core/netprio_cgroup.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c
> index ce285c6..fc21035 100644
> --- a/net/core/netprio_cgroup.c
> +++ b/net/core/netprio_cgroup.c
> @@ -89,7 +89,7 @@ static int extend_netdev_table(struct net_device *dev, u32 target_idx)
>  static u32 netprio_prio(struct cgroup_subsys_state *css, struct net_device *dev)
>  {
>  	struct netprio_map *map = rcu_dereference_rtnl(dev->priomap);
> -	int id = css->cgroup->id;
> +	int id = css_to_id(css);
>  
>  	if (map && id < map->priomap_len)
>  		return map->priomap[id];
> @@ -109,7 +109,7 @@ static int netprio_set_prio(struct cgroup_subsys_state *css,
>  			    struct net_device *dev, u32 prio)
>  {
>  	struct netprio_map *map;
> -	int id = css->cgroup->id;
> +	int id = css_to_id(css);
>  	int ret;
>  
>  	/* avoid extending priomap for zero writes */
> @@ -170,7 +170,7 @@ static void cgrp_css_free(struct cgroup_subsys_state *css)
>  
>  static u64 read_prioidx(struct cgroup_subsys_state *css, struct cftype *cft)
>  {
> -	return css->cgroup->id;
> +	return css_to_id(css);
>  }
>  
>  static int read_priomap(struct seq_file *sf, void *v)
> @@ -222,7 +222,7 @@ static void net_prio_attach(struct cgroup_subsys_state *css,
>  			    struct cgroup_taskset *tset)
>  {
>  	struct task_struct *p;
> -	void *v = (void *)(unsigned long)css->cgroup->id;
> +	void *v = (void *)(unsigned long)css_to_id(css);
>  
>  	cgroup_taskset_for_each(p, tset) {
>  		task_lock(p);
> -- 
> 2.0.0-rc0
> 
> --
> 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/
> 
Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 3/4] netprio_cgroup: use accessor to get id from css
  2014-04-22  6:31 ` [PATCH 3/4] netprio_cgroup: use accessor to get id from css Jianyu Zhan
  2014-04-22 11:27   ` Neil Horman
@ 2014-04-22 20:33   ` Tejun Heo
  1 sibling, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2014-04-22 20:33 UTC (permalink / raw)
  To: Jianyu Zhan
  Cc: davem, lizefan, nhorman, daniel.wagner, jiri, gaofeng, stephen,
	netdev, linux-kernel

On Tue, Apr 22, 2014 at 02:31:01PM +0800, 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.

netprio_cgroup is a cgroup identifying controller.  We *do* want to
use per-cgroup IDs for it.

Thanks.

-- 
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-22 20:33 UTC | newest]

Thread overview: 3+ 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:31 ` [PATCH 3/4] netprio_cgroup: use accessor to get id from css Jianyu Zhan
2014-04-22 11:27   ` Neil Horman
2014-04-22 20:33   ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).