[ovs-dev] [PATCH v2 5/5] net: Add Open vSwitch kernel components.

Stephen Hemminger shemminger at vyatta.com
Mon Nov 21 23:25:18 UTC 2011


On Mon, 21 Nov 2011 15:18:43 -0800
Jesse Gross <jesse at nicira.com> wrote:

> On Mon, Nov 21, 2011 at 1:59 PM, Stephen Hemminger
> <shemminger at vyatta.com> wrote:
> > On Mon, 21 Nov 2011 13:30:29 -0800
> > Jesse Gross <jesse at nicira.com> wrote:
> >
> >> +/**
> >> + *   vport_record_error - indicate device error to generic stats layer
> >> + *
> >> + * @vport: vport that encountered the error
> >> + * @err_type: one of enum vport_err_type types to indicate the error type
> >> + *
> >> + * If using the vport generic stats layer indicate that an error of the given
> >> + * type has occured.
> >> + */
> >> +void vport_record_error(struct vport *vport, enum vport_err_type err_type)
> >> +{
> >> +     spin_lock(&vport->stats_lock);
> >
> > Sorry for over analyzing this... but I don't think the stats_lock
> > is necessary either. The only thing it is protecting is against 64 bit
> > wrap. If you used another u64_stat_sync for that one, it could be eliminated.
> >
> > Maybe?
> 
> The reason for stats_lock is that the error stats are not expected to
> be contended so in order to save some memory they're not per-cpu and
> we just use a spin lock to protect them.

Assignment or increment of native type size (64 bit on 64 bit cpu)
is always atomic.



More information about the dev mailing list