From: Matthew Wilcox <willy@infradead.org>
To: Shaokun Zhang <zhangshaokun@hisilicon.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Yuqi Jin <jinyuqi@huawei.com>, Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH] fs: Optimized fget to improve performance
Date: Thu, 27 Aug 2020 13:30:40 +0100 [thread overview]
Message-ID: <20200827123040.GE14765@casper.infradead.org> (raw)
In-Reply-To: <1598523584-25601-1-git-send-email-zhangshaokun@hisilicon.com>
On Thu, Aug 27, 2020 at 06:19:44PM +0800, Shaokun Zhang wrote:
> From: Yuqi Jin <jinyuqi@huawei.com>
>
> It is well known that the performance of atomic_add is better than that of
> atomic_cmpxchg.
I don't think that's well-known at all.
> +static inline bool get_file_unless_negative(atomic_long_t *v, long a)
> +{
> + long c = atomic_long_read(v);
> +
> + if (c <= 0)
> + return 0;
> +
> + return atomic_long_add_return(a, v) - 1;
> +}
> +
> #define get_file_rcu_many(x, cnt) \
> - atomic_long_add_unless(&(x)->f_count, (cnt), 0)
> + get_file_unless_negative(&(x)->f_count, (cnt))
> #define get_file_rcu(x) get_file_rcu_many((x), 1)
> #define file_count(x) atomic_long_read(&(x)->f_count)
I think you should be proposing a patch to fix atomic_long_add_unless()
on arm64 instead.
next prev parent reply other threads:[~2020-08-27 12:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-27 10:19 [PATCH] fs: Optimized fget to improve performance Shaokun Zhang
2020-08-27 12:30 ` Matthew Wilcox [this message]
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
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=20200827123040.GE14765@casper.infradead.org \
--to=willy@infradead.org \
--cc=jinyuqi@huawei.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
--cc=zhangshaokun@hisilicon.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox