Re: [PATCH v19 34/40] rcu/update: fix same dept key collision between various types of RCU

From: Byungchul Park

Date: Fri Jul 10 2026 - 02:21:31 EST


On Tue, Jul 07, 2026 at 07:33:52AM +0000, sashiko-bot@xxxxxxxxxx wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Unused struct member `dkey` inflates stack footprint
> --
>
> commit de6aa9797881496b4a8d7d66626b1bfd19cfdd54
> Author: Yunseong Kim <ysk@xxxxxxxxxxx>
>
> rcu/update: fix same dept key collision between various types of RCU
>
> This commit addresses a false positive circular dependency report in dept
> by assigning separate dept keys and maps to each struct rcu_synchronize
> execution context.
>
> > diff --git a/include/linux/rcupdate_wait.h b/include/linux/rcupdate_wait.h
> > --- a/include/linux/rcupdate_wait.h
> > +++ b/include/linux/rcupdate_wait.h
> > @@ -19,17 +19,20 @@ struct rcu_synchronize {
> >
> > /* This is for debugging. */
> > struct rcu_gp_oldstate oldstate;
> > + struct dept_map dmap;
> > + struct dept_key dkey;
>
> [Severity: Low]
> Does this code ever use the dkey member of struct rcu_synchronize?
>
> The _wait_rcu_gp() macro defines its own static struct dept_key __key,
> which it passes as an argument to __wait_rcu_gp(). This leaves the dkey
> member of struct rcu_synchronize completely unused and uninitialized, while
> needlessly increasing the stack footprint of the rs_array allocated in the
> macro.

I will fix it.

Byungchul

> > };
> > void wakeme_after_rcu(struct rcu_head *head);
> >
> > void __wait_rcu_gp(bool checktiny, unsigned int state, int n, call_rcu_func_t *crcu_array,
> > - struct rcu_synchronize *rs_array);
> > + struct rcu_synchronize *rs_array, struct dept_key *dkey);
> >
> > #define _wait_rcu_gp(checktiny, state, ...) \
> > -do { \
> > - call_rcu_func_t __crcu_array[] = { __VA_ARGS__ }; \
> > - struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)]; \
> > - __wait_rcu_gp(checktiny, state, ARRAY_SIZE(__crcu_array), __crcu_array, __rs_array); \
> > +do { \
> > + call_rcu_func_t __crcu_array[] = { __VA_ARGS__ }; \
> > + static struct dept_key __key; \
> > + struct rcu_synchronize __rs_array[ARRAY_SIZE(__crcu_array)]; \
> > + __wait_rcu_gp(checktiny, state, ARRAY_SIZE(__crcu_array), __crcu_array, __rs_array, &__key); \
> > } while (0)
>
> [ ... ]
>
> > diff --git a/kernel/rcu/update.c b/kernel/rcu/update.c
> > --- a/kernel/rcu/update.c
> > +++ b/kernel/rcu/update.c
>
> [ ... ]
>
> > @@ -426,7 +426,8 @@ void __wait_rcu_gp(bool checktiny, unsigned int state, int n, call_rcu_func_t *c
> > break;
> > if (j == i) {
> > init_rcu_head_on_stack(&rs_array[i].head);
> > - init_completion(&rs_array[i].completion);
> > + sdt_map_init_key(&rs_array[i].dmap, dkey);
> > + init_completion_dmap(&rs_array[i].completion, &rs_array[i].dmap);
> > (crcu_array[i])(&rs_array[i].head, wakeme_after_rcu);
> > }
> > }
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260706061928.66713-1-byungchul@xxxxxx?part=34