All of lore.kernel.org
 help / color / mirror / Atom feed
* How to increase rcu_head size without breaking -mm ?
@ 2022-08-25  2:56 Joel Fernandes
  2022-08-25  7:13 ` Vlastimil Babka
  0 siblings, 1 reply; 9+ messages in thread
From: Joel Fernandes @ 2022-08-25  2:56 UTC (permalink / raw)
  To: vbabka, willy, paulmck, rcu

Hi,
I am trying to add some debug information to rcu_head for some patches, and need
your help! At least this used to work some time ago (> 1 year).

I get various SLAB_MATCH() errors with a change like this:

diff --git a/include/linux/types.h b/include/linux/types.h
index ea8cf60a8a79..daf7682a7a3b 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -220,6 +220,7 @@ struct ustat {
 struct callback_head {
        struct callback_head *next;
        void (*func)(struct callback_head *head);
+       char buf[4];
 } __attribute__((aligned(sizeof(void *))));
 #define rcu_head callback_head
---

Errors:
mm/slab.h:67:9: note: in expansion of macro ‘static_assert’
   67 |         static_assert(offsetof(struct page, pg) == offsetof(struct slab,
sl))
      |         ^~~~~~~~~~~~~
mm/slab.h:73:1: note: in expansion of macro ‘SLAB_MATCH’
   73 | SLAB_MATCH(_refcount, __page_refcount);
      | ^~~~~~~~~~

----------

I tried various things like increasing the struct slab or struct page size using
dummy variables, but nothing gives.

I tried to print the offsets of the struct using the compiler, but that requires
compilation to actually succeed. The same exercise with a pre-processor also
does not help because nested structures could also including rcu_heads.

If I at least knew how the offsets were off, I could hack it for my needs (of
course upstreaming such a change is a different story, but I do want to upstream
some variant of rcu_head debug info).

Any thoughts on how we can accomplish this?

Thanks!

 - Joel

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

end of thread, other threads:[~2022-08-26  8:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-25  2:56 How to increase rcu_head size without breaking -mm ? Joel Fernandes
2022-08-25  7:13 ` Vlastimil Babka
2022-08-25  7:50   ` Vlastimil Babka
2022-08-25  8:14     ` Vlastimil Babka
2022-08-25 15:00       ` Joel Fernandes
2022-08-25 15:33         ` Vlastimil Babka
2022-08-25 19:51           ` Joel Fernandes
2022-08-26  8:35             ` Vlastimil Babka
2022-08-26  8:50               ` Vlastimil Babka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.