Commit db53c73a authored by Tejun Heo's avatar Tejun Heo

netprio: use css ID instead of cgroup ID

netprio uses cgroup ID to index the priority mapping table.  This is
currently okay as cgroup IDs are allocated using idr and packed.
However, cgroup IDs will be changed to use full 64bit range and won't
be packed making this impractical.  netprio doesn't care what type of
IDs it uses as long as they can identify the controller instances and
are packed.  Let's switch to css IDs instead of cgroup IDs.
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Reviewed-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Namhyung Kim <namhyung@kernel.org>
parent f05499a0
...@@ -26,7 +26,7 @@ static inline u32 task_netprioidx(struct task_struct *p) ...@@ -26,7 +26,7 @@ static inline u32 task_netprioidx(struct task_struct *p)
rcu_read_lock(); rcu_read_lock();
css = task_css(p, net_prio_cgrp_id); css = task_css(p, net_prio_cgrp_id);
idx = css->cgroup->id; idx = css->id;
rcu_read_unlock(); rcu_read_unlock();
return idx; return idx;
} }
......
...@@ -93,7 +93,7 @@ static int extend_netdev_table(struct net_device *dev, u32 target_idx) ...@@ -93,7 +93,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) static u32 netprio_prio(struct cgroup_subsys_state *css, struct net_device *dev)
{ {
struct netprio_map *map = rcu_dereference_rtnl(dev->priomap); struct netprio_map *map = rcu_dereference_rtnl(dev->priomap);
int id = css->cgroup->id; int id = css->id;
if (map && id < map->priomap_len) if (map && id < map->priomap_len)
return map->priomap[id]; return map->priomap[id];
...@@ -113,7 +113,7 @@ static int netprio_set_prio(struct cgroup_subsys_state *css, ...@@ -113,7 +113,7 @@ static int netprio_set_prio(struct cgroup_subsys_state *css,
struct net_device *dev, u32 prio) struct net_device *dev, u32 prio)
{ {
struct netprio_map *map; struct netprio_map *map;
int id = css->cgroup->id; int id = css->id;
int ret; int ret;
/* avoid extending priomap for zero writes */ /* avoid extending priomap for zero writes */
...@@ -177,7 +177,7 @@ static void cgrp_css_free(struct cgroup_subsys_state *css) ...@@ -177,7 +177,7 @@ static void cgrp_css_free(struct cgroup_subsys_state *css)
static u64 read_prioidx(struct cgroup_subsys_state *css, struct cftype *cft) static u64 read_prioidx(struct cgroup_subsys_state *css, struct cftype *cft)
{ {
return css->cgroup->id; return css->id;
} }
static int read_priomap(struct seq_file *sf, void *v) static int read_priomap(struct seq_file *sf, void *v)
...@@ -237,7 +237,7 @@ static void net_prio_attach(struct cgroup_taskset *tset) ...@@ -237,7 +237,7 @@ static void net_prio_attach(struct cgroup_taskset *tset)
struct cgroup_subsys_state *css; struct cgroup_subsys_state *css;
cgroup_taskset_for_each(p, css, tset) { cgroup_taskset_for_each(p, css, tset) {
void *v = (void *)(unsigned long)css->cgroup->id; void *v = (void *)(unsigned long)css->id;
task_lock(p); task_lock(p);
iterate_fd(p->files, 0, update_netprio, v); iterate_fd(p->files, 0, update_netprio, v);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment