[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHXqBFLufG9vEHBuDtYMQtMKwWhbWNiuHMeVmcZWtHOLQbD0bw@mail.gmail.com>
Date: Tue, 22 Nov 2011 00:49:16 +0100
From: Michał Mirosław <mirqus@...il.com>
To: Stephen Hemminger <shemminger@...tta.com>
Cc: Jesse Gross <jesse@...ira.com>,
"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.
2011/11/22 Stephen Hemminger <shemminger@...tta.com>:
> 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.
It might be, but it not always is. For example, on load-store
architectures normal increment (load,inc,store) is not atomic unless
made with special instruction sequence (like LDR/STREX on ARM).
Best Regards,
Michał Mirosław
--
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