From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [RFC PATCH] fs: use a sequence counter instead of file_lock in fd_install Date: Sat, 18 Apr 2015 00:02:52 +0100 Message-ID: <20150417230252.GE889@ZenIV.linux.org.uk> References: <20150416121628.GA20615@mguzik> <1429307216.7346.255.camel@edumazet-glaptop2.roam.corp.google.com> <20150417221646.GA15589@mguzik> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Eric Dumazet , Andrew Morton , "Paul E. McKenney" , Yann Droneaud , Konstantin Khlebnikov , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Mateusz Guzik Return-path: Content-Disposition: inline In-Reply-To: <20150417221646.GA15589@mguzik> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sat, Apr 18, 2015 at 12:16:48AM +0200, Mateusz Guzik wrote: > I would say this makes the use of seq counter impossible. Even if we > decided to fall back to a lock on retry, we cannot know what to do if > the slot is reserved - it very well could be that something called > close, and something else reserved the slot, so putting the file inside > could be really bad. In fact we would be putting a file for which we > don't have a reference anymore. > > However, not all hope is lost and I still think we can speed things up. > > A locking primitive which only locks stuff for current cpu and has > another mode where it locks stuff for all cpus would do the trick just > fine. I'm not a linux guy, quick search suggests 'lglock' would do what > I want. > > table reallocation is an extremely rare operation, so this should be > fine. It would take the lock 'globally' for given table. It would also mean percpu_alloc() for each descriptor table...