Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Tejun Heo <tj@kernel.org>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Namhyung Kim <namhyung@kernel.org>

+5 -5
+1 -1
include/net/netprio_cgroup.h
··· 26 26 27 27 rcu_read_lock(); 28 28 css = task_css(p, net_prio_cgrp_id); 29 - idx = css->cgroup->id; 29 + idx = css->id; 30 30 rcu_read_unlock(); 31 31 return idx; 32 32 }
+4 -4
net/core/netprio_cgroup.c
··· 93 93 static u32 netprio_prio(struct cgroup_subsys_state *css, struct net_device *dev) 94 94 { 95 95 struct netprio_map *map = rcu_dereference_rtnl(dev->priomap); 96 - int id = css->cgroup->id; 96 + int id = css->id; 97 97 98 98 if (map && id < map->priomap_len) 99 99 return map->priomap[id]; ··· 113 113 struct net_device *dev, u32 prio) 114 114 { 115 115 struct netprio_map *map; 116 - int id = css->cgroup->id; 116 + int id = css->id; 117 117 int ret; 118 118 119 119 /* avoid extending priomap for zero writes */ ··· 177 177 178 178 static u64 read_prioidx(struct cgroup_subsys_state *css, struct cftype *cft) 179 179 { 180 - return css->cgroup->id; 180 + return css->id; 181 181 } 182 182 183 183 static int read_priomap(struct seq_file *sf, void *v) ··· 237 237 struct cgroup_subsys_state *css; 238 238 239 239 cgroup_taskset_for_each(p, css, tset) { 240 - void *v = (void *)(unsigned long)css->cgroup->id; 240 + void *v = (void *)(unsigned long)css->id; 241 241 242 242 task_lock(p); 243 243 iterate_fd(p->files, 0, update_netprio, v);