[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <507EBA59.9080307@intel.com>
Date: Wed, 17 Oct 2012 07:02:01 -0700
From: John Fastabend <john.r.fastabend@...el.com>
To: Daniel Wagner <wagi@...om.org>
CC: netdev@...r.kernel.org, cgroups@...r.kernel.org,
Daniel Wagner <daniel.wagner@...-carit.de>,
Li Zefan <lizefan@...wei.com>,
"David S. Miller" <davem@...emloft.net>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jamal Hadi Salim <jhs@...atatu.com>,
Joe Perches <joe@...ches.com>,
Neil Horman <nhorman@...driver.com>,
Stanislav Kinsbursky <skinsbursky@...allels.com>,
Tejun Heo <tj@...nel.org>
Subject: Re: [PATCH v0 4/4] cgroup: net_cls: Rework update socket logic
On 10/17/2012 6:04 AM, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner@...-carit.de>
>
> The cgroup logic part of net_cls is very similar as the one in
> net_prio. Let's stream line the net_cls logic with the net_prio one.
>
[...]
>
> +static void cgrp_attach(struct cgroup *cgrp, struct cgroup_taskset *tset)
> +{
> + struct task_struct *p;
> +
> + cgroup_taskset_for_each(p, cgrp, tset) {
> + unsigned int fd;
> + struct fdtable *fdt;
> + struct files_struct *files;
> +
> + task_lock(p);
> + files = p->files;
> + if (!files) {
> + task_unlock(p);
> + continue;
> + }
> +
> + spin_lock(&files->file_lock);
> + fdt = files_fdtable(files);
> + for (fd = 0; fd < fdt->max_fds; fd++) {
> + struct file *file;
> + struct socket *sock;
> + int err;
> +
> + file = fcheck_files(files, fd);
> + if (!file)
> + continue;
> +
> + sock = sock_from_file(file, &err);
> + if (sock)
> + sock_update_classid(sock->sk, p);
> + }
> + spin_unlock(&files->file_lock);
This block should probably use iterate_fd() instead of open coding
this. See the latest net_prio_attach().
.John
> + task_unlock(p);
> + }
> +}
> +
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists