Skip to contentSkip to conversation

tuntap: set SOCK_ZEROCOPY flag during open

PATCH In review Jason Wang 3 participants 4 messages Jun 9, 2013 – Jun 12, 2013

Subsystems (3)
lore
Share & tools
lore
Acked-by on v1 1/1
#1 lore raw
In reply to Jason Wang
Quoted 7 lines · Jason Wang

Commit 54f968d6efdbf7dec36faa44fc11f01b0e4d1990
(tuntap: move socket to tun_file) forgets to set SOCK_ZEROCOPY flag, which will prevent vhost_net from doing zercopy w/ tap. This patch fixes this by setting it during file open.

Cc Michael S. Tsirkin <[email protected]>

I see, and this explains the perf regression we are seeing with 3.9.

and I think this should go into stable as well.

Quoted 19 lines
---
 drivers/net/tun.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/tun.c +2 -0
index f042b03..d2ddd6d 100644
@@ -2155,6 +2155,8 @@ static int tun_chr_open(struct inode *inode, struct file * file)
 	set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags);
 	INIT_LIST_HEAD(&tfile->next);
 
+	sock_set_flag(&tfile->sk, SOCK_ZEROCOPY);
+
 	return 0;
 }
 
Signature · 1 line
1.7.1

Jason Wang

author
#0 lore raw

PATCH 1/1 tuntap: set SOCK_ZEROCOPY flag during open

Commit 54f968d6efdbf7dec36faa44fc11f01b0e4d1990
(tuntap: move socket to tun_file) forgets to set SOCK_ZEROCOPY flag, which will prevent vhost_net from doing zercopy w/ tap. This patch fixes this by setting it during file open.

Cc Michael S. Tsirkin <[email protected]>
---
 drivers/net/tun.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/tun.c +2 -0
index f042b03..d2ddd6d 100644
@@ -2155,6 +2155,8 @@ static int tun_chr_open(struct inode *inode, struct file * file)
 	set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags);
 	INIT_LIST_HEAD(&tfile->next);
 
+	sock_set_flag(&tfile->sk, SOCK_ZEROCOPY);
+
 	return 0;
 }
 
Signature · 1 line
1.7.1
Acked-by on v1 1/1
#2 lore raw
Quoted 10 lines · Jason Wang

Cc: [email protected], [email protected],
[email protected], [email protected]

Commit 54f968d6efdbf7dec36faa44fc11f01b0e4d1990
(tuntap: move socket to tun_file) forgets to set SOCK_ZEROCOPY flag, which will prevent vhost_net from doing zercopy w/ tap. This patch fixes this by setting it during file open.

Cc Michael S. Tsirkin <[email protected]>

One of the addresses in the Cc list ([email protected]) is clearly a mistake, which probably explains why it didn't get into patchwork.

I have bounced it to correct addresses, hope this helps instead of making even more of a mess of it.

For 3.10 and -stable:

Quoted 19 lines
---
 drivers/net/tun.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/tun.c +2 -0
index f042b03..d2ddd6d 100644
@@ -2155,6 +2155,8 @@ static int tun_chr_open(struct inode *inode, struct file * file)
 	set_bit(SOCK_EXTERNALLY_ALLOCATED, &tfile->socket.flags);
 	INIT_LIST_HEAD(&tfile->next);
 
+	sock_set_flag(&tfile->sk, SOCK_ZEROCOPY);
+
 	return 0;
 }
 
Signature · 1 line
1.7.1
maintainer
#3 lore raw

From: "Michael S. Tsirkin" <[email protected]>
Date: Tue, 11 Jun 2013 16:17:50 +0300

Quoted 16 lines · Jason Wang
Quoted 10 lines

Cc: [email protected], [email protected],
[email protected], [email protected]

Commit 54f968d6efdbf7dec36faa44fc11f01b0e4d1990
(tuntap: move socket to tun_file) forgets to set SOCK_ZEROCOPY flag, which will prevent vhost_net from doing zercopy w/ tap. This patch fixes this by setting it during file open.

Cc Michael S. Tsirkin <[email protected]>

One of the addresses in the Cc list ([email protected]) is clearly a mistake, which probably explains why it didn't get into patchwork.

Quoted 6 lines

I have bounced it to correct addresses, hope this helps instead of making even more of a mess of it.

For 3.10 and -stable:

Applied and queued up for -stable, thanks.