netdev
[Top] [All Lists]

[PATCH] Add prefetches in net/ipv4/route.c

To: "David S. Miller" <davem@xxxxxxxxxxxxx>
Subject: [PATCH] Add prefetches in net/ipv4/route.c
From: Eric Dumazet <dada1@xxxxxxxxxxxxx>
Date: Thu, 28 Jul 2005 17:52:04 +0200
Cc: netdev@xxxxxxxxxxx
In-reply-to: <42CA390C.9000801@cosmosbay.com>
References: <20050704.154712.63128211.davem@davemloft.net> <42C9BE69.2070008@cosmosbay.com> <42C9BEF6.4080402@cosmosbay.com> <20050704.160140.21591849.davem@davemloft.net> <42CA390C.9000801@cosmosbay.com>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)
[NET] : Adds prefetches in route hash list traversals.

The actual code doesnt use a prefetch enabled macro like list_for_each_rcu(), 
so manually
add prefetch() hints.

Signed-off-by: Eric Dumazet <dada1@xxxxxxxxxxxxx>
diff -Nru linux-2.6.13-rc3/net/ipv4/route.c linux-2.6.13-rc3-ed/net/ipv4/route.c
--- linux-2.6.13-rc3/net/ipv4/route.c   2005-07-13 06:46:46.000000000 +0200
+++ linux-2.6.13-rc3-ed/net/ipv4/route.c        2005-07-28 17:20:21.000000000 
+0200
@@ -1148,6 +1148,7 @@
                        while ((rth = rcu_dereference(*rthp)) != NULL) {
                                struct rtable *rt;
 
+                               prefetch(rth->u.rt_next);
                                if (rth->fl.fl4_dst != daddr ||
                                    rth->fl.fl4_src != skeys[i] ||
                                    rth->fl.fl4_tos != tos ||
@@ -1401,6 +1402,7 @@
                rcu_read_lock();
                for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
                     rth = rcu_dereference(rth->u.rt_next)) {
+                       prefetch(rth->u.rt_next);
                        if (rth->fl.fl4_dst == daddr &&
                            rth->fl.fl4_src == skeys[i] &&
                            rth->rt_dst  == daddr &&
@@ -2094,6 +2096,7 @@
        rcu_read_lock();
        for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
             rth = rcu_dereference(rth->u.rt_next)) {
+               prefetch(rth->u.rt_next);
                if (rth->fl.fl4_dst == daddr &&
                    rth->fl.fl4_src == saddr &&
                    rth->fl.iif == iif &&
@@ -2565,6 +2568,7 @@
        rcu_read_lock_bh();
        for (rth = rcu_dereference(rt_hash_table[hash].chain); rth;
                rth = rcu_dereference(rth->u.rt_next)) {
+               prefetch(rth->u.rt_next);
                if (rth->fl.fl4_dst == flp->fl4_dst &&
                    rth->fl.fl4_src == flp->fl4_src &&
                    rth->fl.iif == 0 &&
@@ -2819,6 +2823,7 @@
                rcu_read_lock_bh();
                for (rt = rcu_dereference(rt_hash_table[h].chain), idx = 0; rt;
                     rt = rcu_dereference(rt->u.rt_next), idx++) {
+                       prefetch(rt->u.rt_next);
                        if (idx < s_idx)
                                continue;
                        skb->dst = dst_clone(&rt->u.dst);
<Prev in Thread] Current Thread [Next in Thread>