[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a12ae69f87e44c7f94cc5283ff55643a@AcuMS.aculab.com>
Date: Tue, 1 Sep 2020 09:29:13 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Al Viro' <viro@...iv.linux.org.uk>,
Shaokun Zhang <zhangshaokun@...ilicon.com>
CC: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Yuqi Jin <jinyuqi@...wei.com>,
kernel test robot <rong.a.chen@...el.com>,
Will Deacon <will@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Peter Zijlstra <peterz@...radead.org>,
Boqun Feng <boqun.feng@...il.com>
Subject: RE: [NAK] Re: [PATCH] fs: Optimized fget to improve performance
From: Al Viro
> Sent: 31 August 2020 04:21
>
> On Mon, Aug 31, 2020 at 09:43:31AM +0800, Shaokun Zhang wrote:
>
> > How about this? We try to replace atomic_cmpxchg with atomic_add to improve
> > performance. The atomic_add does not check the current f_count value.
> > Therefore, the number of online CPUs is reserved to prevent multi-core
> > competition.
>
> No. Really, really - no. Not unless you can guarantee that process on another
> CPU won't lose its timeslice, ending up with more than one increment happening on
> the same CPU - done by different processes scheduled there, one after another.
>
> If you have some change of atomic_long_add_unless(), do it there. And get it
> past the arm64 folks. get_file_rcu() is nothing special in that respect *AND*
> it has to cope with any architecture out there.
>
> BTW, keep in mind that there's such thing as a KVM - race windows are much
> wider there, since a thread representing a guest CPU might lose its timeslice
> whenever the host feels like that. At which point you get a single instruction
> on a guest CPU taking longer than many thousands of instructions on another
> CPU of the same guest.
The same thing can happen if a hardware interrupt occurs.
Not only the delays for the interrupt itself, but all the softint
processing that happens as well.
That can take a long time - even milliseconds.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists