Linux RCU subsystem development
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Documentation: adopt new coding style of type-aware kmalloc-family
@ 2026-04-29  7:08 Manuel Ebner
  2026-04-29  7:23 ` [PATCH v4 2/3] Documentation: RCU: " Manuel Ebner
  2026-05-03 14:56 ` [PATCH v4 0/3] Documentation: " Jonathan Corbet
  0 siblings, 2 replies; 7+ messages in thread
From: Manuel Ebner @ 2026-04-29  7:08 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, linux-doc, Kees Cook
  Cc: linux-kernel, workflows, linux-sound, rcu, linux-media, linux-mm,
	Manuel Ebner

Update the documentation to reflect new type-aware kmalloc-family as
suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
and family")

 [v3] -> [v4]:
state the default argument in deprecated.rst [3/3]

 [v2] -> [v3]:
remove obvious wrong replacements in [1/3]
add Acked-by: Paul E. McKenney in [2/3]
change how to mark the optional argument in [3/3]
add recipants
 --cc="linux-mm@kvack.org"
 --to="Kees Cook"
 --cc="Geert Uytterhoeven"

 [v1] -> [v2]:
put RCU/* in a seperate patch [Patch 2/3]
Omit optional argument (GFP_KERNEL) as suggested by https://lwn.net/Articles/1062856/
deprecated.rst: change the argument gfp to optional [Patch 3/3]

Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v4 2/3] Documentation: RCU: adopt new coding style of type-aware kmalloc-family
  2026-04-29  7:08 [PATCH v4 0/3] Documentation: adopt new coding style of type-aware kmalloc-family Manuel Ebner
@ 2026-04-29  7:23 ` Manuel Ebner
  2026-04-29  8:01   ` Vlastimil Babka
  2026-04-30  0:56   ` SeongJae Park
  2026-05-03 14:56 ` [PATCH v4 0/3] Documentation: " Jonathan Corbet
  1 sibling, 2 replies; 7+ messages in thread
From: Manuel Ebner @ 2026-04-29  7:23 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, linux-doc, rcu
  Cc: Kees Cook, linux-mm, Paul E . McKenney, Manuel Ebner

Update Documentation/RCU/* to reflect new type-aware kmalloc-family
as suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
and family")

ptr = kmalloc(sizeof(*ptr), gfp);
 -> ptr = kmalloc_obj(*ptr);

Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
Acked-by: Paul E. McKenney <paulmck@kernel.org>
---
Acked-by see 
https://lore.kernel.org/linux-doc/7a49fee0-09c8-4a48-9506-d9172ef024b0@paulmck-laptop/

 Documentation/RCU/Design/Requirements/Requirements.rst | 6 +++---
 Documentation/RCU/listRCU.rst                          | 2 +-
 Documentation/RCU/whatisRCU.rst                        | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/Documentation/RCU/Design/Requirements/Requirements.rst b/Documentation/RCU/Design/Requirements/Requirements.rst
index b5cdbba3ec2e..faca5a9c8c12 100644
--- a/Documentation/RCU/Design/Requirements/Requirements.rst
+++ b/Documentation/RCU/Design/Requirements/Requirements.rst
@@ -206,7 +206,7 @@ non-\ ``NULL``, locklessly accessing the ``->a`` and ``->b`` fields.
 
        1 bool add_gp_buggy(int a, int b)
        2 {
-       3   p = kmalloc(sizeof(*p), GFP_KERNEL);
+       3   p = kmalloc_obj(*p);
        4   if (!p)
        5     return -ENOMEM;
        6   spin_lock(&gp_lock);
@@ -228,7 +228,7 @@ their rights to reorder this code as follows:
 
        1 bool add_gp_buggy_optimized(int a, int b)
        2 {
-       3   p = kmalloc(sizeof(*p), GFP_KERNEL);
+       3   p = kmalloc_obj(*p);
        4   if (!p)
        5     return -ENOMEM;
        6   spin_lock(&gp_lock);
@@ -264,7 +264,7 @@ shows an example of insertion:
 
        1 bool add_gp(int a, int b)
        2 {
-       3   p = kmalloc(sizeof(*p), GFP_KERNEL);
+       3   p = kmalloc_obj(*p);
        4   if (!p)
        5     return -ENOMEM;
        6   spin_lock(&gp_lock);
diff --git a/Documentation/RCU/listRCU.rst b/Documentation/RCU/listRCU.rst
index d8bb98623c12..48c7272a4ccc 100644
--- a/Documentation/RCU/listRCU.rst
+++ b/Documentation/RCU/listRCU.rst
@@ -276,7 +276,7 @@ The RCU version of audit_upd_rule() is as follows::
 
 		list_for_each_entry(e, list, list) {
 			if (!audit_compare_rule(rule, &e->rule)) {
-				ne = kmalloc(sizeof(*entry), GFP_ATOMIC);
+				ne = kmalloc_obj(*entry, GFP_ATOMIC);
 				if (ne == NULL)
 					return -ENOMEM;
 				audit_copy_rule(&ne->rule, &e->rule);
diff --git a/Documentation/RCU/whatisRCU.rst b/Documentation/RCU/whatisRCU.rst
index a1582bd653d1..770aab8ea36a 100644
--- a/Documentation/RCU/whatisRCU.rst
+++ b/Documentation/RCU/whatisRCU.rst
@@ -468,7 +468,7 @@ uses of RCU may be found in listRCU.rst and NMI-RCU.rst.
 		struct foo *new_fp;
 		struct foo *old_fp;
 
-		new_fp = kmalloc(sizeof(*new_fp), GFP_KERNEL);
+		new_fp = kmalloc_obj(*new_fp);
 		spin_lock(&foo_mutex);
 		old_fp = rcu_dereference_protected(gbl_foo, lockdep_is_held(&foo_mutex));
 		*new_fp = *old_fp;
@@ -570,7 +570,7 @@ The foo_update_a() function might then be written as follows::
 		struct foo *new_fp;
 		struct foo *old_fp;
 
-		new_fp = kmalloc(sizeof(*new_fp), GFP_KERNEL);
+		new_fp = kmalloc_obj(*new_fp);
 		spin_lock(&foo_mutex);
 		old_fp = rcu_dereference_protected(gbl_foo, lockdep_is_held(&foo_mutex));
 		*new_fp = *old_fp;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 2/3] Documentation: RCU: adopt new coding style of type-aware kmalloc-family
  2026-04-29  7:23 ` [PATCH v4 2/3] Documentation: RCU: " Manuel Ebner
@ 2026-04-29  8:01   ` Vlastimil Babka
  2026-04-30  0:56   ` SeongJae Park
  1 sibling, 0 replies; 7+ messages in thread
From: Vlastimil Babka @ 2026-04-29  8:01 UTC (permalink / raw)
  To: Manuel Ebner, Jonathan Corbet, Shuah Khan, linux-doc, rcu
  Cc: Kees Cook, linux-mm, Paul E . McKenney

On 4/29/26 09:23, Manuel Ebner wrote:
> Update Documentation/RCU/* to reflect new type-aware kmalloc-family
> as suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
> and family")
> 
> ptr = kmalloc(sizeof(*ptr), gfp);
>  -> ptr = kmalloc_obj(*ptr);
> 
> Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
> Acked-by: Paul E. McKenney <paulmck@kernel.org>

Acked-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 2/3] Documentation: RCU: adopt new coding style of type-aware kmalloc-family
  2026-04-29  7:23 ` [PATCH v4 2/3] Documentation: RCU: " Manuel Ebner
  2026-04-29  8:01   ` Vlastimil Babka
@ 2026-04-30  0:56   ` SeongJae Park
  1 sibling, 0 replies; 7+ messages in thread
From: SeongJae Park @ 2026-04-30  0:56 UTC (permalink / raw)
  To: Manuel Ebner
  Cc: SeongJae Park, Jonathan Corbet, Shuah Khan, linux-doc, rcu,
	Kees Cook, linux-mm, Paul E . McKenney

On Wed, 29 Apr 2026 09:23:21 +0200 Manuel Ebner <manuelebner@mailbox.org> wrote:

> Update Documentation/RCU/* to reflect new type-aware kmalloc-family
> as suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
> and family")
> 
> ptr = kmalloc(sizeof(*ptr), gfp);
>  -> ptr = kmalloc_obj(*ptr);

Shouldn't 'gfp' parameter be kept?

> 
> Signed-off-by: Manuel Ebner <manuelebner@mailbox.org>
> Acked-by: Paul E. McKenney <paulmck@kernel.org>

Other than the above,

Acked-by: SeongJae Park <sj@kernel.org>


Thanks,
SJ

[...]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/3] Documentation: adopt new coding style of type-aware kmalloc-family
  2026-04-29  7:08 [PATCH v4 0/3] Documentation: adopt new coding style of type-aware kmalloc-family Manuel Ebner
  2026-04-29  7:23 ` [PATCH v4 2/3] Documentation: RCU: " Manuel Ebner
@ 2026-05-03 14:56 ` Jonathan Corbet
  2026-05-03 15:47   ` Manuel Ebner
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Corbet @ 2026-05-03 14:56 UTC (permalink / raw)
  To: Manuel Ebner, Shuah Khan, linux-doc, Kees Cook
  Cc: linux-kernel, workflows, linux-sound, rcu, linux-media, linux-mm,
	Manuel Ebner

Manuel Ebner <manuelebner@mailbox.org> writes:

> Update the documentation to reflect new type-aware kmalloc-family as
> suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
> and family")

OK, I have applied this series.  While doing so, I restored the "gfp"
parameter in the changelog portion where it had been mistakenly removed.

Thanks,

jon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/3] Documentation: adopt new coding style of type-aware kmalloc-family
  2026-05-03 14:56 ` [PATCH v4 0/3] Documentation: " Jonathan Corbet
@ 2026-05-03 15:47   ` Manuel Ebner
  2026-05-03 15:51     ` Jonathan Corbet
  0 siblings, 1 reply; 7+ messages in thread
From: Manuel Ebner @ 2026-05-03 15:47 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, linux-doc, Kees Cook
  Cc: linux-kernel, workflows, linux-sound, rcu, linux-media, linux-mm

On Sun, 2026-05-03 at 08:56 -0600, Jonathan Corbet wrote:
> Manuel Ebner <manuelebner@mailbox.org> writes:
> 
> > Update the documentation to reflect new type-aware kmalloc-family as
> > suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
> > and family")
> 
> OK, I have applied this series.  While doing so, I restored the "gfp"
> parameter in the changelog portion where it had been mistakenly removed.

That's good, thanks.
I had two more changes lined up for v5 of this series:

-	ptr = kmalloc(sizeof(struct foo, gfp);
+	ptr = kmalloc(sizeof(struct foo), gfp);

and 

-The argument gfp is optional, the default value is GFP_KERNEL.
+The argument `gfp` is optional, the default value is `GFP_KERNEL`.

I don't know how to go forward with this.
please advice

Thanks
 Manuel

> Thanks,
> 
> jon




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v4 0/3] Documentation: adopt new coding style of type-aware kmalloc-family
  2026-05-03 15:47   ` Manuel Ebner
@ 2026-05-03 15:51     ` Jonathan Corbet
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Corbet @ 2026-05-03 15:51 UTC (permalink / raw)
  To: Manuel Ebner, Shuah Khan, linux-doc, Kees Cook
  Cc: linux-kernel, workflows, linux-sound, rcu, linux-media, linux-mm

Manuel Ebner <manuelebner@mailbox.org> writes:

> On Sun, 2026-05-03 at 08:56 -0600, Jonathan Corbet wrote:
>> Manuel Ebner <manuelebner@mailbox.org> writes:
>> 
>> > Update the documentation to reflect new type-aware kmalloc-family as
>> > suggested in commit 2932ba8d9c99 ("slab: Introduce kmalloc_obj()
>> > and family")
>> 
>> OK, I have applied this series.  While doing so, I restored the "gfp"
>> parameter in the changelog portion where it had been mistakenly removed.
>
> That's good, thanks.
> I had two more changes lined up for v5 of this series:
>
> -	ptr = kmalloc(sizeof(struct foo, gfp);
> +	ptr = kmalloc(sizeof(struct foo), gfp);
>
> and 
>
> -The argument gfp is optional, the default value is GFP_KERNEL.
> +The argument `gfp` is optional, the default value is `GFP_KERNEL`.
>
> I don't know how to go forward with this.
> please advice

Make a new patch on top of docs-next with the additional changes you
want to do.

Thanks,

jon

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-05-03 15:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-29  7:08 [PATCH v4 0/3] Documentation: adopt new coding style of type-aware kmalloc-family Manuel Ebner
2026-04-29  7:23 ` [PATCH v4 2/3] Documentation: RCU: " Manuel Ebner
2026-04-29  8:01   ` Vlastimil Babka
2026-04-30  0:56   ` SeongJae Park
2026-05-03 14:56 ` [PATCH v4 0/3] Documentation: " Jonathan Corbet
2026-05-03 15:47   ` Manuel Ebner
2026-05-03 15:51     ` Jonathan Corbet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox