Re: [PATCH] unwind deferred: Annotate struct unwind_cache with __counted_by

From: Steven Rostedt

Date: Fri Nov 14 2025 - 10:47:49 EST


On Fri, 14 Nov 2025 15:02:09 +0000
David Laight <david.laight.linux@xxxxxxxxx> wrote:

> > +/* Make the cache fit in a 4K page */
> > +#define UNWIND_MAX_ENTRIES \
> > + ((SZ_4K - offset_of(struct unwind_cache, entries)) / sizeof(long))
> > +
> > struct unwind_cache {
> > unsigned long unwind_completed;
> > unsigned int nr_entries;
> > - unsigned long entries[];
> > + unsigned long entries[UNWIND_MAX_ENTRIES];
>
> That won't compile - I tried it.
>
> You could add __aligned(4096) to force the structure to be padded to 4k,
> and then define UNWIND_MAX_ENTRIES in terms of the structure size.

I rather not do more tricks than what a comment would solve.

-- Steve