netdev
[Top] [All Lists]

Re: [PATCH + RFC] decnet fib s/rwlock/spinlock/g

To: acme@xxxxxxxxxxxxxxxx (Arnaldo Carvalho de Melo)
Subject: Re: [PATCH + RFC] decnet fib s/rwlock/spinlock/g
From: Steven Whitehouse <steve@xxxxxxxxxxxxxx>
Date: Wed, 18 Jul 2001 09:20:47 +0100 (BST)
Cc: davem@xxxxxxxxxx (David S.Miller), netdev@xxxxxxxxxxx
In-reply-to: <20010717221857.H10373@xxxxxxxxxxxxxxxx> from "Arnaldo Carvalho de Melo" at Jul 17, 2001 10:18:57 PM
Organization: ChyGywn Limited
Reply-to: Steve Whitehouse <Steve@xxxxxxxxxxx>
Sender: owner-netdev@xxxxxxxxxxx
Hi,

I think thats probably Ok. I'm sure it landed up with a write_lock() to match
the IP functions, but I don't think DECnet has a use for a version of
ip_fib_check_default() so there is no reason not to make it a normal 
spinlock,

Steve.

> 
> Hi,
> 
>       Please take a look if this is worth applying, from a quick look it
> just uses write_lock and no read_lock, maybe its needed to protect some
> other list usage sections, but as it seems we can just use plain spinlocks
> for this. patch against 2.4.5, but it should apply to newer kernels, I
> think.
> 
>                         - Arnaldo
> 
> Index: net/decnet/dn_fib.c
> ===================================================================
> RCS file: /home/cvs/kernel-acme/net/decnet/dn_fib.c,v
> retrieving revision 1.1.1.1
> diff -u -r1.1.1.1 dn_fib.c
> --- net/decnet/dn_fib.c       2001/06/26 17:29:34     1.1.1.1
> +++ net/decnet/dn_fib.c       2001/07/18 01:13:00
> @@ -56,7 +56,7 @@
>  
>  
>  static struct dn_fib_info *dn_fib_info_list;
> -static rwlock_t dn_fib_info_lock = RW_LOCK_UNLOCKED;
> +static spinlock_t dn_fib_info_lock = SPIN_LOCK_UNLOCKED;
>  int dn_fib_info_cnt;
>  
>  static struct
> @@ -96,7 +96,7 @@
>  
>  void dn_fib_release_info(struct dn_fib_info *fi)
>  {
> -     write_lock(&dn_fib_info_lock);
> +     spin_lock(&dn_fib_info_lock);
>       if (fi && --fi->fib_treeref == 0) {
>               if (fi->fib_next)
>                       fi->fib_next->fib_prev = fi->fib_prev;
> @@ -107,7 +107,7 @@
>               fi->fib_dead = 1;
>               dn_fib_info_put(fi);
>       }
> -     write_unlock(&dn_fib_info_lock);
> +     spin_unlock(&dn_fib_info_lock);
>  }
>  
>  static __inline__ int dn_fib_nh_comp(const struct dn_fib_info *fi, const 
> struct dn_fib_info *ofi)
> @@ -345,14 +345,14 @@
>  
>       fi->fib_treeref++;
>       atomic_inc(&fi->fib_clntref);
> -     write_lock(&dn_fib_info_lock);
> +     spin_lock(&dn_fib_info_lock);
>       fi->fib_next = dn_fib_info_list;
>       fi->fib_prev = NULL;
>       if (dn_fib_info_list)
>               dn_fib_info_list->fib_prev = fi;
>       dn_fib_info_list = fi;
>       dn_fib_info_cnt++;
> -     write_unlock(&dn_fib_info_lock);
> +     spin_unlock(&dn_fib_info_lock);
>       return fi;
>  
>  err_inval:
> 


<Prev in Thread] Current Thread [Next in Thread>