mm/slab: trivial fixup for SLAB_TYPESAFE_BY_RCU example code snippet
Subsystems (2)
v2 cover mm/slab: trivial fixup for SLAB_TYPESAFE_BY_RCU example code snippet
Changes from v1
(https://lore.kernel.org/linux-mm/[email protected]/)
- Update label (s/again/begin/) correctly (Matthew Wilcox)
- Add missed rcu_read_unlock()
This patchset is for trivial fixup for SLAB_TYPESAFE_BY_RCU example code snippet, namely adding missed semicolon and breaking RCU read-side critical section into smaller ones.
SeongJae Park (2):
mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
include/linux/slab.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/2 mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code
An example code snippet for SLAB_TYPESAFE_BY_RCU is missing a semicolon. Add it.
--- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/slab.h +1 -1
@@ -53,7 +53,7 @@* stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * -* rcu_read_lock() +* rcu_read_lock(); * again: * obj = lockless_lookup(key); * if (obj) {
Signature · 1 line
2.25.1
Re: [PATCH v2 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code
Quoted 4 lines · SeongJae Park
An example code snippet for
SLAB_TYPESAFE_BY_RCUis missing a semicolon. Add it.Signed-off-by SeongJae Park <[email protected]>
Or please let me know if you would like me to take it. (Probably better going up through the usual slab route, though.)
Thanx, Paul
Quoted 20 lines
--- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/slab.h +1
-1@@ -53,7 +53,7 @@* stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * -* rcu_read_lock() +* rcu_read_lock(); * again: * obj = lockless_lookup(key); * if (obj) { Signature · 1 line
2.25.1
Re: [PATCH v2 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code
Quoted 10 lines · Paul E. McKenney
Quoted 4 lines · SeongJae Park
An example code snippet for
SLAB_TYPESAFE_BY_RCUis missing a semicolon. Add it.Signed-off-by SeongJae Park <[email protected]>Reviewed-by Paul E. McKenney <[email protected]>Or please let me know if you would like me to take it. (Probably better going up through the usual slab route, though.)
Yeah will take it via slab after merge window, but was hoping you'd ack that (mainly 2/2) as indeed the correct example first.
Thanks, Vlastimil
Quoted 22 lines
Thanx, Paul
Quoted 20 lines
--- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/slab.h +1
-1@@ -53,7 +53,7 @@* stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * -* rcu_read_lock() +* rcu_read_lock(); * again: * obj = lockless_lookup(key); * if (obj) { Signature · 1 line
2.25.1
Re: [PATCH v2 1/2] mm/slab: add a missing semicolon on SLAB_TYPESAFE_BY_RCU example code
Quoted 7 lines · Vlastimil Babka
Quoted 6 lines · Paul E. McKenney
Quoted 4 lines · SeongJae Park
An example code snippet for
SLAB_TYPESAFE_BY_RCUis missing a semicolon. Add it.Signed-off-by SeongJae Park <[email protected]>
Quoted 7 lines
Quoted 4 lines
Reviewed-by Paul E. McKenney <[email protected]>Or please let me know if you would like me to take it. (Probably better going up through the usual slab route, though.)
Yeah will take it via slab after merge window, but was hoping you'd ack that (mainly 2/2) as indeed the correct example first.
You got it! ;-)
Thanx, Paul
Quoted 24 lines
Thanks, Vlastimil
Quoted 22 lines
Thanx, Paul
Quoted 20 lines
--- include/linux/slab.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linux/slab.h +1
-1@@ -53,7 +53,7 @@* stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * -* rcu_read_lock() +* rcu_read_lock(); * again: * obj = lockless_lookup(key); * if (obj) { Signature · 1 line
2.25.1
PATCH v2 2/2 mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
In reply to SeongJae ParkThe SLAB_TYPESAFE_BY_RCU example code snippet is having not tiny RCU read-side critical section. 'Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commit da82af04352b ("doc: Update and wordsmith rculist_nulls.rst") has broken it. Apply the change to SLAB_TYPESAFE_BY_RCU example code snippet, too.
--- include/linux/slab.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
include/linux/slab.h +5 -3
@@ -53,16 +53,18 @@* stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * +* begin: * rcu_read_lock(); -* again: * obj = lockless_lookup(key); * if (obj) { * if (!try_get_ref(obj)) // might fail for free objects -* goto again; +* rcu_read_unlock(); +* goto begin; * * if (obj->key != key) { // not the object we expected * put_ref(obj); -* goto again; +* rcu_read_unlock(); +* goto begin; * } * } * rcu_read_unlock();
Signature · 1 line
2.25.1
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
Quoted 5 lines · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCU read-side critical section. 'Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it. Apply the change toSLAB_TYPESAFE_BY_RCUexample code snippet, too.
so the page cache (eg find_get_entry()) does not follow this "split the RCU critical section" pattern. Should it? What's the benefit?
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
Quoted 9 lines · On Sat, 15 Apr 2023 04:49:44 +0100 Matthew Wilcox <[email protected]> wrote:
Quoted 5 lines · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCU read-side critical section. 'Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it. Apply the change toSLAB_TYPESAFE_BY_RCUexample code snippet, too.so the page cache (eg
find_get_entry()) does not follow this "split the RCU critical section" pattern. Should it? What's the benefit?
The benefit would be shorter RCU grace period that allows lower memory footprint, iiuc.
Whether it should split the section or not would depend on the lookup speed and number of retries, I think. If the total lookup takes a time that long enough to make the grace period too long and therefore the amount of RCU-protected objects that cannot freed due to the grace priod is huge, I think it would better to follow the pattern.
Thanks,
SJ
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
In reply to SeongJae ParkQuoted 1 line · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCU
Since "tiny RCU" means something quite specific in the RCU world, it can be confusing to read it in this sense. We could say e.g. "... snippet uses a single RCU read-side critical section for retries"?
Quoted 3 lines
read-side critical section. '
Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it.
"has broken it" has quite different meaning than "has broken it up" :) I guess we could just add the "up", unless someone has an even better wording.
Quoted 34 lines
Apply the change to
SLAB_TYPESAFE_BY_RCUexample code snippet, too.Signed-off-by SeongJae Park <[email protected]>--- include/linux/slab.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)include/linux/slab.h +5
-3@@ -53,16 +53,18 @@* stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * +* begin: * rcu_read_lock(); -* again: * obj = lockless_lookup(key); * if (obj) { * if (!try_get_ref(obj)) // might fail for free objects -* goto again; +* rcu_read_unlock(); +* goto begin; * * if (obj->key != key) { // not the object we expected * put_ref(obj); -* goto again; +* rcu_read_unlock(); +* goto begin; * } * } * rcu_read_unlock();
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
Hi Vlastimil,
Quoted 6 lines · On Mon, 17 Apr 2023 13:05:40 +0200 Vlastimil Babka <[email protected]> wrote:
Quoted 1 line · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCUSince "tiny RCU" means something quite specific in the RCU world, it can be confusing to read it in this sense. We could say e.g. "... snippet uses a single RCU read-side critical section for retries"?
Looks much better, thank you for this suggestion!
Quoted 7 lines
Quoted 4 lines
read-side critical section. '
Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it."has broken it" has quite different meaning than "has broken it up" :) I guess we could just add the "up", unless someone has an even better wording.
Good point, thank you for your suggestion!
I will apply above suggestion on the next spin.
Thanks,
SJ
Quoted 36 lines
Quoted 35 lines
Apply the change to
SLAB_TYPESAFE_BY_RCUexample code snippet, too.Signed-off-by SeongJae Park <[email protected]>--- include/linux/slab.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)include/linux/slab.h +5
-3@@ -53,16 +53,18 @@* stays valid, the trick to using this is relying on an independent * object validation pass. Something like: * +* begin: * rcu_read_lock(); -* again: * obj = lockless_lookup(key); * if (obj) { * if (!try_get_ref(obj)) // might fail for free objects -* goto again; +* rcu_read_unlock(); +* goto begin; * * if (obj->key != key) { // not the object we expected * put_ref(obj); -* goto again; +* rcu_read_unlock(); +* goto begin; * } * } * rcu_read_unlock();
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
Quoted 18 lines · SeongJae Park
Hi Vlastimil,
Quoted 6 lines · On Mon, 17 Apr 2023 13:05:40 +0200 Vlastimil Babka <[email protected]> wrote:
Quoted 1 line · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCUSince "tiny RCU" means something quite specific in the RCU world, it can be confusing to read it in this sense. We could say e.g. "... snippet uses a single RCU read-side critical section for retries"?
Looks much better, thank you for this suggestion!
Quoted 5 lines
Quoted 4 lines
read-side critical section. '
Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it.
Quoted 6 lines
Quoted 2 lines
"has broken it" has quite different meaning than "has broken it up" :) I guess we could just add the "up", unless someone has an even better wording.
Good point, thank you for your suggestion!
I will apply above suggestion on the next spin.
For the last one, perhaps changing the tense would have more clarity:
similar example code snippet, and commit da82af04352b ("doc: Update and wordsmith rculist_nulls.rst") broke it up.
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
Quoted 22 lines · On Mon, 17 Apr 2023 18:53:24 +0100 Matthew Wilcox <[email protected]> wrote:
Quoted 21 lines · SeongJae Park
Hi Vlastimil,
Quoted 6 lines · On Mon, 17 Apr 2023 13:05:40 +0200 Vlastimil Babka <[email protected]> wrote:
Quoted 1 line · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCUSince "tiny RCU" means something quite specific in the RCU world, it can be confusing to read it in this sense. We could say e.g. "... snippet uses a single RCU read-side critical section for retries"?
Looks much better, thank you for this suggestion!
Quoted 7 lines
Quoted 4 lines
read-side critical section. '
Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it."has broken it" has quite different meaning than "has broken it up" :) I guess we could just add the "up", unless someone has an even better wording.
Quoted 8 lines
Quoted 3 lines
Good point, thank you for your suggestion!
I will apply above suggestion on the next spin.
For the last one, perhaps changing the tense would have more clarity:
similar example code snippet, and commit
da82af04352b("doc: Update and wordsmithrculist_nulls.rst") broke it up.
Thank you for this suggestion, Matthew! Will send a new version.
Thanks,
SJ
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
Quoted 26 lines · SeongJae Park
Quoted 24 lines · On Mon, 17 Apr 2023 18:53:24 +0100 Matthew Wilcox <[email protected]> wrote:
Quoted 23 lines · SeongJae Park
Hi Vlastimil,
Quoted 6 lines · On Mon, 17 Apr 2023 13:05:40 +0200 Vlastimil Babka <[email protected]> wrote:
Quoted 1 line · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCUSince "tiny RCU" means something quite specific in the RCU world, it can be confusing to read it in this sense. We could say e.g. "... snippet uses a single RCU read-side critical section for retries"?
Looks much better, thank you for this suggestion!
Quoted 7 lines
Quoted 4 lines
read-side critical section. '
Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it."has broken it" has quite different meaning than "has broken it up" :) I guess we could just add the "up", unless someone has an even better wording.
Good point, thank you for your suggestion!
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I will apply above suggestion on the next spin.
For the last one, perhaps changing the tense would have more clarity:
similar example code snippet, and commit
da82af04352b("doc: Update and wordsmithrculist_nulls.rst") broke it up.Thank you for this suggestion, Matthew! Will send a new version.
It's ok, I can just use that when picking the patches up without a new resend.
Quoted 2 lines
Thanks,
SJ
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
Quoted 29 lines · On Mon, 17 Apr 2023 21:02:22 +0200 Vlastimil Babka <[email protected]> wrote:
Quoted 28 lines · SeongJae Park
Quoted 26 lines · On Mon, 17 Apr 2023 18:53:24 +0100 Matthew Wilcox <[email protected]> wrote:
Quoted 24 lines · SeongJae Park
Hi Vlastimil,
Quoted 6 lines · On Mon, 17 Apr 2023 13:05:40 +0200 Vlastimil Babka <[email protected]> wrote:
Quoted 1 line · SeongJae Park
The
SLAB_TYPESAFE_BY_RCUexample code snippet is having not tiny RCUSince "tiny RCU" means something quite specific in the RCU world, it can be confusing to read it in this sense. We could say e.g. "... snippet uses a single RCU read-side critical section for retries"?
Looks much better, thank you for this suggestion!
Quoted 7 lines
Quoted 4 lines
read-side critical section. '
Documentation/RCU/rculist_nulls.rst' has similar example code snippet, and commitda82af04352b("doc: Update and wordsmithrculist_nulls.rst") has broken it."has broken it" has quite different meaning than "has broken it up" :) I guess we could just add the "up", unless someone has an even better wording.
Good point, thank you for your suggestion!
I will apply above suggestion on the next spin.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
For the last one, perhaps changing the tense would have more clarity:
similar example code snippet, and commit
da82af04352b("doc: Update and wordsmithrculist_nulls.rst") broke it up.Thank you for this suggestion, Matthew! Will send a new version.
It's ok, I can just use that when picking the patches up without a new resend.
Sorry, already sent[1]... Please use or ignore it on your convenience.
[1] https://lore.kernel.org/linux-mm/[email protected]/
Thanks,
SJ
Quoted 4 lines
Quoted 3 lines
Thanks,
SJ
Re: [PATCH v2 2/2] mm/slab: break up RCU readers on SLAB_TYPESAFE_BY_RCU example code
In reply to SeongJae ParkQuoted 1 line · SeongJae Park
Thank you for this suggestion, Matthew! Will send a new version.
Please wait 24 hours between sending new versions. Give discussion some time to happen.