From: Wang Jian <jianjian.wang1@gmail.com>
To: "David S . Miller" <davem@davemloft.net>,
Jason <jasowang@redhat.com>,
girish.moodalbail@oracle.com, mst@redhat.com,
Willem de Bruijn <willemb@google.com>,
viro@zeniv.linux.org.uk, wexu@redhat.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/1] tap: comment fix
Date: Thu, 16 Aug 2018 21:01:27 +0800 [thread overview]
Message-ID: <CAP4sYWUDb8wtNVvgPO+3a5MWoiBGuafQpvG6KR30RWinf36Msw@mail.gmail.com> (raw)
The tap_queue and the "tap_dev" are loosely coupled, not "macvlan_dev".
And I also change one rcu_read_lock's place, seems can reduce rcu
critical section a little.
Signed-off-by: Wang Jian <jianjian.wang1@gmail.com>
---
drivers/net/tap.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index f0f7cd9..e5e5a8e 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -125,7 +125,7 @@ static struct tap_dev *tap_dev_get_rcu(const
struct net_device *dev)
/*
* RCU usage:
- * The tap_queue and the macvlan_dev are loosely coupled, the
+ * The tap_queue and the tap_dev are loosely coupled, the
* pointers from one to the other can only be read while rcu_read_lock
* or rtnl is held.
*
@@ -720,8 +720,6 @@ static ssize_t tap_get_user(struct tap_queue *q,
struct msghdr *m,
__vlan_get_protocol(skb, skb->protocol, &depth) != 0)
skb_set_network_header(skb, depth);
- rcu_read_lock();
- tap = rcu_dereference(q->tap);
/* copy skb_ubuf_info for callback when skb has no error */
if (zerocopy) {
skb_shinfo(skb)->destructor_arg = m->msg_control;
@@ -732,6 +730,8 @@ static ssize_t tap_get_user(struct tap_queue *q,
struct msghdr *m,
uarg->callback(uarg, false);
}
+ rcu_read_lock();
+ tap = rcu_dereference(q->tap);
if (tap) {
skb->dev = tap->dev;
dev_queue_xmit(skb);
--
Regards,
Wang Jian
next reply other threads:[~2018-08-16 13:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-16 13:01 Wang Jian [this message]
2018-08-16 19:30 ` [PATCH 1/1] tap: comment fix David Miller
2018-08-17 4:28 ` Jason Wang
2018-08-17 8:24 ` Wang Jian
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=CAP4sYWUDb8wtNVvgPO+3a5MWoiBGuafQpvG6KR30RWinf36Msw@mail.gmail.com \
--to=jianjian.wang1@gmail.com \
--cc=davem@davemloft.net \
--cc=girish.moodalbail@oracle.com \
--cc=jasowang@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=wexu@redhat.com \
--cc=willemb@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;
as well as URLs for NNTP newsgroup(s).