Re: [PATCH 6/7] sock, cgroup: add sock->sk_cgroup

From
Daniel Wagner <hidden>
Date
2015-11-20 11:04:15
Also in
cgroups, lkml, netfilter-devel
Reply to
Tejun Heo, 2015-11-19
Hi Tejun,

On 11/19/2015 07:52 PM, Tejun Heo wrote:
quoted hunk ↗ jump to hunk
+/*
+ * There's a theoretical window where the following accessors race with
+ * updaters and return part of the previous pointer as the prioidx or
+ * classid.  Such races are short-lived and the result isn't critical.
+ */
 static inline u16 sock_cgroup_prioidx(struct sock_cgroup_data *skcd)
 {
-	return skcd->prioidx;
+	return (skcd->is_data & 1) ? skcd->prioidx : 1;
 }
 
 static inline u32 sock_cgroup_classid(struct sock_cgroup_data *skcd)
 {
-	return skcd->classid;
+	return (skcd->is_data & 1) ? skcd->classid : 0;
 }

I still try to understand what the code does, hence this stupid question:

Why is sock_cgroup_prioidx() returning 1 if is not data and
sock_cgroup_classid() a 0?

thanks,
daniel
Thread (20 messages) 20 messages, 5 authors, last reply 2015-11-20
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help