On Thu, May 04, 2023 at 05:09:01PM -0700, Andrii Nakryiko wrote: > +struct backtrack_state { > + struct bpf_verifier_env *env; > + u32 frame; > + u32 bitcnt; > + u32 reg_masks[MAX_CALL_FRAMES]; > + u64 stack_masks[MAX_CALL_FRAMES]; > +}; > + > +static inline u32 bt_empty(struct backtrack_state *bt) > +{ > + u64 mask = 0; > + int i; > + > + for (i = 0; i < MAX_CALL_FRAMES; i++) > + mask |= bt->reg_masks[i] | bt->stack_masks[i]; > + > + return mask == 0; > +} > + ... > +static inline void bt_set_frame_reg(struct backtrack_state *bt, u32 frame, u32 reg) > +{ > + if (bt->reg_masks[frame] & (1 << reg)) > + return; > + > + bt->reg_masks[frame] |= 1 << reg; > + bt->bitcnt++; > +} So you went with bitcnt and bt_empty ? I'm confused. I thought we discussed it's one or another. I have slight preference towards bt_empty() as above. fwiw.