From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754038AbcCHHFv (ORCPT ); Tue, 8 Mar 2016 02:05:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:60003 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753483AbcCHHFs (ORCPT ); Tue, 8 Mar 2016 02:05:48 -0500 Date: Tue, 8 Mar 2016 08:05:44 +0100 From: Michal Kubecek To: Cong Wang Cc: "David S. Miller" , Linux Kernel Network Developers , LKML , Alexey Kuznetsov , James Morris , Hideaki YOSHIFUJI , Patrick McHardy , Hannes Frederic Sowa , Martin KaFai Lau Subject: Re: [PATCH net-next 2/3] ipv6: per netns fib6 walkers Message-ID: <20160308070544.GA8710@unicorn.suse.cz> References: <6df8e224d6337b658a097ac87e72e1467cddf13d.1457085016.git.mkubecek@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 07, 2016 at 04:28:26PM -0800, Cong Wang wrote: > On Mon, Mar 7, 2016 at 4:26 PM, Cong Wang wrote: > > On Fri, Mar 4, 2016 at 2:59 AM, Michal Kubecek wrote: > >> static void ipv6_route_seq_setup_walk(struct ipv6_route_iter *iter) > >> { > >> +#ifdef CONFIG_NET_NS > >> + struct net *net = iter->p.net; > >> +#else > >> + struct net *net = &init_net; > >> +#endif > >> + > > > > You should pass the struct net pointer to ipv6_route_seq_setup_walk() > > instead of reading it by yourself. I considered this. While it probably wouldn't bring any extra overhead as the function is going to be inlined anyway, it didn't look really nice. I gues I'll use read_pnet() as David suggested; I just didn't realize the reason it's a macro in !CONFIG_NET_NS case is to allow passing a pointer to non-existent struct member. > > I don't find anyone actually using iter->p, it probably can be just removed. > > Er, seq_file_net() uses it... but callers already call it. Not only seq_file_net(). The whole infrastructure assumes private data start with an instance of struct seq_net_private and seq_open_net() initializes it. Michal Kubecek