On Wed, Sep 03, 2025 at 12:49:33PM +0200, Oleg Nesterov wrote: > On 09/02, Jiri Olsa wrote: > > > > +static bool consumer_can_add(struct list_head *head, struct > > uprobe_consumer *uc) > > +{ > > + /* Uprobe has no consumer, we can add any. */ > > + if (list_empty(head)) > > + return true; > > + /* Uprobe has consumer/s, we can't add unique one. */ > > + if (uc->is_unique) > > + return false; > > + /* > > + * Uprobe has consumer/s, we can add nother consumer only if the > > + * current consumer is not unique. > > + **/ > > + return !list_first_entry(head, struct uprobe_consumer, > > cons_node)->is_unique; > > +} > > Since you are going to send V2 anyway... purely cosmetic and subjective nit, > but somehow I can't resist, > > bool consumer_can_add(struct list_head *head, struct uprobe_consumer > *new) > { > struct uprobe_consumer *old = list_first_entry_or_null(...); > > return !old || (!old->exclusive && !new->exclusive); > } > > looks a bit more readable to me. Please ignore if you like your version more.
yep, looks better, thanks jirka