RE: [NAK] Re: [PATCH] fs: Optimized fget to improve performance

2020-09-01 Thread David Laight
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 on

Re: [NAK] Re: [PATCH] fs: Optimized fget to improve performance

2020-08-30 Thread Al Viro
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 > competitio

Re: [NAK] Re: [PATCH] fs: Optimized fget to improve performance

2020-08-30 Thread Shaokun Zhang
Hi Al, 在 2020/8/27 22:28, Al Viro 写道: > On Thu, Aug 27, 2020 at 06:19:44PM +0800, Shaokun Zhang wrote: >> From: Yuqi Jin >> >> It is well known that the performance of atomic_add is better than that of >> atomic_cmpxchg. >> The initial value of @f_count is 1. While @f_count is increased by 1 in >

Re: [NAK] Re: [PATCH] fs: Optimized fget to improve performance

2020-08-28 Thread Will Deacon
On Thu, Aug 27, 2020 at 03:28:48PM +0100, Al Viro wrote: > On Thu, Aug 27, 2020 at 06:19:44PM +0800, Shaokun Zhang wrote: > > From: Yuqi Jin > > > > It is well known that the performance of atomic_add is better than that of > > atomic_cmpxchg. > > The initial value of @f_count is 1. While @f_coun

RE: [PATCH] fs: Optimized fget to improve performance

2020-08-27 Thread David Laight
From: Matthew Wilcox > Sent: 27 August 2020 13:31 > On Thu, Aug 27, 2020 at 06:19:44PM +0800, Shaokun Zhang wrote: > > From: Yuqi Jin > > > > 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. Especially sinc

[NAK] Re: [PATCH] fs: Optimized fget to improve performance

2020-08-27 Thread Al Viro
On Thu, Aug 27, 2020 at 06:19:44PM +0800, Shaokun Zhang wrote: > From: Yuqi Jin > > It is well known that the performance of atomic_add is better than that of > atomic_cmpxchg. > The initial value of @f_count is 1. While @f_count is increased by 1 in > __fget_files, it will go through three phase

Re: [PATCH] fs: Optimized fget to improve performance

2020-08-27 Thread Matthew Wilcox
On Thu, Aug 27, 2020 at 06:19:44PM +0800, Shaokun Zhang wrote: > From: Yuqi Jin > > 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) > +{

[PATCH] fs: Optimized fget to improve performance

2020-08-27 Thread Shaokun Zhang
From: Yuqi Jin It is well known that the performance of atomic_add is better than that of atomic_cmpxchg. The initial value of @f_count is 1. While @f_count is increased by 1 in __fget_files, it will go through three phases: > 0, < 0, and = 0. When the fixed value 0 is used as the condition for t