Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-24 Thread Jens Axboe
On 10/23/2017 07:25 PM, kemi wrote: > > > On 2017年10月24日 09:21, Andi Kleen wrote: >> kemi writes: >>> >>> I'll see if I can find some time to implement the above in a nice way. >>> >>> Agree. Maybe something like test_and_set_bit() would be more suitable. >> >>

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-24 Thread Jens Axboe
On 10/23/2017 07:25 PM, kemi wrote: > > > On 2017年10月24日 09:21, Andi Kleen wrote: >> kemi writes: >>> >>> I'll see if I can find some time to implement the above in a nice way. >>> >>> Agree. Maybe something like test_and_set_bit() would be more suitable. >> >> test_and_set_bit is a very

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread kemi
On 2017年10月24日 09:21, Andi Kleen wrote: > kemi writes: >> >> I'll see if I can find some >>> time to implement the above in a nice way. >> >> Agree. Maybe something like test_and_set_bit() would be more suitable. > > test_and_set_bit is a very different operation for the

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread kemi
On 2017年10月24日 09:21, Andi Kleen wrote: > kemi writes: >> >> I'll see if I can find some >>> time to implement the above in a nice way. >> >> Agree. Maybe something like test_and_set_bit() would be more suitable. > > test_and_set_bit is a very different operation for the CPU because > it is

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread Andi Kleen
kemi writes: > > I'll see if I can find some >> time to implement the above in a nice way. > > Agree. Maybe something like test_and_set_bit() would be more suitable. test_and_set_bit is a very different operation for the CPU because it is atomic for both. But we want the

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread Andi Kleen
kemi writes: > > I'll see if I can find some >> time to implement the above in a nice way. > > Agree. Maybe something like test_and_set_bit() would be more suitable. test_and_set_bit is a very different operation for the CPU because it is atomic for both. But we want the initial read to not be

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread kemi
On 2017年10月24日 00:19, Jens Axboe wrote: > On 10/23/2017 10:27 AM, Kemi Wang wrote: >> It's expensive to set buffer flags that are already set, because that >> causes a costly cache line transition. >> >> A common case is setting the "verified" flag during ext4 writes. >> This patch checks for

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread kemi
On 2017年10月24日 00:19, Jens Axboe wrote: > On 10/23/2017 10:27 AM, Kemi Wang wrote: >> It's expensive to set buffer flags that are already set, because that >> causes a costly cache line transition. >> >> A common case is setting the "verified" flag during ext4 writes. >> This patch checks for

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread Jens Axboe
On 10/23/2017 10:27 AM, Kemi Wang wrote: > It's expensive to set buffer flags that are already set, because that > causes a costly cache line transition. > > A common case is setting the "verified" flag during ext4 writes. > This patch checks for the flag being set first. > > With the

Re: [PATCH] buffer: Avoid setting buffer bits that are already set

2017-10-23 Thread Jens Axboe
On 10/23/2017 10:27 AM, Kemi Wang wrote: > It's expensive to set buffer flags that are already set, because that > causes a costly cache line transition. > > A common case is setting the "verified" flag during ext4 writes. > This patch checks for the flag being set first. > > With the