Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp5873243imm; Tue, 12 Jun 2018 15:03:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKofGFFG+eKyASAqTSBLCkQiP6TlSsuugu1BaD/Yx9ULL7a0YpbMv+61Os9PdtSrtwR3fwS X-Received: by 2002:a17:902:5e3:: with SMTP id f90-v6mr2251337plf.175.1528841013954; Tue, 12 Jun 2018 15:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528841013; cv=none; d=google.com; s=arc-20160816; b=CUUJ6KxnU63WcJDwED+3Zz7k/J+8fYLMPJReaqKHe9SnITm7SWhtnmt7hdLWBszLrp RdFvdcIK/ZGXn25Cc35jjcySlIW63MYyNeHBGSsta9rll8In63s75W38YPNTpWWUhgxC mUSZQcI12Gf1eaBcab4EMN7EDzNiKkhjUoiWw1zXOBPs8KpnpVdZRVwphCdyIsf3m/91 46cw1bTLHtcB/l+zt7NyWizN76jUITrNWjsfAXp7NMcM1QPbv9HUag48mVUFA/BlN+pI iaFLgn3qQBXcTKYjRP/A+qL2hLexrhOZo84cJuuMTjZDS7wG1cD1GZNonq3wbvCzvbg9 AKDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from:arc-authentication-results; bh=G8EiKZUTeQODze0zTBhtjtH1UX8AYoFmcYilmWeAuSU=; b=AROoyhkVBI3xI4qVoa15COs3O5namOML61Uf4K1C0sYGAQuu7o01o8xR1MVI71zI0S 0n+idSiXmbmaUFYp3w+kxpMZ8zq96fzG2sROlbbHaCN3aUbmcRFFNDlB9frEvYv8nWNz GY4OMdg+eRpN8/U0I7Fvzb0w2z0XGU+BKVIp7CUNfSdcZhwUqTGCIc4Jplf9/vVUFJ1W lDOuNLomD+AHSKm2x2UBUf26VaoxhmCASRByIL1YgmHiOHtiD1ttk3qFf5o2nCP9g5Vf 1oHpM3X5a8qUhxacPlU8Y3vd68ppVcLC65NE2TFPrRQDvkFPZGwIrNECpUKBYSeWIbSP PIDA== 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 v12-v6si817334pgs.538.2018.06.12.15.03.19; Tue, 12 Jun 2018 15:03:33 -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 S934634AbeFLWCM (ORCPT + 99 others); Tue, 12 Jun 2018 18:02:12 -0400 Received: from mx2.suse.de ([195.135.220.15]:36021 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933912AbeFLWCL (ORCPT ); Tue, 12 Jun 2018 18:02:11 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 32084AF5F; Tue, 12 Jun 2018 22:02:10 +0000 (UTC) From: NeilBrown To: Linus Torvalds , trondmy@hammerspace.com, Paul McKenney Date: Wed, 13 Jun 2018 08:01:58 +1000 Cc: Linux Kernel Mailing List , Linux NFS Mailing List Subject: Re: [GIT PULL] Please pull NFS client changes for 4.18 In-Reply-To: References: Message-ID: <87vaanirzd.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain On Tue, Jun 12 2018, Linus Torvalds wrote: > Final note (for now) on this: I've merged the nfs code, but I really > am obviously not happy with these crazy random ad-hoc > cursor-not-cursor list games. > > Linus Hi Linus, thanks for merging the code despite your reservations. Yes, we could create a generic rcu-list cursor. I have given it some thought but didn't like the added complexity. As there were existing objects in the list that could be used as a cursor, that seemed to me to be the better solution. As you say, and cursor would need to be allocated from a slab, not on the stack. We could use a SLAB_TYPESAFE_BY_RCU and not need to use rcu to delay the freeing. The lsb in the next pointer of the cursor would be 1 to indicate the cursor. Any iteration of the list would need to look out for this flag. When found it would need to skip over any cursors to the next non-cursor, then repeat the skip and make sure it found the same non-cursor. This guards against the cursor moving while it is being examined. Any walk that needed to place a cursor would need to get an exclusive lock on the list from the start. This is more locking overhead than just grabbing the lock to optimistically take a reference on the "current" item which I did in the NFS patch. If the lists were normally short that might not be a problem. In this case the list can get quite long so the extra locking might be noticeable. Deleting objects from the list would need to be careful to preserve the flag bit, but that is the least difficult part. FYI I have an open proposal to improve the cursor used by rhashtable for rhashtable_walk - it sometimes needs to drop out of RCU in the middle of a bucket chain. In that case the chain is normally short (16 is considered so long that the hash must have been compromised) and I propose an insertion sort to keep the addresses of objects in numerical order. This way the address of the last object found can work as a stable cursor - we just search through the list until an object has a larger address. So my perspective is that while an rcu_cursor_list could be developed, I'm not sure it would always (or ever?) be the best solution to a given problem. I can turn these thoughts into a patch if you like and see what people think. Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlsgQtcACgkQOeye3VZi gbmz5RAAioOOcswDSiWP6oZywwC4s4LduFMli65WhiEeDoYFABnCVQi7fNzN2nGq puLVJ6dcD6lDnF0Jx/S0IhxNUslK4kW4J+wP6Zyh1YXzykZjdWXuPlhF08x7WexL 8Vfnzr20zkd0EOOMLTb35gJ8G1Iwf08u8bveAKONNBWu+Hu5+oGMzVRdTo7zMSnJ 3ExeN8t/16aA+J6aSeyqju0qZcugi4pRvY6aNB5o7w3nHOxfeh6dL7kDjNQs/GS2 sjcPbZkamKyTUhgeAbUrRPIFYmFoKCoM5zpjtuDV1ULureoDuznoxUlzy6WcpfI/ dhgz2xsL3npf6xx2SwUmlziGC9Wv+me3dW22mJevdEdra/OioU14SUzFhct2dCOy kN44rodufVxDcdMvcmRsQDfj1XamAscI5C06aToxDPrd6NNCTGJ/Ohn80Dc8rIz3 ZokLfp2taNHHW52EGbLRJHeALdD/miHcGBGTB9dp1Tg2lVH0vdkPtoNJ8hsDz3ba OyI09swWOoYjpoiEmGZUAf7AfhGL2+IPFlmzcMonhXF7McVKGU6kc1DWwqbwkazg eBv77JR1vLqnYDf7oD2QC3A8EDOMlYTvttB7vpzqFxMWcA+ZiVumXSoXYeTGImv/ xJoEch+7iIrDqRXwOi8HBXe8d/vKoTLMAlqNttr4ucbFArXs50k= =jDil -----END PGP SIGNATURE----- --=-=-=--