From: Jarek Poplawski <jarkao2@gmail.com>
To: netdev@vger.kernel.org
Cc: Badalian Vyacheslav <slavon@bigtelecom.ru>,
Patrick McHardy <kaber@trash.net>, jamal <hadi@cyberus.ca>,
David Miller <davem@davemloft.net>
Subject: [PATCH 2/3][NET] gen_estimator: list_empty() check in est_timer() fixed
Date: Mon, 21 Jan 2008 00:49:59 +0100 [thread overview]
Message-ID: <20080120234959.GB2691@ami.dom.local> (raw)
This patch changes the method of checking for empty list in est_timer():
list_empty() is not recommended for RCU protected lists. Now, it's simply
a variable used for this.
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
diff -Nurp 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c 2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c
--- 2.6.24-rc8-mm1-p1-/net/core/gen_estimator.c 2008-01-20 20:58:35.000000000 +0100
+++ 2.6.24-rc8-mm1-p1+/net/core/gen_estimator.c 2008-01-20 21:07:42.000000000 +0100
@@ -106,6 +106,7 @@ static void est_timer(unsigned long arg)
{
int idx = (int)arg;
struct gen_estimator *e;
+ int list_not_empty = 0;
rcu_read_lock();
list_for_each_entry_rcu(e, &elist[idx].list, list) {
@@ -118,6 +119,9 @@ static void est_timer(unsigned long arg)
if (e->bstats == NULL)
goto skip;
+ if (list_not_empty == 0)
+ list_not_empty = 1;
+
nbytes = e->bstats->bytes;
npackets = e->bstats->packets;
rate = (nbytes - e->last_bytes)<<(7 - idx);
@@ -134,7 +138,7 @@ skip:
spin_unlock(e->stats_lock);
}
- if (!list_empty(&elist[idx].list))
+ if (list_not_empty)
mod_timer(&elist[idx].timer, jiffies + ((HZ/4) << idx));
rcu_read_unlock();
}
next reply other threads:[~2008-01-20 23:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-20 23:49 Jarek Poplawski [this message]
2008-01-20 23:55 ` [PATCH 2/3][NET] gen_estimator: list_empty() check in est_timer() fixed Stephen Hemminger
2008-01-21 6:34 ` Jarek Poplawski
2008-01-21 6:42 ` Jarek Poplawski
2008-01-21 10:36 ` David Miller
2008-01-21 11:19 ` Jarek Poplawski
2008-01-21 11:15 ` David Miller
2008-01-21 11:28 ` Jarek Poplawski
2008-01-21 14:43 ` Jarek Poplawski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080120234959.GB2691@ami.dom.local \
--to=jarkao2@gmail.com \
--cc=davem@davemloft.net \
--cc=hadi@cyberus.ca \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=slavon@bigtelecom.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).