[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111121152518.79e82eb8@nehalam.linuxnetplumber.net>
Date: Mon, 21 Nov 2011 15:25:18 -0800
From: Stephen Hemminger <shemminger@...tta.com>
To: Jesse Gross <jesse@...ira.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
dev@...nvswitch.org
Subject: Re: [PATCH v2 5/5] net: Add Open vSwitch kernel components.
On Mon, 21 Nov 2011 15:18:43 -0800
Jesse Gross <jesse@...ira.com> wrote:
> On Mon, Nov 21, 2011 at 1:59 PM, Stephen Hemminger
> <shemminger@...tta.com> wrote:
> > On Mon, 21 Nov 2011 13:30:29 -0800
> > Jesse Gross <jesse@...ira.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists