lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1293790501.2973.33.camel@edumazet-laptop>
Date:	Fri, 31 Dec 2010 11:15:01 +0100
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	stefani@...bold.net
Cc:	linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
	davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH] UDPCP Communication Protocol

Le vendredi 31 décembre 2010 à 10:29 +0100, stefani@...bold.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.
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.



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ