Skip to contentSkip to conversation

Netchannels: netchannel vs. socket. 2:0.

PATCH Evgeniy Polyakov 3 participants 10 messages Jun 8, 2006 – Jul 10, 2006

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

After some enhancements made for netchannel subsystem I'm pleased to announce, that netchannel subsystem outperforms existing layered design both in CPU usage and network speed.

Well, after such pretentious introduction I want to cool things down. CPU usage is about 1-2% less for netchannels and network performance is about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).

It is stable and 100% reproductible result.

Performance graph and patch are attached.

Interesting note, that netchannel copy_to_user() setup slightly outperforms memcpy() setup.

I have some doubts that stock socket TCP code was used in Van Jacobson netchannel implementation, especially in the final benchmarks, because of his words about userspace TCP processing, which sometimes pushes to read RFC 793 and do some coding...

Previous patches, userspace utility, design and implementatin details can be found at project's homepage [1].

1. Netchannel homepage.
http://tservice.net.ru/~s0mbre/old/?section=projects&item=netchannel

arch/i386/kernel/syscall_table.S +2 -0
index f48bef1..7a4a758 100644
@@ -315,3 +315,5 @@ ENTRY(sys_call_table)
 	.long sys_splice
 	.long sys_sync_file_range
 	.long sys_tee			/* 315 */
+	.long sys_vmsplice
+	.long sys_netchannel_control
arch/x86_64/ia32/ia32entry.S +1 -0
index 5a92fed..fdfb997 100644
@@ -696,4 +696,5 @@ ia32_sys_call_table:
 	.quad sys_sync_file_range
 	.quad sys_tee
 	.quad compat_sys_vmsplice
+	.quad sys_netchannel_control
 ia32_syscall_end:		
include/asm-i386/unistd.h +2 -1
index eb4b152..777cd85 100644
@@ -322,8 +322,9 @@
 #define __NR_sync_file_range	314
 #define __NR_tee		315
 #define __NR_vmsplice		316
+#define __NR_netchannel_control	317
 
-#define NR_syscalls 317
+#define NR_syscalls 318
 
 /*
  * user-visible error numbers are in the range -1 - -128: see
include/asm-x86_64/unistd.h +3 -1
index feb77cb..08c230e 100644
@@ -617,8 +617,10 @@ __SYSCALL(__NR_tee, sys_tee)
 __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
 #define __NR_vmsplice		278
 __SYSCALL(__NR_vmsplice, sys_vmsplice)
+#define __NR_netchannel_control	279
+__SYSCALL(__NR_vmsplice, sys_netchannel_control)
 
-#define __NR_syscall_max __NR_vmsplice
+#define __NR_syscall_max __NR_netchannel_control
 
 #ifndef __NO_STUBS
 
include/linux/netchannel.h new file +118 -0

118 lines not on this page · raw message

include/linux/netdevice.h +9 -0
index a461b51..9924911 100644
@@ -684,6 +684,15 @@ extern void		dev_queue_xmit_nit(struct s
 
 extern void		dev_init(void);
 
+#ifdef CONFIG_NETCHANNEL
+extern int netchannel_recv(struct sk_buff *skb);
+#else
+static int netchannel_recv(struct sk_buff *skb) 
+{ 
+	return -1;
+}
+#endif
+
 extern int		netdev_nit;
 extern int		netdev_budget;
 
include/linux/skbuff.h +14 -1
index f8f2347..69f0c32 100644
@@ -265,7 +265,8 @@ struct sk_buff {
 				nfctinfo:3;
 	__u8			pkt_type:3,
 				fclone:2,
-				ipvs_property:1;
+				ipvs_property:1,
+				netchannel:1;
 	__be16			protocol;
 
 	void			(*destructor)(struct sk_buff *skb);
@@ -314,6 +315,18 @@ static inline struct sk_buff *alloc_skb(
 	return __alloc_skb(size, priority, 0);
 }
 
+#ifdef CONFIG_NETCHANNEL
+struct unetchannel;
+extern struct sk_buff *netchannel_alloc(struct unetchannel *unc, unsigned int header_size, 
+		unsigned int total_size, gfp_t gfp_mask);
+#else
+static struct sk_buff *netchannel_alloc(void *unc, unsigned int header_size, 
+		unsigned int total_size, gfp_t gfp_mask)
+{
+	return NULL;
+}
+#endif
+
 static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
 					       gfp_t priority)
 {
include/linux/socket.h +1 -0
index 9ab2ddd..036a221 100644
@@ -298,6 +298,7 @@ extern int csum_partial_copy_fromiovecen
 
 extern int verify_iovec(struct msghdr *m, struct iovec *iov, char *address, int mode);
 extern int memcpy_toiovec(struct iovec *v, unsigned char *kdata, int len);
+extern int memcpy_toiovec_copy(struct iovec *v, unsigned char *kdata, int len);
 extern int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __user *ulen);
 extern int move_addr_to_kernel(void __user *uaddr, int ulen, void *kaddr);
 extern int put_cmsg(struct msghdr*, int level, int type, int len, void *data);
include/linux/syscalls.h +2 -0
index 3996960..8c22875 100644
@@ -582,4 +582,6 @@ asmlinkage long sys_tee(int fdin, int fd
 asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
 					unsigned int flags);
 
+asmlinkage long sys_netchannel_control(void __user *arg);
+
 #endif
kernel/sys_ni.c +2 -0
index 5433195..1747fc3 100644
@@ -132,3 +132,5 @@ cond_syscall(sys_mincore);
 cond_syscall(sys_madvise);
 cond_syscall(sys_mremap);
 cond_syscall(sys_remap_file_pages);
+
+cond_syscall(sys_netchannel_control);
net/Kconfig +8 -0
index 4193cdc..465e37b 100644
@@ -66,6 +66,14 @@ source "net/ipv6/Kconfig"
 
 endif # if INET
 
+config NETCHANNEL
+	bool "Network channels"
+	---help---
+	  Network channels are peer-to-peer abstraction, which allows to create
+	  high performance communications. 
+	  Main advantages are unified address cache, protocol processing moved
+	  to userspace, receiving zero-copy support and other interesting features.
+
 menuconfig NETFILTER
 	bool "Network packet filtering (replaces ipchains)"
 	---help---
net/core/Makefile +1 -0
index 79fe12c..7119812 100644
@@ -16,3 +16,4 @@ obj-$(CONFIG_NET_DIVERT) += dv.o
 obj-$(CONFIG_NET_PKTGEN) += pktgen.o
 obj-$(CONFIG_WIRELESS_EXT) += wireless.o
 obj-$(CONFIG_NETPOLL) += netpoll.o
+obj-$(CONFIG_NETCHANNEL) += netchannel.o
net/core/datagram.c +5 -2
index aecddcc..3db8873 100644
@@ -235,6 +235,8 @@ void skb_kill_datagram(struct sock *sk, 
 
 EXPORT_SYMBOL(skb_kill_datagram);
 
+typedef int (* copy_iovec_t)(struct iovec *iov, unsigned char *kdata, int len);
+
 /**
  *	skb_copy_datagram_iovec - Copy a datagram to an iovec.
  *	@skb: buffer to copy
@@ -249,12 +251,13 @@ int skb_copy_datagram_iovec(const struct
 {
 	int start = skb_headlen(skb);
 	int i, copy = start - offset;
+	copy_iovec_t func = (skb->netchannel)?&memcpy_toiovec_copy:&memcpy_toiovec;
 
 	/* Copy header. */
 	if (copy > 0) {
 		if (copy > len)
 			copy = len;
-		if (memcpy_toiovec(to, skb->data + offset, copy))
+		if (func(to, skb->data + offset, copy))
 			goto fault;
 		if ((len -= copy) == 0)
 			return 0;
@@ -277,7 +280,7 @@ int skb_copy_datagram_iovec(const struct
 			if (copy > len)
 				copy = len;
 			vaddr = kmap(page);
-			err = memcpy_toiovec(to, vaddr + frag->page_offset +
+			err = func(to, vaddr + frag->page_offset +
 					     offset - start, copy);
 			kunmap(page);
 			if (err)
net/core/dev.c +4 -0
index 9ab3cfa..2721111 100644
@@ -1712,6 +1712,10 @@ int netif_receive_skb(struct sk_buff *sk
 		}
 	}
 
+	ret = netchannel_recv(skb);
+	if (!ret)
+		goto out;
+
 #ifdef CONFIG_NET_CLS_ACT
 	if (pt_prev) {
 		ret = deliver_skb(skb, pt_prev, orig_dev);
net/core/iovec.c +18 -0
index 65e4b56..8d19ed7 100644
@@ -98,6 +98,23 @@ int memcpy_toiovec(struct iovec *iov, un
 	return 0;
 }
 
+int memcpy_toiovec_copy(struct iovec *iov, unsigned char *kdata, int len)
+{
+	while (len > 0) {
+		if (iov->iov_len) {
+			int copy = min_t(unsigned int, iov->iov_len, len);
+			memcpy(iov->iov_base, kdata, copy);
+			kdata += copy;
+			len -= copy;
+			iov->iov_len -= copy;
+			iov->iov_base += copy;
+		}
+		iov++;
+	}
+
+	return 0;
+}
+
 /*
  *	Copy iovec to kernel. Returns -EFAULT on error.
  *
@@ -237,3 +254,4 @@ EXPORT_SYMBOL(csum_partial_copy_fromiove
 EXPORT_SYMBOL(memcpy_fromiovec);
 EXPORT_SYMBOL(memcpy_fromiovecend);
 EXPORT_SYMBOL(memcpy_toiovec);
+EXPORT_SYMBOL(memcpy_toiovec_copy);
net/core/netchannel.c new file +1201 -0

1,201 lines not on this page · raw message

net/core/skbuff.c +1 -0
index fb3770f..f979fd6 100644
@@ -437,6 +437,7 @@ struct sk_buff *skb_clone(struct sk_buff
 	C(pkt_type);
 	C(ip_summed);
 	C(priority);
+	C(netchannel);
 #if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
 	C(ipvs_property);
 #endif
net/ipv4/tcp_ipv4.c +11 -2
index 672950e..eb2dc12 100644
@@ -727,7 +727,10 @@ int tcp_v4_conn_request(struct sock *sk,
 #endif
 
 	/* Never answer to SYNs send to broadcast or multicast */
-	if (((struct rtable *)skb->dst)->rt_flags &
+	if (!skb->dst) {
+		if (MULTICAST(daddr))
+			goto drop;
+	} else if (((struct rtable *)skb->dst)->rt_flags &
 	    (RTCF_BROADCAST | RTCF_MULTICAST))
 		goto drop;
 
@@ -924,15 +927,21 @@ static struct sock *tcp_v4_hnd_req(struc
 	struct iphdr *iph = skb->nh.iph;
 	struct sock *nsk;
 	struct request_sock **prev;
+	int iif;
 	/* Find possible connection requests. */
 	struct request_sock *req = inet_csk_search_req(sk, &prev, th->source,
 						       iph->saddr, iph->daddr);
 	if (req)
 		return tcp_check_req(sk, skb, req, prev);
 
+	if (!skb->dst)
+		iif = 0;
+	else
+		iif = inet_iif(skb);
+
 	nsk = __inet_lookup_established(&tcp_hashinfo, skb->nh.iph->saddr,
 					th->source, skb->nh.iph->daddr,
-					ntohs(th->dest), inet_iif(skb));
+					ntohs(th->dest), iif);
 
 	if (nsk) {
 		if (nsk->sk_state != TCP_TIME_WAIT) {
Signature · 1 line
	Evgeniy Polyakov
#1 lore raw
Quoted 4 lines · Evgeniy Polyakov

After some enhancements made for netchannel subsystem I'm pleased to announce, that netchannel subsystem outperforms existing layered design both in CPU usage and network speed.

Quoted 8 lines

Well, after such pretentious introduction I want to cool things down. CPU usage is about 1-2% less for netchannels and network performance is about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).

It is stable and 100% reproductible result.

Performance graph and patch are attached.

Hmm, graph has been attached now.

Signature · 1 line
	Evgeniy Polyakov
#2 lore raw
In reply to Evgeniy Polyakov
Quoted 8 lines · you

After some enhancements made for netchannel subsystem I'm pleased to announce, that netchannel subsystem outperforms existing layered design both in CPU usage and network speed.

Well, after such pretentious introduction I want to cool things down. CPU usage is about 1-2% less for netchannels and network performance is about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).

I have followed your work closely and have wondered how it affects latency? I have somewhat limited knowledge about TCP and how the kernel handles it, but I guess the path from NIC to userspace hasn't increased. What about syscall overhead caused by userspace TCP processing?

H³

#3 lore raw
Quoted 10 lines · Hans Henrik Happe
Quoted 8 lines · you

After some enhancements made for netchannel subsystem I'm pleased to announce, that netchannel subsystem outperforms existing layered design both in CPU usage and network speed.

Well, after such pretentious introduction I want to cool things down. CPU usage is about 1-2% less for netchannels and network performance is about 1-2 MB higher and sometimes exceeds 84 MB/sec which, I think, is maximum for given network setup (e1000 receive, r8169 send, 1500 MTU).

Quoted 4 lines

I have followed your work closely and have wondered how it affects latency? I have somewhat limited knowledge about TCP and how the kernel handles it, but I guess the path from NIC to userspace hasn't increased. What about syscall overhead caused by userspace TCP processing?

Path from NIC to userspace was decreased in that way that there are less number of context switches, much smaller amount of work being done in softirq (I have not modified driver and still use NAPI), less cache thrashing due to work ping-ponging and less number of locks. Number of syscalls is still the same - either one recv() or one netchannel_control() to read the same block of data.

But since existing socket code is used, gain is not that big, since sockets are locked, although they should not, skbs are requeued, ACKs are scheduled, although all that could be changed.

At least receiving part of the netchannel TCP processing could be different. And my thoughts move in that direction.

Quoted 1 line

H³

Signature · 1 line
	Evgeniy Polyakov
#4 lore raw

Netchannels: alternative TCP/IP stack?

In reply to Evgeniy Polyakov

Hello, developers.

I've implemented simple rfc793 TCP/IP stack, which is currently tested in userspace through packet socket. After ISO (~650Mb) transfer over gigabit ethernet between two Linux boxes, file was not corrupted.

I would even say that stack is really trivial (1800 lines of code, 42K of sources where TCP state machine takes about 12K), but it includes:
* routing table for src/dst IP and MAC addresses (O(n) access). It includes static destination routing and ARP cache. No dynamic ARP probes.
* socket-like (actually netchannel-like) interface for data reading.
* ethernet sending/receiving support.
* IP sending/receiving support.
* TCP (rfc793) state machine implementation.
* UDP code (not tested).

Current code does not have options and TCP extensions, ack generation does not use any heueristics, no congestion control, no prediction (although I have some doubts about that idea), no ICMP. Sending was not tested yet.
Next option in agenda is to check various loss and reordering issues. Then I plan to implement PAWS and timestamp TCP option. MSS option would be usefull too.

I want to run various tests with congestions to collect some statistic about generic TCP/IP behaviour, so I would like to ask
how much it will be frowned upon if I will use that simple stack for netchannels (I plan to use only alternative TCP part with generic Linux routing tables, IP and ethernet processing and so on)
and if miracle happens (it happens sometimes) and results will be better than it is now [1] (it is planned if paid job will not get all the time) and I will start pushing it upstream?
Or is it better to just make lobotomy right now?

1. Netchannel benchmarks vs. socket code.
http://tservice.net.ru/~s0mbre/old/?section=projects&item=netchannel

Thank you.

Signature · 1 line
	Evgeniy Polyakov
#5 lore raw

Netchannels: progress report.

Implemented alternative userspace TCP/IP stack which supports:
1. TCP/UDP/IP sending and receiving.
2. Timestamp, window scaling and MSS TCP options.
3. Slow start and congestion control (trivial though).
4. PAWS.
5. Trivial route table (route list) including static MAC cache.
6. IP and ethernet frame processing.
7. netchannel-like interface for sending/receiving/connecting.

Some fancy algos (very simple) were imported into ACK generation and sending data combining code.

I started to put that code into kernel netchannel [1] implementation. Receiving is fully supported with 3-4 MB (2<<20 bytes) per second performance win over usual socket code (tuned for maximum performance).

Sender of data is wrong for benchmarking purposes though: it is netcat which reads data from stdin (where big file is being read).

After some investigation it was proven that there is some bottleneck in the sending size.

Socket -> socket: ~69-70 MB/sec
Socket -> netchannel: ~72-73 MB/sec

Next thing is to test netchannel sending support, which was only tested with userspace implementation over packet socket.

Attached development patch with a lot of debug cruft for curious reader.

I received several very positive feedbacks from various people about this project, thank you.

arch/i386/kernel/syscall_table.S +2 -0
index f48bef1..7a4a758 100644
@@ -315,3 +315,5 @@ ENTRY(sys_call_table)
 	.long sys_splice
 	.long sys_sync_file_range
 	.long sys_tee			/* 315 */
+	.long sys_vmsplice
+	.long sys_netchannel_control
arch/x86_64/ia32/ia32entry.S +1 -0
index 5a92fed..fdfb997 100644
@@ -696,4 +696,5 @@ #endif
 	.quad sys_sync_file_range
 	.quad sys_tee
 	.quad compat_sys_vmsplice
+	.quad sys_netchannel_control
 ia32_syscall_end:		
include/asm-i386/unistd.h +2 -1
index eb4b152..777cd85 100644
@@ -322,8 +322,9 @@ #define __NR_splice		313
 #define __NR_sync_file_range	314
 #define __NR_tee		315
 #define __NR_vmsplice		316
+#define __NR_netchannel_control	317
 
-#define NR_syscalls 317
+#define NR_syscalls 318
 
 /*
  * user-visible error numbers are in the range -1 - -128: see
include/asm-x86_64/unistd.h +3 -1
index feb77cb..08c230e 100644
@@ -617,8 +617,10 @@ #define __NR_sync_file_range	277
 __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
 #define __NR_vmsplice		278
 __SYSCALL(__NR_vmsplice, sys_vmsplice)
+#define __NR_netchannel_control	279
+__SYSCALL(__NR_vmsplice, sys_netchannel_control)
 
-#define __NR_syscall_max __NR_vmsplice
+#define __NR_syscall_max __NR_netchannel_control
 
 #ifndef __NO_STUBS
 
include/linux/netchannel.h new file +140 -0

140 lines not on this page · raw message

include/linux/netdevice.h +9 -0
index a461b51..9924911 100644
@@ -684,6 +684,15 @@ extern void		dev_queue_xmit_nit(struct s
 
 extern void		dev_init(void);
 
+#ifdef CONFIG_NETCHANNEL
+extern int netchannel_recv(struct sk_buff *skb);
+#else
+static int netchannel_recv(struct sk_buff *skb) 
+{ 
+	return -1;
+}
+#endif
+
 extern int		netdev_nit;
 extern int		netdev_budget;
 
include/linux/skbuff.h +12 -0
@@ -314,6 +315,18 @@ static inline struct sk_buff *alloc_skb(
 	return __alloc_skb(size, priority, 0);
 }
 
+#ifdef CONFIG_NETCHANNEL
+struct unetchannel;
+extern struct sk_buff *netchannel_alloc(struct unetchannel *unc, unsigned int header_size, 
+		unsigned int total_size, gfp_t gfp_mask);
+#else
+static struct sk_buff *netchannel_alloc(void *unc, unsigned int header_size, 
+		unsigned int total_size, gfp_t gfp_mask)
+{
+	return NULL;
+}
+#endif
+
 static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
 					       gfp_t priority)
 {
include/linux/syscalls.h +2 -0
index 3996960..8c22875 100644
@@ -582,4 +582,6 @@ asmlinkage long sys_tee(int fdin, int fd
 asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
 					unsigned int flags);
 
+asmlinkage long sys_netchannel_control(void __user *arg);
+
 #endif
kernel/sys_ni.c +2 -0
index 5433195..1747fc3 100644
@@ -132,3 +132,5 @@ cond_syscall(sys_mincore);
 cond_syscall(sys_madvise);
 cond_syscall(sys_mremap);
 cond_syscall(sys_remap_file_pages);
+
+cond_syscall(sys_netchannel_control);
net/Kconfig +8 -0
index 4193cdc..465e37b 100644
@@ -66,6 +66,14 @@ source "net/ipv6/Kconfig"
 
 endif # if INET
 
+config NETCHANNEL
+	bool "Network channels"
+	---help---
+	  Network channels are peer-to-peer abstraction, which allows to create
+	  high performance communications. 
+	  Main advantages are unified address cache, protocol processing moved
+	  to userspace, receiving zero-copy support and other interesting features.
+
 menuconfig NETFILTER
 	bool "Network packet filtering (replaces ipchains)"
 	---help---
net/core/Makefile +1 -0
index 79fe12c..7119812 100644
@@ -16,3 +16,4 @@ obj-$(CONFIG_NET_DIVERT) += dv.o
 obj-$(CONFIG_NET_PKTGEN) += pktgen.o
 obj-$(CONFIG_WIRELESS_EXT) += wireless.o
 obj-$(CONFIG_NETPOLL) += netpoll.o
+obj-$(CONFIG_NETCHANNEL) += netchannel.o
net/core/dev.c +4 -0
index 9ab3cfa..2721111 100644
@@ -1712,6 +1712,10 @@ #endif
 		}
 	}
 
+	ret = netchannel_recv(skb);
+	if (!ret)
+		goto out;
+
 #ifdef CONFIG_NET_CLS_ACT
 	if (pt_prev) {
 		ret = deliver_skb(skb, pt_prev, orig_dev);
net/core/netchannel.c new file +1141 -0

1,141 lines not on this page · raw message

net/ipv4/Kconfig +5 -0
index e40f753..6ea6379 100644
@@ -428,6 +428,11 @@ config INET_TCP_DIAG
 	depends on INET_DIAG
 	def_tristate INET_DIAG
 
+config ATCP
+	bool "TCP: altenative TCP stack used for netchannels"
+	---help---
+	  Extremely lightweight RFC compliant TCP stack used for netchannels.
+
 config TCP_CONG_ADVANCED
 	bool "TCP: advanced congestion control"
 	---help---
net/ipv4/Makefile +1 -0
index 9ef50a0..25c122f 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybl
 obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o
 obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o
 obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o
+obj-$(CONFIG_ATCP) += atcp.o
 
 obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
 		      xfrm4_output.o
net/ipv4/atcp.c new file +1434 -0

1,434 lines not on this page · raw message

Signature · 1 line
	Evgeniy Polyakov
#6 lore raw

Re: Netchannels: progress report.

include/asm-x86_64/unistd.h #define __NR_sync_file_range 277 · line 621

Quoted 2 lines · Evgeniy Polyakov
include/asm-x86_64/unistd.h +2 -0
+#define __NR_netchannel_control	279
+__SYSCALL(__NR_vmsplice, sys_netchannel_control)

This looks wrong.

Signature · 2 lines
James Morris
<[email protected]>
#7 lore raw

Re: Netchannels: progress report.

Quoted 6 lines · James Morris

include/asm-x86_64/unistd.h #define __NR_sync_file_range 277 · line 621

Quoted 2 lines · Evgeniy Polyakov
include/asm-x86_64/unistd.h +2 -0
+#define __NR_netchannel_control	279
+__SYSCALL(__NR_vmsplice, sys_netchannel_control)

This looks wrong.

Ugh, it's my hand merge for x86_64.
Thank you for spotting this, James.

Quoted 3 lines
Signature · 2 lines
James Morris
<[email protected]>
Signature · 1 line
	Evgeniy Polyakov
#8 lore raw

Netchannels: progress report. Sending benchmark.

In reply to Evgeniy Polyakov

After week vacations I'm pleased to announce following progress report.

Numbers for small packets (80 bytes) bulk sending:

* netchannel: 57 MB/sec, ~80% CPU usage
* socket: 22 MB/sec, ~90% CPU usage

Receiving side is netcat server, which dumps received data into /dev/null

Actually it is not 100% correct to call that results correct, since it uses hackish optimisations, which can lead to broken behaviour for non-bulk transfers or transfers over bad lines. If some of them are removed, speed drops to 54 MB/sec for 80 bytes packets, and if socket analog for NODELAY flag is set, i.e. each packet is immediately being sent when it has been written, speed drops down to 16 MB/sec (socket with SO_NODELAY was not tested though).

Netchannel homepage:
http://tservice.net.ru/~s0mbre/old/?section=projects&item=netchannel

arch/i386/kernel/syscall_table.S +2 -0
index f48bef1..7a4a758 100644
@@ -315,3 +315,5 @@ ENTRY(sys_call_table)
 	.long sys_splice
 	.long sys_sync_file_range
 	.long sys_tee			/* 315 */
+	.long sys_vmsplice
+	.long sys_netchannel_control
arch/x86_64/ia32/ia32entry.S +1 -0
index 5a92fed..fdfb997 100644
@@ -696,4 +696,5 @@ #endif
 	.quad sys_sync_file_range
 	.quad sys_tee
 	.quad compat_sys_vmsplice
+	.quad sys_netchannel_control
 ia32_syscall_end:		
include/asm-i386/unistd.h +2 -1
index eb4b152..777cd85 100644
@@ -322,8 +322,9 @@ #define __NR_splice		313
 #define __NR_sync_file_range	314
 #define __NR_tee		315
 #define __NR_vmsplice		316
+#define __NR_netchannel_control	317
 
-#define NR_syscalls 317
+#define NR_syscalls 318
 
 /*
  * user-visible error numbers are in the range -1 - -128: see
include/asm-x86_64/unistd.h +3 -1
index feb77cb..4459bad 100644
@@ -617,8 +617,10 @@ #define __NR_sync_file_range	277
 __SYSCALL(__NR_sync_file_range, sys_sync_file_range)
 #define __NR_vmsplice		278
 __SYSCALL(__NR_vmsplice, sys_vmsplice)
+#define __NR_netchannel_control	279
+__SYSCALL(__NR_netchannel_control, sys_netchannel_control)
 
-#define __NR_syscall_max __NR_vmsplice
+#define __NR_syscall_max __NR_netchannel_control
 
 #ifndef __NO_STUBS
 
include/linux/netchannel.h new file +142 -0

142 lines not on this page · raw message

include/linux/netdevice.h +9 -0
index a461b51..9924911 100644
@@ -684,6 +684,15 @@ extern void		dev_queue_xmit_nit(struct s
 
 extern void		dev_init(void);
 
+#ifdef CONFIG_NETCHANNEL
+extern int netchannel_recv(struct sk_buff *skb);
+#else
+static int netchannel_recv(struct sk_buff *skb) 
+{ 
+	return -1;
+}
+#endif
+
 extern int		netdev_nit;
 extern int		netdev_budget;
 
include/linux/skbuff.h +12 -0
index f8f2347..ba82aa2 100644
@@ -314,6 +314,18 @@ static inline struct sk_buff *alloc_skb(
 	return __alloc_skb(size, priority, 0);
 }
 
+#ifdef CONFIG_NETCHANNEL
+struct unetchannel;
+extern struct sk_buff *netchannel_alloc(struct unetchannel *unc, unsigned int header_size, 
+		unsigned int total_size, gfp_t gfp_mask);
+#else
+static struct sk_buff *netchannel_alloc(void *unc, unsigned int header_size, 
+		unsigned int total_size, gfp_t gfp_mask)
+{
+	return NULL;
+}
+#endif
+
 static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
 					       gfp_t priority)
 {
include/linux/syscalls.h +2 -0
index 3996960..8c22875 100644
@@ -582,4 +582,6 @@ asmlinkage long sys_tee(int fdin, int fd
 asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes,
 					unsigned int flags);
 
+asmlinkage long sys_netchannel_control(void __user *arg);
+
 #endif
kernel/sys_ni.c +2 -0
index 5433195..1747fc3 100644
@@ -132,3 +132,5 @@ cond_syscall(sys_mincore);
 cond_syscall(sys_madvise);
 cond_syscall(sys_mremap);
 cond_syscall(sys_remap_file_pages);
+
+cond_syscall(sys_netchannel_control);
net/Kconfig +8 -0
index 4193cdc..465e37b 100644
@@ -66,6 +66,14 @@ source "net/ipv6/Kconfig"
 
 endif # if INET
 
+config NETCHANNEL
+	bool "Network channels"
+	---help---
+	  Network channels are peer-to-peer abstraction, which allows to create
+	  high performance communications. 
+	  Main advantages are unified address cache, protocol processing moved
+	  to userspace, receiving zero-copy support and other interesting features.
+
 menuconfig NETFILTER
 	bool "Network packet filtering (replaces ipchains)"
 	---help---
net/core/Makefile +1 -0
index 79fe12c..7119812 100644
@@ -16,3 +16,4 @@ obj-$(CONFIG_NET_DIVERT) += dv.o
 obj-$(CONFIG_NET_PKTGEN) += pktgen.o
 obj-$(CONFIG_WIRELESS_EXT) += wireless.o
 obj-$(CONFIG_NETPOLL) += netpoll.o
+obj-$(CONFIG_NETCHANNEL) += netchannel.o
net/core/dev.c +4 -0
index 9ab3cfa..2721111 100644
@@ -1712,6 +1712,10 @@ #endif
 		}
 	}
 
+	ret = netchannel_recv(skb);
+	if (!ret)
+		goto out;
+
 #ifdef CONFIG_NET_CLS_ACT
 	if (pt_prev) {
 		ret = deliver_skb(skb, pt_prev, orig_dev);
net/core/netchannel.c new file +1188 -0

1,188 lines not on this page · raw message

net/ipv4/Kconfig +5 -0
index e40f753..6ea6379 100644
@@ -428,6 +428,11 @@ config INET_TCP_DIAG
 	depends on INET_DIAG
 	def_tristate INET_DIAG
 
+config ATCP
+	bool "TCP: altenative TCP stack used for netchannels"
+	---help---
+	  Extremely lightweight RFC compliant TCP stack used for netchannels.
+
 config TCP_CONG_ADVANCED
 	bool "TCP: advanced congestion control"
 	---help---
net/ipv4/Makefile +1 -0
index 9ef50a0..25c122f 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_TCP_CONG_HYBLA) += tcp_hybl
 obj-$(CONFIG_TCP_CONG_HTCP) += tcp_htcp.o
 obj-$(CONFIG_TCP_CONG_VEGAS) += tcp_vegas.o
 obj-$(CONFIG_TCP_CONG_SCALABLE) += tcp_scalable.o
+obj-$(CONFIG_ATCP) += atcp.o
 
 obj-$(CONFIG_XFRM) += xfrm4_policy.o xfrm4_state.o xfrm4_input.o \
 		      xfrm4_output.o
net/ipv4/atcp.c new file +1482 -0

1,482 lines not on this page · raw message

Signature · 1 line
	Evgeniy Polyakov
#9 lore raw

Re: Netchannels: progress report. Sending benchmark.

Quoted 10 lines · Evgeniy Polyakov

After week vacations I'm pleased to announce following progress report.

Numbers for small packets (80 bytes) bulk sending:

* netchannel: 57 MB/sec, ~80% CPU usage
* socket: 22 MB/sec, ~90% CPU usage

Receiving side is netcat server, which dumps received data into /dev/null

Quoted 7 lines

Actually it is not 100% correct to call that results correct, since it uses hackish optimisations, which can lead to broken behaviour for non-bulk transfers or transfers over bad lines. If some of them are removed, speed drops to 54 MB/sec for 80 bytes packets, and if socket analog for NODELAY flag is set, i.e. each packet is immediately being sent when it has been written, speed drops down to 16 MB/sec (socket with SO_NODELAY was not tested though).

I mean TCP_NODELAY.
Socket code uses nonblocking mode and epoll.

Signature · 1 line
	Evgeniy Polyakov