linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/slub: helper macro __ATTR_XX to make code more clear
@ 2022-03-06  7:38 Lianjie Zhang
  2022-03-06 22:11 ` David Rientjes
  0 siblings, 1 reply; 3+ messages in thread
From: Lianjie Zhang @ 2022-03-06  7:38 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Pekka Enberg, David Rientjes, Joonsoo Kim, Andrew Morton,
	Vlastimil Babka, Roman Gushchin, linux-mm, linux-kernel,
	Lianjie Zhang

Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>

diff --git a/mm/slub.c b/mm/slub.c
index 07cdd999c3fe..59992de7d3db 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5358,12 +5358,10 @@ struct slab_attribute {
 };

 #define SLAB_ATTR_RO(_name) \
-	static struct slab_attribute _name##_attr = \
-	__ATTR(_name, 0400, _name##_show, NULL)
+	static struct slab_attribute _name##_attr = __ATTR_RO_MODE(_name, 0400)

 #define SLAB_ATTR(_name) \
-	static struct slab_attribute _name##_attr =  \
-	__ATTR(_name, 0600, _name##_show, _name##_store)
+	static struct slab_attribute _name##_attr = __ATTR_RW_MODE(_name, 0600)

 static ssize_t slab_size_show(struct kmem_cache *s, char *buf)
 {
--
2.20.1





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

* Re: [PATCH] mm/slub: helper macro __ATTR_XX to make code more clear
  2022-03-06  7:38 [PATCH] mm/slub: helper macro __ATTR_XX to make code more clear Lianjie Zhang
@ 2022-03-06 22:11 ` David Rientjes
  2022-03-07 17:11   ` Vlastimil Babka
  0 siblings, 1 reply; 3+ messages in thread
From: David Rientjes @ 2022-03-06 22:11 UTC (permalink / raw)
  To: Lianjie Zhang
  Cc: Christoph Lameter, Pekka Enberg, Joonsoo Kim, Andrew Morton,
	Vlastimil Babka, Roman Gushchin, linux-mm, linux-kernel

On Sun, 6 Mar 2022, Lianjie Zhang wrote:

> Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>

And VERIFY_OCTAL_PERMISSIONS() can help validate any future change.

Acked-by: David Rientjes <rientjes@google.com>


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

* Re: [PATCH] mm/slub: helper macro __ATTR_XX to make code more clear
  2022-03-06 22:11 ` David Rientjes
@ 2022-03-07 17:11   ` Vlastimil Babka
  0 siblings, 0 replies; 3+ messages in thread
From: Vlastimil Babka @ 2022-03-07 17:11 UTC (permalink / raw)
  To: David Rientjes, Lianjie Zhang
  Cc: Christoph Lameter, Pekka Enberg, Joonsoo Kim, Andrew Morton,
	Roman Gushchin, linux-mm, linux-kernel

On 3/6/22 23:11, David Rientjes wrote:
> On Sun, 6 Mar 2022, Lianjie Zhang wrote:
> 
>> Signed-off-by: Lianjie Zhang <zhanglianjie@uniontech.com>
> 
> And VERIFY_OCTAL_PERMISSIONS() can help validate any future change.
> 
> Acked-by: David Rientjes <rientjes@google.com>

Ok, adding with adjusted subject and non-empty message:

    mm/slub: use helper macro __ATTR_XX_MODE for SLAB_ATTR(_RO)
    
    This allows more concise code, and VERIFY_OCTAL_PERMISSIONS() can help
    validate any future change.



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

end of thread, other threads:[~2022-03-07 17:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-06  7:38 [PATCH] mm/slub: helper macro __ATTR_XX to make code more clear Lianjie Zhang
2022-03-06 22:11 ` David Rientjes
2022-03-07 17:11   ` Vlastimil Babka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).