lkml.org 
[lkml]   [2003]   [Feb]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Longstanding networking / SMP issue? (duplextest)
On Sun, Feb 23, 2003 at 01:12:17AM -0800, David S. Miller wrote:
> +static struct socket *__icmp_socket[NR_CPUS];
> +#define icmp_socket __icmp_socket[smp_processor_id()]

This should be per-cpu data

> -static __inline__ int icmp_xmit_lock(void)
> +static __inline__ void icmp_xmit_lock(void)
> {
> - int ret;
> local_bh_disable();
> - ret = icmp_xmit_lock_bh();
> - if (ret)
> - local_bh_enable();
> - return ret;
> -}
>
> -static void icmp_xmit_unlock_bh(void)
> -{
> - icmp_xmit_holder = -1;
> - spin_unlock(&icmp_socket->sk->lock.slock);
> + if (!spin_trylock(&icmp_socket->sk->lock.slock))
> + BUG();

unlikely()?

> -static __inline__ void icmp_xmit_unlock(void)
> +static void icmp_xmit_unlock(void)
> {
> - icmp_xmit_unlock_bh();
> + spin_unlock(&icmp_socket->sk->lock.slock);
> local_bh_enable();

spin_unlock_bh

> + icmp_xmit_lock();

Hmm, and I guess the code would be much more readable if you used
the spin_lock call directly. The impliclit icmp_socket doesn't
really help readability either.

-
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: 2005-03-22 13:33    [W:0.065 / U:3.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site