Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp110250pxf; Wed, 10 Mar 2021 01:35:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxTO6B6LwwHqYCuaryZ8Li7eP1NLiv5xTPTD/vwtcsop1sIvuWYx6FWZh0nAeIYckugYrCc X-Received: by 2002:a05:6402:35d3:: with SMTP id z19mr2233966edc.143.1615368912750; Wed, 10 Mar 2021 01:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615368912; cv=none; d=google.com; s=arc-20160816; b=oZ1zPYPpfZICeZ0ixnEsfnRummNGoI7RNsnvheXmTw8sAoZIqPfZYPZrZs6yxvx7yL TKysKXgPSt3t3AxyMhQnPaGXSsQPIJsDk+fOb9yd8KbcyNXX5kUeaNT4kEDaap+W29Lp YUH7T2giJMn2w+HZ4MTg3J63i+xfZOwZ5iPuydKAihX0W/godwsj8w7v9R29P2aR5nAj e42GIk4veem20K0BDGoT0oKx3EV+J4nYFpuUpePdim3T+/RRChW8odW8wsR71IHetHp0 0LI6sjZtNo/zl1Bq5uqb4Ra89OtNqSAmDyNS/1rDvaoNz/FmevUUyLiLR6bB2ZpT3nr8 x2Kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=vkW7dLCGimkYX2CzPTx4Qe5cMxxP4BOyqzT0I/8V7/U=; b=H1gtFkREnGLkuwnYUadRJVyiQ2WLMq1d4PXRJRGbqDDg/BlsnIDnXIG5ITkV37stpL eA0zC4YWT4TG8SRF+TQa5QuZVbLiYw6aVA5c6eFjlIQEiOOGT7VHqzwe8zbEcFa5/8/L AotgLk4lI6j8+sbBwVDPfj5MHnNyQZxkDk4EF+Tgjt+lTA4GSfm8g9PiXyqjL1RbnBOd x0CdI0kDBHTckQUAzRCGmB4yqZoxTfTQn/PzXyiVkIqw91K7hiCNbsgFAQtHNksULxvB F0M2w+7PHt7ksMTZlEb39HrZgZuH+yGC8MjfNgh8aZw8P1QfblkO1KGdCEDJEUEPTjsW lgBQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x12si11712685edd.423.2021.03.10.01.34.50; Wed, 10 Mar 2021 01:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231139AbhCJJdx (ORCPT + 99 others); Wed, 10 Mar 2021 04:33:53 -0500 Received: from out30-57.freemail.mail.aliyun.com ([115.124.30.57]:58361 "EHLO out30-57.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232433AbhCJJdd (ORCPT ); Wed, 10 Mar 2021 04:33:33 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0URGK1KC_1615368810; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0URGK1KC_1615368810) by smtp.aliyun-inc.com(127.0.0.1); Wed, 10 Mar 2021 17:33:30 +0800 Date: Wed, 10 Mar 2021 17:33:29 +0800 From: Tony Lu To: Eric Dumazet Cc: davem@davemloft.net, rostedt@goodmis.org, mingo@redhat.com, Lorenz Bauer , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: add net namespace inode for all net_dev events Message-ID: Reply-To: Tony Lu References: <20210309044349.6605-1-tonylu@linux.alibaba.com> <203c49a3-6dd8-105e-e12a-0e15da0d4df7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <203c49a3-6dd8-105e-e12a-0e15da0d4df7@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 09, 2021 at 09:12:45PM +0100, Eric Dumazet wrote: > > > On 3/9/21 5:43 AM, Tony Lu wrote: > > There are lots of net namespaces on the host runs containers like k8s. > > It is very common to see the same interface names among different net > > namespaces, such as eth0. It is not possible to distinguish them without > > net namespace inode. > > > > This adds net namespace inode for all net_dev events, help us > > distinguish between different net devices. > > > > Output: > > -0 [006] ..s. 133.306989: net_dev_xmit: net_inum=4026531992 dev=eth0 skbaddr=0000000011a87c68 len=54 rc=0 > > > > Signed-off-by: Tony Lu > > --- > > > > There was a proposal from Lorenz to use netns cookies (SO_NETNS_COOKIE) instead. > > They have a guarantee of being not reused. > > After 3d368ab87cf6681f9 ("net: initialize net->net_cookie at netns setup") > net->net_cookie is directly available. It looks better to identify ns with net_cookie rather than inode, and get the value with NS_GET_COOKIE. I will switch net_inum to net_cookie in the next patch. Cheers, Tony Lu >