Re: new NAPI quota synchronization issue

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <shemminger@...>
Cc: <netdev@...>
Date: Wednesday, September 19, 2007 - 6:10 pm

From: Stephen Hemminger <shemminger@linux-foundation.org>
Date: Wed, 19 Sep 2007 15:01:29 -0700


Fair enough, I checked the following into net-2.6.24

commit 3b4eed9f46e4b0405a0d8921c2319f2b7c6a6b4a
Author: David S. Miller <davem@sunset.davemloft.net>
Date:   Wed Sep 19 15:09:55 2007 -0700

    [NAPI]: Sample weight into a local var in case it changes.
    
    Noted by Stephen Hemminger.
    
    Signed-off-by: David S. Miller <davem@davemloft.net>

diff --git a/net/core/dev.c b/net/core/dev.c
index 0b9f82e..91c31e6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2136,7 +2136,7 @@ static void net_rx_action(struct softirq_action *h)
 
 	while (!list_empty(list)) {
 		struct napi_struct *n;
-		int work;
+		int work, weight;
 
 		/* If softirq window is exhuasted then punt.
 		 *
@@ -2159,9 +2159,11 @@ static void net_rx_action(struct softirq_action *h)
 
 		have = netpoll_poll_lock(n);
 
-		work = n->poll(n, n->weight);
+		weight = n->weight;
 
-		WARN_ON_ONCE(work > n->weight);
+		work = n->poll(n, weight);
+
+		WARN_ON_ONCE(work > weight);
 
 		budget -= work;
 
@@ -2172,7 +2174,7 @@ static void net_rx_action(struct softirq_action *h)
 		 * still "owns" the NAPI instance and therefore can
 		 * move the instance around on the list at-will.
 		 */
-		if (unlikely(work == n->weight))
+		if (unlikely(work == weight))
 			list_move_tail(&n->poll_list, list);
 
 		netpoll_poll_unlock(have);
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
new NAPI quota synchronization issue, David Miller, (Wed Sep 19, 12:58 pm)
Re: new NAPI quota synchronization issue, David Miller, (Wed Sep 19, 1:35 pm)
Re: new NAPI quota synchronization issue, Stephen Hemminger, (Wed Sep 19, 6:01 pm)
Re: new NAPI quota synchronization issue, David Miller, (Wed Sep 19, 6:10 pm)