diff mbox series

docs/RCU: Add the missing rcu_read_unlock()

Message ID 20230610040608.6355-1-mmpgouride@gmail.com (mailing list archive)
State Superseded
Headers show
Series docs/RCU: Add the missing rcu_read_unlock() | expand

Commit Message

Alan Huang June 10, 2023, 4:06 a.m. UTC
We should exit the RCU read-side critical section before re-entering.

Signed-off-by: Alan Huang <mmpgouride@gmail.com>
---
 Documentation/RCU/rculist_nulls.rst | 1 +
 1 file changed, 1 insertion(+)

Comments

Paul E. McKenney June 12, 2023, 9:26 p.m. UTC | #1
On Sat, Jun 10, 2023 at 04:06:08AM +0000, Alan Huang wrote:
> We should exit the RCU read-side critical section before re-entering.
> 
> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
> ---
>  Documentation/RCU/rculist_nulls.rst | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst
> index 9a734bf54..4370ac864 100644
> --- a/Documentation/RCU/rculist_nulls.rst
> +++ b/Documentation/RCU/rculist_nulls.rst
> @@ -30,6 +30,7 @@ algorithms:
>    obj = lockless_lookup(key);
>    if (obj) {
>      if (!try_get_ref(obj)) // might fail for free objects
> +      rcu_read_unlock();

Good eyes!  But don't we also need a pair of braces?

						Thanx, Paul

>        goto begin;
>      /*
>      * Because a writer could delete object, and a writer could
> -- 
> 2.34.1
>
Alan Huang June 13, 2023, 12:59 a.m. UTC | #2
> 2023年6月13日 05:26,Paul E. McKenney <paulmck@kernel.org> 写道:
> 
> On Sat, Jun 10, 2023 at 04:06:08AM +0000, Alan Huang wrote:
>> We should exit the RCU read-side critical section before re-entering.
>> 
>> Signed-off-by: Alan Huang <mmpgouride@gmail.com>
>> ---
>> Documentation/RCU/rculist_nulls.rst | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst
>> index 9a734bf54..4370ac864 100644
>> --- a/Documentation/RCU/rculist_nulls.rst
>> +++ b/Documentation/RCU/rculist_nulls.rst
>> @@ -30,6 +30,7 @@ algorithms:
>>   obj = lockless_lookup(key);
>>   if (obj) {
>>     if (!try_get_ref(obj)) // might fail for free objects
>> +      rcu_read_unlock();
> 
> Good eyes!  But don't we also need a pair of braces?

Yeah! We need that. I have sent the v2.

Thanks,
Alan

> 
> Thanx, Paul
> 
>>       goto begin;
>>     /*
>>     * Because a writer could delete object, and a writer could
>> -- 
>> 2.34.1
diff mbox series

Patch

diff --git a/Documentation/RCU/rculist_nulls.rst b/Documentation/RCU/rculist_nulls.rst
index 9a734bf54..4370ac864 100644
--- a/Documentation/RCU/rculist_nulls.rst
+++ b/Documentation/RCU/rculist_nulls.rst
@@ -30,6 +30,7 @@  algorithms:
   obj = lockless_lookup(key);
   if (obj) {
     if (!try_get_ref(obj)) // might fail for free objects
+      rcu_read_unlock();
       goto begin;
     /*
     * Because a writer could delete object, and a writer could