From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v2 5/5] net: Add Open vSwitch kernel components. Date: Mon, 21 Nov 2011 15:25:18 -0800 Message-ID: <20111121152518.79e82eb8@nehalam.linuxnetplumber.net> References: <1321911029-20707-1-git-send-email-jesse@nicira.com> <1321911029-20707-6-git-send-email-jesse@nicira.com> <20111121135955.571254b1@nehalam.linuxnetplumber.net> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: dev-yBygre7rU0TnMu66kgdUjQ@public.gmane.org, netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "David S. Miller" To: Jesse Gross Return-path: In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org Errors-To: dev-bounces-yBygre7rU0TnMu66kgdUjQ@public.gmane.org List-Id: netdev.vger.kernel.org On Mon, 21 Nov 2011 15:18:43 -0800 Jesse Gross wrote: > On Mon, Nov 21, 2011 at 1:59 PM, Stephen Hemminger > wrote: > > On Mon, 21 Nov 2011 13:30:29 -0800 > > Jesse Gross wrote: > > > >> +/** > >> + * =A0 vport_record_error - indicate device error to generic stats la= yer > >> + * > >> + * @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 t= he given > >> + * type has occured. > >> + */ > >> +void vport_record_error(struct vport *vport, enum vport_err_type err_= type) > >> +{ > >> + =A0 =A0 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 elimi= nated. > > > > 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.