From: Stephen Hemminger <stephen@networkplumber.org>
To: yuan linyu <cugyly@163.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Subject: Re: [PATCH net-next 1/2] net: tap: replay while() loop with % operator in tap_get_queue()
Date: Mon, 11 Dec 2017 08:58:11 -0800 [thread overview]
Message-ID: <20171211085811.00c3cbaf@xeon-e3> (raw)
In-Reply-To: <1512998801-17852-1-git-send-email-cugyly@163.com>
On Mon, 11 Dec 2017 21:26:41 +0800
yuan linyu <cugyly@163.com> wrote:
> From: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
>
> Signed-off-by: yuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
> ---
> drivers/net/tap.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/net/tap.c b/drivers/net/tap.c
> index 0a886fda..78900a0 100644
> --- a/drivers/net/tap.c
> +++ b/drivers/net/tap.c
> @@ -275,11 +275,7 @@ static struct tap_queue *tap_get_queue(struct tap_dev *tap,
>
> if (likely(skb_rx_queue_recorded(skb))) {
> rxq = skb_get_rx_queue(skb);
> -
> - while (unlikely(rxq >= numvtaps))
> - rxq -= numvtaps;
> -
> - queue = rcu_dereference(tap->taps[rxq]);
> + queue = rcu_dereference(tap->taps[rxq % numvtaps]);
> goto out;
> }
>
Modulus is slower than the loop.
next prev parent reply other threads:[~2017-12-11 16:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-11 13:26 [PATCH net-next 1/2] net: tap: replay while() loop with % operator in tap_get_queue() yuan linyu
2017-12-11 16:58 ` Stephen Hemminger [this message]
2017-12-11 17:02 ` 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=20171211085811.00c3cbaf@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=Linyu.Yuan@alcatel-sbell.com.cn \
--cc=cugyly@163.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/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).