linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: slub: make kobj_type structure constant
@ 2023-02-20 23:25 Thomas Weißschuh
  2023-02-22 11:25 ` Hyeonggon Yoo
  2023-03-13 16:21 ` Vlastimil Babka
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2023-02-20 23:25 UTC (permalink / raw)
  To: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Vlastimil Babka, Roman Gushchin, Hyeonggon Yoo
  Cc: linux-mm, linux-kernel, Thomas Weißschuh

Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.

Take advantage of this to constify the structure definition to prevent
modification at runtime.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 13459c69095a..be710dc4dc3e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -6058,7 +6058,7 @@ static const struct sysfs_ops slab_sysfs_ops = {
 	.store = slab_attr_store,
 };
 
-static struct kobj_type slab_ktype = {
+static const struct kobj_type slab_ktype = {
 	.sysfs_ops = &slab_sysfs_ops,
 	.release = kmem_cache_release,
 };

---
base-commit: 5b0ed5964928b0aaf0d644c17c886c7f5ea4bb3f
change-id: 20230220-kobj_type-mm-slub-02d25836de84

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>



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

* Re: [PATCH] mm: slub: make kobj_type structure constant
  2023-02-20 23:25 [PATCH] mm: slub: make kobj_type structure constant Thomas Weißschuh
@ 2023-02-22 11:25 ` Hyeonggon Yoo
  2023-03-13 16:21 ` Vlastimil Babka
  1 sibling, 0 replies; 3+ messages in thread
From: Hyeonggon Yoo @ 2023-02-22 11:25 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Christoph Lameter, Pekka Enberg, David Rientjes, Joonsoo Kim,
	Andrew Morton, Vlastimil Babka, Roman Gushchin, linux-mm,
	linux-kernel

On Mon, Feb 20, 2023 at 11:25:28PM +0000, Thomas Weißschuh wrote:
> Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
> the driver core allows the usage of const struct kobj_type.
> 
> Take advantage of this to constify the structure definition to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 13459c69095a..be710dc4dc3e 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -6058,7 +6058,7 @@ static const struct sysfs_ops slab_sysfs_ops = {
>  	.store = slab_attr_store,
>  };
>  
> -static struct kobj_type slab_ktype = {
> +static const struct kobj_type slab_ktype = {
>  	.sysfs_ops = &slab_sysfs_ops,
>  	.release = kmem_cache_release,
>  };
> 
> ---

Acked-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>

Thanks!

> base-commit: 5b0ed5964928b0aaf0d644c17c886c7f5ea4bb3f
> change-id: 20230220-kobj_type-mm-slub-02d25836de84
> 
> Best regards,
> -- 
> Thomas Weißschuh <linux@weissschuh.net>
> 


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

* Re: [PATCH] mm: slub: make kobj_type structure constant
  2023-02-20 23:25 [PATCH] mm: slub: make kobj_type structure constant Thomas Weißschuh
  2023-02-22 11:25 ` Hyeonggon Yoo
@ 2023-03-13 16:21 ` Vlastimil Babka
  1 sibling, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2023-03-13 16:21 UTC (permalink / raw)
  To: Thomas Weißschuh, Christoph Lameter, Pekka Enberg,
	David Rientjes, Joonsoo Kim, Andrew Morton, Roman Gushchin,
	Hyeonggon Yoo
  Cc: linux-mm, linux-kernel

On 2/21/23 00:25, Thomas Weißschuh wrote:
> Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
> the driver core allows the usage of const struct kobj_type.
> 
> Take advantage of this to constify the structure definition to prevent
> modification at runtime.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Thanks, added to slab/for-6.4/trivial

> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 13459c69095a..be710dc4dc3e 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -6058,7 +6058,7 @@ static const struct sysfs_ops slab_sysfs_ops = {
>  	.store = slab_attr_store,
>  };
>  
> -static struct kobj_type slab_ktype = {
> +static const struct kobj_type slab_ktype = {
>  	.sysfs_ops = &slab_sysfs_ops,
>  	.release = kmem_cache_release,
>  };
> 
> ---
> base-commit: 5b0ed5964928b0aaf0d644c17c886c7f5ea4bb3f
> change-id: 20230220-kobj_type-mm-slub-02d25836de84
> 
> Best regards,



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

end of thread, other threads:[~2023-03-13 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 23:25 [PATCH] mm: slub: make kobj_type structure constant Thomas Weißschuh
2023-02-22 11:25 ` Hyeonggon Yoo
2023-03-13 16:21 ` Vlastimil Babka

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