Re: [PATCH v2 5/7] connector/cn_proc: Protect send_msg() with a local lock
From: Sebastian Andrzej Siewior
Date: Mon May 25 2020 - 10:51:44 EST
On 2020-05-25 09:18:19 [+0200], Ingo Molnar wrote:
> > +static DEFINE_PER_CPU(struct local_evt, local_evt) = {
> > + .counts = 0,
>
> I don't think zero initializations need to be written out explicitly.
yes.
> > + .lock = INIT_LOCAL_LOCK(lock),
> > +};
> >
> > static inline void send_msg(struct cn_msg *msg)
> > {
> > - preempt_disable();
> > + local_lock(&local_evt.lock);
> >
> > - msg->seq = __this_cpu_inc_return(proc_event_counts) - 1;
> > + msg->seq = __this_cpu_inc_return(local_evt.counts) - 1;
>
> Naming nit: renaming this from 'proc_event_counts' to
> 'local_evt.counts' is a step back IMO - what's an 'evt',
> did we run out of e's? ;-)
>
> Should be something like local_event.count? (Singular.)
okay.
> Thanks,
>
> Ingo
Sebastian