From: John Fastabend <john.r.fastabend-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Daniel Wagner <wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Daniel Wagner
<daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>,
Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
"Michael S. Tsirkin"
<mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Jamal Hadi Salim <jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org>,
Joe Perches <joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org>,
Neil Horman <nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org>,
Stanislav Kinsbursky
<skinsbursky-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org>,
Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH v0 4/4] cgroup: net_cls: Rework update socket logic
Date: Wed, 17 Oct 2012 07:02:01 -0700 [thread overview]
Message-ID: <507EBA59.9080307@intel.com> (raw)
In-Reply-To: <1350479078-29361-5-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
On 10/17/2012 6:04 AM, Daniel Wagner wrote:
> From: Daniel Wagner <daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org>
>
> 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);
> + }
> +}
> +
next prev parent reply other threads:[~2012-10-17 14:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-17 13:04 [PATCH v0 0/4] Rework net_cls update socket logic Daniel Wagner
[not found] ` <1350479078-29361-1-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-10-17 13:04 ` [PATCH v0 1/4] cgroup: net_prio: Mark local used function static Daniel Wagner
2012-10-17 13:04 ` [PATCH v0 2/4] cgroup: net_cls: Fix local variable type decleration Daniel Wagner
2012-10-17 13:04 ` [PATCH v0 4/4] cgroup: net_cls: Rework update socket logic Daniel Wagner
[not found] ` <1350479078-29361-5-git-send-email-wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-10-17 14:02 ` John Fastabend [this message]
[not found] ` <507EBA59.9080307-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2012-10-17 15:56 ` Daniel Wagner
2012-10-17 13:04 ` [PATCH v0 3/4] cgroup: net_cls: Pass in task to sock_update_classid() Daniel Wagner
2012-10-17 13:37 ` Eric Dumazet
2012-10-17 15:54 ` Daniel Wagner
[not found] ` <507ED4C0.7070408-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2012-10-17 16:15 ` Eric Dumazet
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=507EBA59.9080307@intel.com \
--to=john.r.fastabend-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=daniel.wagner-98C5kh4wR6ohFhg+JK9F0w@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=jhs-jkUAjuhPggJWk0Htik3J/w@public.gmane.org \
--cc=joe-6d6DIl74uiNBDgjK7y7TUQ@public.gmane.org \
--cc=lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org \
--cc=mst-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=nhorman-2XuSBdqkA4R54TAoqtyWWQ@public.gmane.org \
--cc=skinsbursky-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=wagi-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.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;
as well as URLs for NNTP newsgroup(s).