From: Eric Dumazet <eric.dumazet@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org, therbert@google.com
Subject: [PATCH net-next-2.6] rps: avoid one atomic in enqueue_to_backlog
Date: Fri, 07 May 2010 11:51:21 +0200 [thread overview]
Message-ID: <1273225881.2261.39.camel@edumazet-laptop> (raw)
In-Reply-To: <1273209375.2222.37.camel@edumazet-laptop>
Le vendredi 07 mai 2010 à 07:16 +0200, Eric Dumazet a écrit :
> Le jeudi 06 mai 2010 à 22:07 -0700, David Miller a écrit :
>
> > Looks great, applied, thanks Eric.
>
> Thanks, I have a followup to avoid one atomic in enqueue phase too ;)
>
[PATCH net-next-2.6] rps: avoid one atomic in enqueue_to_backlog
If CONFIG_SMP=y, then we own a queue spinlock, we can avoid the atomic
test_and_set_bit() from napi_schedule_prep().
We now have same number of atomic ops per netif_rx() calls than with
pre-RPS kernel.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
diff --git a/net/core/dev.c b/net/core/dev.c
index 32611c8..49fa5a6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2426,8 +2426,10 @@ enqueue:
return NET_RX_SUCCESS;
}
- /* Schedule NAPI for backlog device */
- if (napi_schedule_prep(&sd->backlog)) {
+ /* Schedule NAPI for backlog device
+ * We can use non atomic operation since we own the queue lock
+ */
+ if (!__test_and_set_bit(NAPI_STATE_SCHED, &sd->backlog.state)) {
if (!rps_ipi_queued(sd))
____napi_schedule(sd, &sd->backlog);
}
next prev parent reply other threads:[~2010-05-07 9:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-06 8:58 [PATCH net-next-2.6] rps: Various optimizations Eric Dumazet
2010-05-07 5:07 ` David Miller
2010-05-07 5:16 ` Eric Dumazet
2010-05-07 9:51 ` Eric Dumazet [this message]
2010-05-07 10:01 ` [PATCH net-next-2.6] rps: avoid one atomic in enqueue_to_backlog Changli Gao
2010-05-07 10:05 ` Eric Dumazet
2010-05-18 0:22 ` David Miller
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=1273225881.2261.39.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
/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