Re: [tip: sched/urgent] sched: Fix RANDSTRUCT build fail

From: Peter Zijlstra
Date: Mon Jun 22 2020 - 04:17:02 EST


On Mon, Jun 22, 2020 at 10:10:27AM +0200, Peter Zijlstra wrote:

> Instead of relying on BUG_ON() to ensure the various data structures
> line up, use a bunch of horrible unions.

> struct irq_work {
> + union {
> + struct __call_single_node node;
> + struct {
> + struct llist_node llnode;
> + atomic_t flags;
> + };
> + };
> void (*func)(struct irq_work *);
> };

> struct __call_single_data {
> + union {
> + struct __call_single_node node;
> + struct {
> + struct llist_node llist;
> + unsigned int flags;
> + };
> + };
> smp_call_func_t func;
> void *info;
> };

FWIW, I have 2 further patches, one for each of these structures to get
rid of the horrible union. They are somewhat larger and I was planning
to hold on to them for next round, but if you want them now, I can
certainly do that.