Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp764567imm; Fri, 1 Jun 2018 09:08:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLFaNM+fUMygyUVVgSx71FtwdGMmctFNlh0RvVjsBf2Gcf32CD9DIepiSckkoUDBmUaKIlz X-Received: by 2002:a62:50d6:: with SMTP id g83-v6mr11375897pfj.31.1527869284769; Fri, 01 Jun 2018 09:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527869284; cv=none; d=google.com; s=arc-20160816; b=yR+IdMF3zl70bZRoqh0Mfm0Tfhc5FSQCb7891IQgsTGPmoKgAJn9/1l/EEJNmnjpzd Ww4LvqAa2xU2O9iS7cZZ83fKZhJvv1TNdUJRUxTCCqOd/Bxe61qtHrmkHLmfD35TG6Pi 7ADT5mB2ZXidl41xplR1FMDJWTclPniooqr8vUc1NF6S4VoDba7QjiJFEQGB+eHFHIBh zZxeDJdcPNlGGZkKSxVk3/EqqoHM03PLz3m59/tAhoM4OHR5Hn7fnNK21tPLZgaI8nwh sJu17+gMs600ejHgXPxKW9akuyozq/soTRTvA0tc3XqpCs+9zCrd5njaZkUNpGosyRX6 Pz2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ajwtlcPXNuNw9mNfLtNzX3C2/6aXJPGYtIzZyDcWoX0=; b=d1c7oz4kHrcB0UjPy1eloTswv/kGBlhQtYUKRIECiF964zIO7EJfpCy2jYqa8U7OvK VVea9BFIFhrpwK2gjTHRffwFUMMey1fffugAKQGnyl/s3FdY+Sde7xE2XU9NBO5NEjq2 zz8ZA0m4twpx8INfiGmFTyO2lN9NHl8dCwI8X7i5X7oL+KtQP8hsDrLINU4Hue+WtZ46 eC6ggbbw/X6NXwhCa635py9sqdJ41p+ILg1RnxMJ4iV/YvNYbiPYSqHzd8hzllLBVYny RRL/aVtzBMCOtKabiFMGzeEOXiEW9NgiEB6jeAjI7i5kWD0iUN+BsfznwVBtEw7E3WxH HY7w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj6-v6si39523951plb.405.2018.06.01.09.07.50; Fri, 01 Jun 2018 09:08:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753175AbeFAQGZ (ORCPT + 99 others); Fri, 1 Jun 2018 12:06:25 -0400 Received: from orcrist.hmeau.com ([104.223.48.154]:58016 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150AbeFAQGX (ORCPT ); Fri, 1 Jun 2018 12:06:23 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1fOmZF-0003JO-Ow; Sat, 02 Jun 2018 00:06:17 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1fOmZB-0000qE-FU; Sat, 02 Jun 2018 00:06:13 +0800 Date: Sat, 2 Jun 2018 00:06:13 +0800 From: Herbert Xu To: NeilBrown Cc: Thomas Graf , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Dumazet , "David S. Miller" Subject: Re: [PATCH 04/18] rhashtable: detect when object movement might have invalidated a lookup Message-ID: <20180601160613.7ud25g2ux55k3bma@gondor.apana.org.au> References: <152782754287.30340.4395718227884933670.stgit@noble> <152782824943.30340.8224535954517915320.stgit@noble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152782824943.30340.8224535954517915320.stgit@noble> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 01, 2018 at 02:44:09PM +1000, NeilBrown wrote: > Some users of rhashtable might need to change the key > of an object and move it to a different location in the table. > Other users might want to allocate objects using > SLAB_TYPESAFE_BY_RCU which can result in the same memory allocation > being used for a different (type-compatible) purpose and similarly > end up in a different hash-chain. > > To support these, we store a unique NULLS_MARKER at the end of > each chain, and when a search fails to find a match, we check > if the NULLS marker found was the expected one. If not, > the search is repeated. > > The unique NULLS_MARKER is derived from the address of the > head of the chain. Yes I thinks makes a lot more sense than the existing rhashtable nulls code. The current rhashtable nulls code harkens back to the time of the old rhashtable implementation where the same chain existed in two different tables and that is no longer the case. > If an object is removed and re-added to the same hash chain, we won't > notice by looking that the NULLS marker. In this case we must be sure This is not currently required by TCP/UDP. I'd rather not add extra constraints that aren't actually used. The only requirement for nulls is to allow sockets to float from the listening table to the established table within one RCU grace period. There is no shuttling back and forth, i.e., the only exit path for a socket in the established table is to be freed at the end of the RCU grace period. Adding Eric/Dave to the cc list in case they do/will need such a functionality. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt