* [PATCH] io-wq: Remove unnecessary rcu_read_lock/unlock() in raw spinlock critical section
@ 2021-10-26 3:23 Zqiang
2021-10-26 10:32 ` Muchun Song
0 siblings, 1 reply; 4+ messages in thread
From: Zqiang @ 2021-10-26 3:23 UTC (permalink / raw)
To: axboe, asml.silence, io-uring; +Cc: linux-kernel, Zqiang
Due to raw_spin_lock/unlock() contains preempt_disable/enable() action,
already regarded as RCU critical region, so remove unnecessary
rcu_read_lock/unlock().
Signed-off-by: Zqiang <[email protected]>
---
fs/io-wq.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/fs/io-wq.c b/fs/io-wq.c
index cd88602e2e81..401be005d089 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -855,9 +855,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work)
io_wqe_insert_work(wqe, work);
clear_bit(IO_ACCT_STALLED_BIT, &acct->flags);
- rcu_read_lock();
do_create = !io_wqe_activate_free_worker(wqe, acct);
- rcu_read_unlock();
raw_spin_unlock(&wqe->lock);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] io-wq: Remove unnecessary rcu_read_lock/unlock() in raw spinlock critical section
2021-10-26 3:23 [PATCH] io-wq: Remove unnecessary rcu_read_lock/unlock() in raw spinlock critical section Zqiang
@ 2021-10-26 10:32 ` Muchun Song
2021-10-26 14:47 ` Jens Axboe
0 siblings, 1 reply; 4+ messages in thread
From: Muchun Song @ 2021-10-26 10:32 UTC (permalink / raw)
To: Zqiang; +Cc: Jens Axboe, asml.silence, io-uring, LKML
On Tue, Oct 26, 2021 at 11:23 AM Zqiang <[email protected]> wrote:
>
> Due to raw_spin_lock/unlock() contains preempt_disable/enable() action,
> already regarded as RCU critical region, so remove unnecessary
> rcu_read_lock/unlock().
>
> Signed-off-by: Zqiang <[email protected]>
> ---
> fs/io-wq.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/fs/io-wq.c b/fs/io-wq.c
> index cd88602e2e81..401be005d089 100644
> --- a/fs/io-wq.c
> +++ b/fs/io-wq.c
> @@ -855,9 +855,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work)
> io_wqe_insert_work(wqe, work);
> clear_bit(IO_ACCT_STALLED_BIT, &acct->flags);
>
> - rcu_read_lock();
Add a comment like:
/* spin_lock can serve as an RCU read-side critical section. */
With that.
Reviewed-by: Muchun Song <[email protected]>
Thanks.
> do_create = !io_wqe_activate_free_worker(wqe, acct);
> - rcu_read_unlock();
>
> raw_spin_unlock(&wqe->lock);
>
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io-wq: Remove unnecessary rcu_read_lock/unlock() in raw spinlock critical section
2021-10-26 10:32 ` Muchun Song
@ 2021-10-26 14:47 ` Jens Axboe
2021-10-27 7:06 ` Zqiang
0 siblings, 1 reply; 4+ messages in thread
From: Jens Axboe @ 2021-10-26 14:47 UTC (permalink / raw)
To: Muchun Song, Zqiang; +Cc: asml.silence, io-uring, LKML
On 10/26/21 4:32 AM, Muchun Song wrote:
> On Tue, Oct 26, 2021 at 11:23 AM Zqiang <[email protected]> wrote:
>>
>> Due to raw_spin_lock/unlock() contains preempt_disable/enable() action,
>> already regarded as RCU critical region, so remove unnecessary
>> rcu_read_lock/unlock().
>>
>> Signed-off-by: Zqiang <[email protected]>
>> ---
>> fs/io-wq.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/io-wq.c b/fs/io-wq.c
>> index cd88602e2e81..401be005d089 100644
>> --- a/fs/io-wq.c
>> +++ b/fs/io-wq.c
>> @@ -855,9 +855,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work)
>> io_wqe_insert_work(wqe, work);
>> clear_bit(IO_ACCT_STALLED_BIT, &acct->flags);
>>
>> - rcu_read_lock();
>
> Add a comment like:
> /* spin_lock can serve as an RCU read-side critical section. */
Note that it's a raw spinlock. Honestly I'd probably prefer if we just leave
it as-is. There are plans to improve the io-wq locking, and a rcu lock/unlock
is pretty cheap.
That said, if resend with a comment fully detailing why it's OK currently,
then I'd be fine with that as well.
--
Jens Axboe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] io-wq: Remove unnecessary rcu_read_lock/unlock() in raw spinlock critical section
2021-10-26 14:47 ` Jens Axboe
@ 2021-10-27 7:06 ` Zqiang
0 siblings, 0 replies; 4+ messages in thread
From: Zqiang @ 2021-10-27 7:06 UTC (permalink / raw)
To: Jens Axboe, Muchun Song; +Cc: asml.silence, io-uring, LKML
On 2021/10/26 下午10:47, Jens Axboe wrote:
> On 10/26/21 4:32 AM, Muchun Song wrote:
>> On Tue, Oct 26, 2021 at 11:23 AM Zqiang <[email protected]> wrote:
>>> Due to raw_spin_lock/unlock() contains preempt_disable/enable() action,
>>> already regarded as RCU critical region, so remove unnecessary
>>> rcu_read_lock/unlock().
>>>
>>> Signed-off-by: Zqiang <[email protected]>
>>> ---
>>> fs/io-wq.c | 2 --
>>> 1 file changed, 2 deletions(-)
>>>
>>> diff --git a/fs/io-wq.c b/fs/io-wq.c
>>> index cd88602e2e81..401be005d089 100644
>>> --- a/fs/io-wq.c
>>> +++ b/fs/io-wq.c
>>> @@ -855,9 +855,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work)
>>> io_wqe_insert_work(wqe, work);
>>> clear_bit(IO_ACCT_STALLED_BIT, &acct->flags);
>>>
>>> - rcu_read_lock();
>> Add a comment like:
>> /* spin_lock can serve as an RCU read-side critical section. */
> Note that it's a raw spinlock. Honestly I'd probably prefer if we just leave
> it as-is. There are plans to improve the io-wq locking, and a rcu lock/unlock
> is pretty cheap.
>
> That said, if resend with a comment fully detailing why it's OK currently,
> then I'd be fine with that as well.
>
Thanks Jens Axboe, Muchun
I will add a comment fully detailing and resend.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-27 7:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-26 3:23 [PATCH] io-wq: Remove unnecessary rcu_read_lock/unlock() in raw spinlock critical section Zqiang
2021-10-26 10:32 ` Muchun Song
2021-10-26 14:47 ` Jens Axboe
2021-10-27 7:06 ` Zqiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox