netdev
[Top] [All Lists]

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

To: Steven Whitehouse <SteveW@xxxxxxx>
Subject: [PATCH + RFC] decnet fib s/rwlock/spinlock/g
From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxxxxxxxx>
Date: Tue, 17 Jul 2001 22:18:57 -0300
Cc: "David S.Miller" <davem@xxxxxxxxxx>, netdev@xxxxxxxxxxx
Sender: owner-netdev@xxxxxxxxxxx
User-agent: Mutt/1.3.17i
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>