public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public•gmane.org>
To: Daniel Borkmann <dborkman-H+wXaHxf7aLQT0dZR+AlfA@public•gmane.org>
Cc: pablo-Cap9r6Oaw4JrovVCs/uTlw@public•gmane.org,
	netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public•gmane.org,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public•gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public•gmane.org
Subject: Re: [PATCH nf-next] netfilter: xtables: lightweight process control group matching
Date: Mon, 07 Oct 2013 17:42:49 +0800	[thread overview]
Message-ID: <52528219.6000002@cn.fujitsu.com> (raw)
In-Reply-To: <52527C3E.1060004-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On 10/07/2013 05:17 PM, Daniel Borkmann wrote:
> On 10/07/2013 05:07 AM, Gao feng wrote:
>> On 10/05/2013 02:20 AM, Daniel Borkmann wrote:
>>> +static void cgroup_attach(struct cgroup_subsys_state *css,
>>> +              struct cgroup_taskset *tset)
>>> +{
>>> +    struct task_struct *p;
>>> +    void *v;
>>> +
>>> +    cgroup_taskset_for_each(p, css, tset) {
>>> +        task_lock(p);
>>> +        v = (void *)(unsigned long) task_fwid(p);
>>
>> Shouldn't v be css_nf_state(css)->fwid?
> 
> Nope, this is in line with net_cls and net_prio; the task has been
> moved there via cgroup backend already through cgroup_attach_task(),

Yes, these tasks have already been migrated to this cgroup.

> so we only need to update each of it's socket sk_cgrp_fwid parts.

Sorry, I still don't know in which situation that css_nf_state(css)->fwid
isn't equal to task_fwid(p).

two threads write the same pid to different cgroup at the same time?
it seems can not happen since we have cgroup_mutex protected.

> css is not strictly for net_filter. See also: 6a328d8c6f (cgroup:
> net_cls: Rework update socket logic)
> 
>>> +        iterate_fd(p->files, 0, cgroup_fwid_update, v);
>>> +        task_unlock(p);
>>> +    }
>>> +}
> 

  parent reply	other threads:[~2013-10-07  9:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-04 18:20 [PATCH nf-next] netfilter: xtables: lightweight process control group matching Daniel Borkmann
2013-10-07  3:07 ` Gao feng
2013-10-07  9:17   ` Daniel Borkmann
     [not found]     ` <52527C3E.1060004-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-10-07  9:42       ` Gao feng [this message]
2013-10-07 16:46 ` Tejun Heo
2013-10-08  8:05   ` Daniel Borkmann
     [not found]     ` <5253BCAE.5060409-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-10-09 17:04       ` Tejun Heo
2013-10-09 19:12         ` Daniel Borkmann
     [not found]         ` <20131009170409.GH22495-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2013-10-10 21:55           ` Daniel Borkmann
     [not found] ` <1380910855-12325-1-git-send-email-dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-10-18 23:21   ` Eric W. Biederman
     [not found]     ` <87li1qp3l8.fsf-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org>
2013-10-19  7:16       ` Daniel Borkmann
2013-10-21 15:09         ` Daniel Wagner
     [not found]           ` <526543A2.2040901-kQCPcA+X3s7YtjvyW6yDsg@public.gmane.org>
2013-10-21 15:48             ` Daniel Borkmann
2013-10-22  7:15               ` Ni, Xun
2013-10-22  7:42                 ` Daniel Borkmann
2013-10-22  7:45                 ` Daniel Wagner
     [not found]               ` <52654CE6.7030706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-10-22  7:36                 ` Daniel Wagner
     [not found] <cover.1382101225.git.dborkman@redhat.com>
2013-10-18 13:28 ` Daniel Borkmann
     [not found]   ` <ee0fb538d6e43e23d0488d3edd741de9c4589fb1.1382101225.git.dborkman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-11-05 13:03     ` Daniel Borkmann

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=52528219.6000002@cn.fujitsu.com \
    --to=gaofeng-bthxqxjhjhxqfuhtdcdx3a@public$(echo .)gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=dborkman-H+wXaHxf7aLQT0dZR+AlfA@public$(echo .)gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=netfilter-devel-u79uwXL29TY76Z2rM5mHXA@public$(echo .)gmane.org \
    --cc=pablo-Cap9r6Oaw4JrovVCs/uTlw@public$(echo .)gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public$(echo .)gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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