From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752374AbdHPUOM (ORCPT ); Wed, 16 Aug 2017 16:14:12 -0400 Received: from omzsmtpe01.verizonbusiness.com ([199.249.25.210]:7358 "EHLO omzsmtpe01.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751847AbdHPUOK (ORCPT ); Wed, 16 Aug 2017 16:14:10 -0400 X-IronPort-Anti-Spam-Filtered: false From: "Levin, Alexander (Sasha Levin)" X-Host: discovery.odc.vzwcorp.com To: "davem@davemloft.net" CC: "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "xiyou.wangcong@gmail.com" Subject: Re: [PATCH v2] net: inet: diag: expose sockets cgroup classid Thread-Topic: [PATCH v2] net: inet: diag: expose sockets cgroup classid Thread-Index: AQHTBwPGYgrCD6uuWkq6E7+6M95EnqKH3w6A Date: Wed, 16 Aug 2017 20:13:02 +0000 Message-ID: <20170816201707.xbpquud3ar3uarst@sasha-lappy> References: <20170727181352.18547-1-alexander.levin@verizon.com> In-Reply-To: <20170727181352.18547-1-alexander.levin@verizon.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: NeoMutt/20170113 (1.7.2) x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.144.60.250] Content-Type: text/plain; charset="us-ascii" Content-ID: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by nfs id v7GKEFad007855 Ping? On Thu, Jul 27, 2017 at 02:13:52PM -0400, Sasha Levin wrote: >This is useful for directly looking up a task based on class id rather than >having to scan through all open file descriptors. > >Signed-off-by: Sasha Levin >--- > >Changes in V2: > - Addressed comments from Cong Wang (use nla_put_u32()) > > include/uapi/linux/inet_diag.h | 1 + > net/ipv4/inet_diag.c | 10 ++++++++++ > 2 files changed, 11 insertions(+) > >diff --git a/include/uapi/linux/inet_diag.h b/include/uapi/linux/inet_diag.h >index bbe201047df6..678496897a68 100644 >--- a/include/uapi/linux/inet_diag.h >+++ b/include/uapi/linux/inet_diag.h >@@ -142,6 +142,7 @@ enum { > INET_DIAG_PAD, > INET_DIAG_MARK, > INET_DIAG_BBRINFO, >+ INET_DIAG_CLASS_ID, > __INET_DIAG_MAX, > }; > >diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c >index 3828b3a805cd..2c2445d4bb58 100644 >--- a/net/ipv4/inet_diag.c >+++ b/net/ipv4/inet_diag.c >@@ -274,6 +274,16 @@ int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk, > goto errout; > } > >+ if (ext & (1 << (INET_DIAG_CLASS_ID - 1))) { >+ u32 classid = 0; >+ >+#ifdef CONFIG_SOCK_CGROUP_DATA >+ classid = sock_cgroup_classid(&sk->sk_cgrp_data); >+#endif >+ >+ nla_put_u32(skb, INET_DIAG_CLASS_ID, classid); >+ } >+ > out: > nlmsg_end(skb, nlh); > return 0; >-- >2.11.0 -- Thanks, Sasha