netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cls_cgroup: Allow classifier cgroups to have their classid reset to 0
@ 2012-08-20 17:59 Neil Horman
  2012-08-24 16:41 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Neil Horman @ 2012-08-20 17:59 UTC (permalink / raw)
  To: netdev; +Cc: Neil Horman, David S. Miller

The network classifier cgroup initalizes each cgroups instance classid value to
0.  However, the sock_update_classid function only updates classid's in sockets
if the tasks cgroup classid is not zero, and if it differs from the current
classid.  The later check is to prevent cache line dirtying, but the former is
detrimental, as it prevents resetting a classid for a cgroup to 0.  While this
is not a common action, it has administrative usefulness (if the admin wants to
disable classification of a certain group temporarily for instance).

Easy fix, just remove the zero check.  Tested successfully by myself

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: "David S. Miller" <davem@davemloft.net>
---
 net/core/sock.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index 8f67ced..116786c 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1230,7 +1230,7 @@ void sock_update_classid(struct sock *sk)
 	rcu_read_lock();  /* doing current task, which cannot vanish. */
 	classid = task_cls_classid(current);
 	rcu_read_unlock();
-	if (classid && classid != sk->sk_classid)
+	if (classid != sk->sk_classid)
 		sk->sk_classid = classid;
 }
 EXPORT_SYMBOL(sock_update_classid);
-- 
1.7.7.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cls_cgroup: Allow classifier cgroups to have their classid reset to 0
  2012-08-20 17:59 [PATCH] cls_cgroup: Allow classifier cgroups to have their classid reset to 0 Neil Horman
@ 2012-08-24 16:41 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2012-08-24 16:41 UTC (permalink / raw)
  To: nhorman; +Cc: netdev

From: Neil Horman <nhorman@tuxdriver.com>
Date: Mon, 20 Aug 2012 13:59:10 -0400

> The network classifier cgroup initalizes each cgroups instance classid value to
> 0.  However, the sock_update_classid function only updates classid's in sockets
> if the tasks cgroup classid is not zero, and if it differs from the current
> classid.  The later check is to prevent cache line dirtying, but the former is
> detrimental, as it prevents resetting a classid for a cgroup to 0.  While this
> is not a common action, it has administrative usefulness (if the admin wants to
> disable classification of a certain group temporarily for instance).
> 
> Easy fix, just remove the zero check.  Tested successfully by myself
> 
> Signed-off-by: Neil Horman <nhorman@tuxdriver.com>

Applied to net-next, thanks Neil.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-24 16:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-20 17:59 [PATCH] cls_cgroup: Allow classifier cgroups to have their classid reset to 0 Neil Horman
2012-08-24 16:41 ` David Miller

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).