On Sun, Apr 19, 2026 at 04:29:48AM -0600, Jonathan Corbet wrote: > Manuel Ebner <[email protected]> writes: > > > Update the documentation 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, gfp); > > ptr = kmalloc(sizeof(struct some_obj_name), gfp); > > -> ptr = kmalloc_obj(*ptr, gfp); > > ptr = kzalloc(sizeof(*ptr), gfp); > > -> ptr = kzalloc_obj(*ptr, gfp); > > ptr = kmalloc_array(count, sizeof(*ptr), gfp); > > -> ptr = kmalloc_objs(*ptr, count, gfp); > > ptr = kcalloc(count, sizeof(*ptr), gfp); > > -> ptr = kzalloc_objs(*ptr, count, gfp); > > > > Signed-off-by: Manuel Ebner <[email protected]> > > Just to be sure, did you write this patch yourself, or did you use some > sort of coding assistant? > > Adding Kees, who did this work and might have something to add here. > > > --- > > .../RCU/Design/Requirements/Requirements.rst | 6 +++--- > > Documentation/RCU/listRCU.rst | 2 +- > > Documentation/RCU/whatisRCU.rst | 4 ++-- > > This patch will surely need to be split up; the RCU folks, for example, > will want to evaluate the change separately. > > > Documentation/core-api/kref.rst | 4 ++-- > > Documentation/core-api/list.rst | 4 ++-- > > Documentation/core-api/memory-allocation.rst | 4 ++-- > > Documentation/driver-api/mailbox.rst | 4 ++-- > > Documentation/driver-api/media/v4l2-fh.rst | 2 +- > > Documentation/kernel-hacking/locking.rst | 4 ++-- > > Documentation/locking/locktypes.rst | 4 ++-- > > Documentation/process/coding-style.rst | 8 ++++---- > > .../sound/kernel-api/writing-an-alsa-driver.rst | 12 ++++++------ > > Documentation/spi/spi-summary.rst | 4 ++-- > > .../translations/it_IT/kernel-hacking/locking.rst | 4 ++-- > > .../translations/it_IT/locking/locktypes.rst | 4 ++-- > > .../translations/it_IT/process/coding-style.rst | 2 +- > > .../translations/sp_SP/process/coding-style.rst | 2 +- > > Documentation/translations/zh_CN/core-api/kref.rst | 4 ++-- > > .../translations/zh_CN/process/coding-style.rst | 2 +- > > .../zh_CN/video4linux/v4l2-framework.txt | 2 +- > > .../translations/zh_TW/process/coding-style.rst | 2 +- > > 21 files changed, 42 insertions(+), 42 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, GFP_KERNEL); > > So you have not gone with the "implicit GFP_KERNEL" approach that Linus > added. Given that, I assume, he wanted that to be the normal style, we > should probably go with it.
Thank you for updating the documentation! Yes, please drop the "default" GFP_KERNEL args in all these places. (Keep the non-GFP_KERNEL args; I see at least GFP_ATOMIC in the docs.) -- Kees Cook

