mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jianyu Zhan <nasa4836@gmail.com>
To: davem@davemloft.net, tj@kernel.org, lizefan@huawei.com,
	nhorman@tuxdriver.com, daniel.wagner@bmw-carit.de,
	nasa4836@gmail.com, jiri@resnulli.us, gaofeng@cn.fujitsu.com,
	stephen@networkplumber.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] netprio_cgroup: use accessor to get id from css
Date: Tue, 22 Apr 2014 14:31:01 +0800	[thread overview]
Message-ID: <0b10af801af45fdbf4835e8da54273e9752b239f.1398147734.git.nasa4836@gmail.com> (raw)
In-Reply-To: <cover.1398147734.git.nasa4836@gmail.com>

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


  parent reply	other threads:[~2014-04-22  6:31 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22  6:30 [PATCH 0/4] cgroup: substitude per-cgroup id with per-subsys id Jianyu Zhan
2014-04-22  6:30 ` [PATCH 1/4] cgroup: introduce helper css_to_id() Jianyu Zhan
2014-04-22 20:31   ` Tejun Heo
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
2014-04-22  6:31 ` Jianyu Zhan [this message]
2014-04-22 11:27   ` [PATCH 3/4] netprio_cgroup: " Neil Horman
2014-04-22 20:33   ` Tejun Heo
2014-04-22  6:31 ` [PATCH 4/4] cgroup: convert from per-cgroup id to per-subsys id Jianyu Zhan
2014-04-22  8:03 ` Jianyu Zhan
2014-04-22 20:36   ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b10af801af45fdbf4835e8da54273e9752b239f.1398147734.git.nasa4836@gmail.com \
    --to=nasa4836@gmail.com \
    --cc=daniel.wagner@bmw-carit.de \
    --cc=davem@davemloft.net \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=jiri@resnulli.us \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=stephen@networkplumber.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®