From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Barnhill <0xeffeff@gmail.com> Subject: Re: [PATCH net v5] net/ipv6: Add anycast addresses to a global hashtable Date: Tue, 30 Oct 2018 07:10:58 -0400 Message-ID: References: <20181028015159.10636-1-0xeffeff@gmail.com> <20181029.203211.604037421868394185.davem@davemloft.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Cc: netdev@vger.kernel.org, Alexey Kuznetsov , yoshfuji@linux-ipv6.org To: davem@davemloft.net Return-path: Received: from mail-yw1-f67.google.com ([209.85.161.67]:36070 "EHLO mail-yw1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727381AbeJ3UE1 (ORCPT ); Tue, 30 Oct 2018 16:04:27 -0400 Received: by mail-yw1-f67.google.com with SMTP id h21-v6so4455623ywa.3 for ; Tue, 30 Oct 2018 04:11:25 -0700 (PDT) In-Reply-To: <20181029.203211.604037421868394185.davem@davemloft.net> Sender: netdev-owner@vger.kernel.org List-ID: I originally started implementing it the way you suggested; however, it seemed to complicate management of that structure because it isn't currently using rcu. Also, assuming that can be worked out, where would I get the net from? Would I need to store a copy in ifcaddr6, or is there some way to access it during ipv6_chk_acast_addr()? It seems that if I don't add a copy of net, but instead access it through aca_rt(?), then freeing the ifcaddr6 memory becomes problematic (detaching it from idev, while read_rcu may still be accessing it). On Mon, Oct 29, 2018 at 11:32 PM David Miller wrote: > > From: Jeff Barnhill <0xeffeff@gmail.com> > Date: Sun, 28 Oct 2018 01:51:59 +0000 > > > +struct ipv6_ac_addrlist { > > + struct in6_addr acal_addr; > > + possible_net_t acal_pnet; > > + refcount_t acal_users; > > + struct hlist_node acal_lst; /* inet6_acaddr_lst */ > > + struct rcu_head rcu; > > +}; > > Please just add the hlist to ifcaddr6 instead of duplicating so much > information and reference counters here. > > This seems to waste a lot of memory unnecessary and add lots of > unnecessary object allocate/setup/destroy logic.