Re: [Openipmi-developer] [PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-20 Thread Corey Minyard
Matt Domsch wrote: On Thu, Feb 14, 2008 at 12:30:51PM -0600, Corey Minyard wrote: From: Konstantin Baydarov <[EMAIL PROTECTED]> Atomics are a lot more efficient and neat than using a lock. per_cpu variables are a lot more efficient and neat than using locks for simple statistics. no

Re: [Openipmi-developer] [PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-16 Thread Matt Domsch
On Thu, Feb 14, 2008 at 12:30:51PM -0600, Corey Minyard wrote: > From: Konstantin Baydarov <[EMAIL PROTECTED]> > > Atomics are a lot more efficient and neat than using a lock. per_cpu variables are a lot more efficient and neat than using locks for simple statistics. no cache line bouncing to in

Re: [Openipmi-developer] [PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-15 Thread Corey Minyard
Peter Zijlstra wrote: On Thu, 2008-02-14 at 12:30 -0600, Corey Minyard wrote: +/* The command didn't have anyone waiting for it. */ +#define IPMI_STAT_unhandled_commands 23 + +/* Invalid data in an event. */ +#define IPMI_STAT_invalid_events 24 + +/* E

Re: [PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-15 Thread Peter Zijlstra
On Thu, 2008-02-14 at 12:30 -0600, Corey Minyard wrote: > +/* > + * Various statistics for IPMI, these index stats[] in the ipmi_smi > + * structure. > + */ > +/* Commands we got from the user that were invalid. */ > +#define IPMI_STAT_sent_invalid_commands 0 > + > +/* Comman

Re: [PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-14 Thread Andrew Morton
On Thu, 14 Feb 2008 13:33:10 -0600 Corey Minyard <[EMAIL PROTECTED]> wrote: > Andrew Morton wrote: > >> + for (i = 0; i < IPMI_NUM_STATS; i++) > >> + atomic_set(&intf->stats[i], 0); > >> > > > > And this is why it would be very hard for any architecture to ever > > implement atomic_

Re: [PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-14 Thread Corey Minyard
Andrew Morton wrote: + for (i = 0; i < IPMI_NUM_STATS; i++) + atomic_set(&intf->stats[i], 0); And this is why it would be very hard for any architecture to ever implement atomic_t as struct atomic_t { int counter; spinlock_t lock; }; The interface assu

Re: [PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-14 Thread Andrew Morton
> + for (i = 0; i < IPMI_NUM_STATS; i++) > + atomic_set(&intf->stats[i], 0); And this is why it would be very hard for any architecture to ever implement atomic_t as struct atomic_t { int counter; spinlock_t lock; }; The interface assumes that atomic_set() fully

[PATCH 3/4] IPMI: convert locked counters to atomics

2008-02-14 Thread Corey Minyard
From: Konstantin Baydarov <[EMAIL PROTECTED]> Atomics are a lot more efficient and neat than using a lock. Signed-off-by: Konstantin Baydarov <[EMAIL PROTECTED]> Signed-off-by: Corey Minyard <[EMAIL PROTECTED]> --- Index: linux-2.6.24/drivers/char/ipmi/ipmi_msghandler.c ===