Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760878AbbKTTMu (ORCPT ); Fri, 20 Nov 2015 14:12:50 -0500 Received: from mail-yk0-f182.google.com ([209.85.160.182]:35838 "EHLO mail-yk0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbbKTTMr (ORCPT ); Fri, 20 Nov 2015 14:12:47 -0500 Date: Fri, 20 Nov 2015 14:12:28 -0500 From: Tejun Heo To: Daniel Wagner Cc: davem@davemloft.net, pablo@netfilter.org, kaber@trash.net, kadlec@blackhole.kfki.hu, lizefan@huawei.com, hannes@cmpxchg.org, netdev@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, daniel@iogearbox.net, nhorman@tuxdriver.com Subject: Re: [PATCH 6/7] sock, cgroup: add sock->sk_cgroup Message-ID: <20151120191228.GA28383@mtj.duckdns.org> References: <1447959171-20749-1-git-send-email-tj@kernel.org> <1447959171-20749-7-git-send-email-tj@kernel.org> <564EFE25.5000906@bmw-carit.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <564EFE25.5000906@bmw-carit.de> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1176 Lines: 36 Hello, Daniel. On Fri, Nov 20, 2015 at 12:04:05PM +0100, Daniel Wagner wrote: > > 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? I prolly should have added comments there. prioidx carries the cgroup ID on the hierarchy net_prio is attached to, so if nothing is configured, the default value would be the ID of the root cgroup which is always 1. For net_cls, the unconfigured default value is zero. Will refresh the patch with comments. Thanks. -- tejun -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/