From: David Miller <davem@davemloft.net>
To: nhorman@tuxdriver.com
Cc: john.r.fastabend@intel.com, netdev@vger.kernel.org,
eric.dumazet@gmail.com, gaofeng@cn.fujitsu.com,
lizefan@huawei.com
Subject: Re: [net-next PATCH v1] net: netprio_cgroup: rework update socket logic
Date: Sun, 22 Jul 2012 12:44:30 -0700 (PDT) [thread overview]
Message-ID: <20120722.124430.1434387298248918593.davem@davemloft.net> (raw)
In-Reply-To: <20120721171854.GA6099@neilslaptop.think-freely.org>
From: Neil Horman <nhorman@tuxdriver.com>
Date: Sat, 21 Jul 2012 13:18:55 -0400
> On Sat, Jul 21, 2012 at 10:02:03AM -0700, John Fastabend wrote:
>> On 7/20/2012 7:00 PM, Neil Horman wrote:
>> >On Fri, Jul 20, 2012 at 01:39:25PM -0700, John Fastabend wrote:
>> >>Instead of updating the sk_cgrp_prioidx struct field on every send
>> >>this only updates the field when a task is moved via cgroup
>> >>infrastructure.
>> >>
>> >>This allows sockets that may be used by a kernel worker thread
>> >>to be managed. For example in the iscsi case today a user can
>> >>put iscsid in a netprio cgroup and control traffic will be sent
>> >>with the correct sk_cgrp_prioidx value set but as soon as data
>> >>is sent the kernel worker thread isssues a send and sk_cgrp_prioidx
>> >>is updated with the kernel worker threads value which is the
>> >>default case.
>> >>
>> >>It seems more correct to only update the field when the user
>> >>explicitly sets it via control group infrastructure. This allows
>> >>the users to manage sockets that may be used with other threads.
>> >>
>> >>Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>> >I like the idea, but IIRC last time we tried this I think it caused problems
>> >with processes that shared sockets. That is to say, if you have a parent and
>> >child process that dup an socket descriptior, and put them in separate cgroups,
>> >you get unpredictable results, as the socket gets assigned a priority based on
>> >the last processed that moved cgroups.
>> >
>> >Neil
>> >
>>
>> Shared sockets creates strange behavior as it exists today. If a dup
>> of the socket fd is created the private data is still shared right. So
>> in this case the sk_cgrp_prioidx value is going to get updated by both
>> threads and then it is a race to see what it happens to be set to in
>> the xmit path.
>>
>> With this patch at least the behavior is deterministic. Without it
>> I can create the above scenario but have no way to determine what the
>> skb priority will actually be set to.
>>
>> .John
>>
> Ok, I can buy that. Lets give this a try:
>
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
>
Applied.
prev parent reply other threads:[~2012-07-22 19:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-20 20:39 [net-next PATCH v1] net: netprio_cgroup: rework update socket logic John Fastabend
2012-07-21 2:00 ` Neil Horman
2012-07-21 17:02 ` John Fastabend
2012-07-21 17:18 ` Neil Horman
2012-07-22 19:44 ` David Miller [this message]
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=20120722.124430.1434387298248918593.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=gaofeng@cn.fujitsu.com \
--cc=john.r.fastabend@intel.com \
--cc=lizefan@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
/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).