* [PATCH 1/1] tap: RCU usage and comment fixes
@ 2018-08-17 8:22 Wang Jian
2018-08-19 18:08 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Wang Jian @ 2018-08-17 8:22 UTC (permalink / raw)
To: davem, jasowang, mst, willemb, viro, wexu, netdev; +Cc: Wang Jian
The tap_queue and the 'tap_dev' are loosely coupled, not 'macvlan_dev'.
Taking rcu_read_lock a little later seems can slightly reduce rcu read critical section.
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 f0f7cd977667..e5e5a8e4a60d 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);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH 1/1] tap: RCU usage and comment fixes
2018-08-17 8:22 [PATCH 1/1] tap: RCU usage and comment fixes Wang Jian
@ 2018-08-19 18:08 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-08-19 18:08 UTC (permalink / raw)
To: jianjian.wang1; +Cc: jasowang, mst, willemb, viro, wexu, netdev
From: Wang Jian <jianjian.wang1@gmail.com>
Date: Fri, 17 Aug 2018 08:22:53 +0000
> The tap_queue and the 'tap_dev' are loosely coupled, not 'macvlan_dev'.
There is another reference to macvlan_dev in that comment, which is therefore
also similarly inaccurate. You should add an appropriate Fixes: line for
where this inaccuracy was introduced, which is:
Fixes: 6fe3faf86757 ("tap: Abstract type of virtual interface from tap implementation")
> Taking rcu_read_lock a little later seems can slightly reduce rcu read critical section.
This is a separate change from fixing up a comment.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-19 21:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-17 8:22 [PATCH 1/1] tap: RCU usage and comment fixes Wang Jian
2018-08-19 18:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox