Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Al Viro' <viro@zeniv.linux.org.uk>,
	Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Yuqi Jin <jinyuqi@huawei.com>,
	kernel test robot <rong.a.chen@intel.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Boqun Feng <boqun.feng@gmail.com>
Subject: RE: [NAK] Re: [PATCH] fs: Optimized fget to improve performance
Date: Tue, 1 Sep 2020 09:29:13 +0000	[thread overview]
Message-ID: <a12ae69f87e44c7f94cc5283ff55643a@AcuMS.aculab.com> (raw)
In-Reply-To: <20200831032127.GW1236603@ZenIV.linux.org.uk>

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)


      reply	other threads:[~2020-09-01  9:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27 10:19 Shaokun Zhang
2020-08-27 12:30 ` Matthew Wilcox
2020-08-27 13:07   ` David Laight
2020-08-27 14:28 ` [NAK] " Al Viro
2020-08-28 11:04   ` Will Deacon
2020-08-31  1:43   ` Shaokun Zhang
2020-08-31  3:21     ` Al Viro
2020-09-01  9:29       ` David Laight [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a12ae69f87e44c7f94cc5283ff55643a@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=boqun.feng@gmail.com \
    --cc=jinyuqi@huawei.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=peterz@infradead.org \
    --cc=rong.a.chen@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will@kernel.org \
    --cc=zhangshaokun@hisilicon.com \
    --subject='RE: [NAK] Re: [PATCH] fs: Optimized fget to improve performance' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).