|
net: add special netFD mutex
The mutex, fdMutex, handles locking and lifetime of sysfd,
and serializes Read and Write methods.
This allows to strip 2 sync.Mutex.Lock calls,
2 sync.Mutex.Unlock calls, 1 defer and some amount
of misc overhead from every network operation.
On linux/amd64, Intel E5-2690:
benchmark old ns/op new ns/op delta
BenchmarkTCP4Persistent 9595 9454 -1.47%
BenchmarkTCP4Persistent-2 8978 8772 -2.29%
BenchmarkTCP4ConcurrentReadWrite 4900 4625 -5.61%
BenchmarkTCP4ConcurrentReadWrite-2 2603 2500 -3.96%
In general it strips 70-500 ns from every network operation depending
on processor model. On my relatively new E5-2690 it accounts to ~5%
of network op cost.
Fixes issue 6074.
Total comments: 24
Total comments: 13
Total comments: 8
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+553 lines, -179 lines) |
Patch |
 |
A |
src/pkg/net/fd_mutex.go
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
1 chunk |
+184 lines, -0 lines |
0 comments
|
Download
|
 |
A |
src/pkg/net/fd_mutex_test.go
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
1 chunk |
+186 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/fd_poll_runtime.go
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/net/fd_unix.go
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
13 chunks |
+69 lines, -66 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/fd_windows.go
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
11 chunks |
+69 lines, -65 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sendfile_freebsd.go
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
1 chunk |
+2 lines, -4 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sendfile_linux.go
|
View
|
1
2
3
|
1 chunk |
+2 lines, -4 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sendfile_windows.go
|
View
|
1
2
3
4
5
6
|
1 chunk |
+3 lines, -4 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sockopt_posix.go
|
View
|
1
2
3
4
5
6
7
8
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sockoptip_bsd.go
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sockoptip_linux.go
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sockoptip_posix.go
|
View
|
1
2
3
4
5
6
7
8
|
4 chunks |
+4 lines, -4 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/sockoptip_windows.go
|
View
|
1
2
3
4
5
6
7
8
9
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
src/pkg/net/tcpsockopt_darwin.go
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/net/tcpsockopt_openbsd.go
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/net/tcpsockopt_posix.go
|
View
|
1
2
3
4
5
6
7
8
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/net/tcpsockopt_unix.go
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/net/tcpsockopt_windows.go
|
View
|
1
2
3
4
5
6
7
8
9
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mgc0.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/mprof.goc
|
View
|
1
2
3
4
5
6
7
8
|
2 chunks |
+2 lines, -2 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/netpoll.goc
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
1 chunk |
+8 lines, -0 lines |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/proc.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/race.c
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/runtime.h
|
View
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
 |
M |
src/pkg/runtime/sema.goc
|
View
|
1
2
3
4
5
6
7
8
|
3 chunks |
+3 lines, -9 lines |
0 comments
|
Download
|
Total messages: 21
|