lkml.org 
[lkml]   [2010]   [Dec]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] UDPCP Communication Protocol
From
Date
Am Freitag, den 31.12.2010, 11:15 +0100 schrieb Eric Dumazet:
> Le vendredi 31 décembre 2010 à 10:29 +0100, stefani@seibold.net a
> écrit :
> > + spin_lock_irqsave(&spinlock, flags);
> > + udpcp_stat.txMsgs++;
> > + spin_unlock_irqrestore(&spinlock, flags);
>
> This is really ugly for different reasons :
>
> 1) Naming a lock, even static "spinlock" is ugly.

Agree...

> 2) Using a lock for stats is not necessary, and
> disabling hard irqs is not necessary either (spinlock_bh() would be
> more than enough)
>
> At a very minimum, you should use atomic_t so that no lock is needed
>
> 3) Network stack widely use MIB per_cpu counters.
> As you use UDP, you could take a look at UDP_INC_STATS_BH()/
> UDP_INC_STATS_USER() implementation for an example.
>

I will have look at this and revamp it.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-12-31 11:31    [W:0.150 / U:0.332 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site