From: Gao Feng <redacted>
Because the value of SO_SNDBUF and SO_RCVBUF is doubled before
assignment, so the real value of send and recv buffer could be more
than the max sysctl config sysctl_wmem_max and sysctl_rmem_max.
Now use doulbe send/recv buffer value to compare with sysctl_wmem_max
and sysctl_rmem_max, and it keeps consistence with SOCK_MIN_SNDBUF
and SOCK_MIN_RCVBUF.
Signed-off-by: Gao Feng <redacted>
---
net/core/sock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -712,7 +712,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,*play'guessthebiggestsize'games.RCVBUF/SNDBUF*aretreatedinBSDashints*/-val=min_t(u32,val,sysctl_wmem_max);+val=min_t(u32,val*2,sysctl_wmem_max);set_sndbuf:sk->sk_userlocks|=SOCK_SNDBUF_LOCK;sk->sk_sndbuf=max_t(int,val*2,SOCK_MIN_SNDBUF);
@@ -733,7 +733,7 @@ int sock_setsockopt(struct socket *sock, int level, int optname,*play'guessthebiggestsize'games.RCVBUF/SNDBUF*aretreatedinBSDashints*/-val=min_t(u32,val,sysctl_rmem_max);+val=min_t(u32,val*2,sysctl_rmem_max);set_rcvbuf:sk->sk_userlocks|=SOCK_RCVBUF_LOCK;/*
From: Eric Dumazet <hidden> Date: 2017-02-08 16:00:32
On Wed, 2017-02-08 at 21:07 +0800, fgao@ikuai8.com wrote:
From: Gao Feng <redacted>
Because the value of SO_SNDBUF and SO_RCVBUF is doubled before
assignment, so the real value of send and recv buffer could be more
than the max sysctl config sysctl_wmem_max and sysctl_rmem_max.
Now use doulbe send/recv buffer value to compare with sysctl_wmem_max
and sysctl_rmem_max, and it keeps consistence with SOCK_MIN_SNDBUF
and SOCK_MIN_RCVBUF.
Signed-off-by: Gao Feng <redacted>
---
Looks completely bogus, based on your comprehension of this code.
If you need to, fix the doc, not this code.
Unless you give more details of course, why we should take your patch.
On Thu, Feb 9, 2017 at 12:00 AM, Eric Dumazet [off-list ref] wrote:
On Wed, 2017-02-08 at 21:07 +0800, fgao@ikuai8.com wrote:
quoted
From: Gao Feng <redacted>
Because the value of SO_SNDBUF and SO_RCVBUF is doubled before
assignment, so the real value of send and recv buffer could be more
than the max sysctl config sysctl_wmem_max and sysctl_rmem_max.
Now use doulbe send/recv buffer value to compare with sysctl_wmem_max
and sysctl_rmem_max, and it keeps consistence with SOCK_MIN_SNDBUF
and SOCK_MIN_RCVBUF.
Signed-off-by: Gao Feng <redacted>
---
Looks completely bogus, based on your comprehension of this code.
It is a config param, user could config any value.
So why give it one bogus?
If need more, user could config it by himself.
If you need to, fix the doc, not this code.
The current codes mean the buffer could exceed the sysctl max value.
It seems inconsistent.
Regards
Feng
Unless you give more details of course, why we should take your patch.
From: Eric Dumazet <hidden> Date: 2017-02-09 14:35:02
On Thu, 2017-02-09 at 17:08 +0800, Gao Feng wrote:
On Thu, Feb 9, 2017 at 12:00 AM, Eric Dumazet [off-list ref] wrote:
quoted
On Wed, 2017-02-08 at 21:07 +0800, fgao@ikuai8.com wrote:
quoted
From: Gao Feng <redacted>
Because the value of SO_SNDBUF and SO_RCVBUF is doubled before
assignment, so the real value of send and recv buffer could be more
than the max sysctl config sysctl_wmem_max and sysctl_rmem_max.
Now use doulbe send/recv buffer value to compare with sysctl_wmem_max
and sysctl_rmem_max, and it keeps consistence with SOCK_MIN_SNDBUF
and SOCK_MIN_RCVBUF.
Signed-off-by: Gao Feng <redacted>
---
Looks completely bogus, based on your comprehension of this code.
It is a config param, user could config any value.
So why give it one bogus?
If need more, user could config it by himself.
quoted
If you need to, fix the doc, not this code.
The current codes mean the buffer could exceed the sysctl max value.
It seems inconsistent.
Well, after your patch, we end up doubling what the user requested.
Say user used val = 20000
val = min_t(u32, val * 2, sysctl_wmem_max);
Now val is 40000.
sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
Now sk_sndbuf is 80000, or am I missing something ?
Before your patch, sk_sndbuf was 40000. See the difference ?
Some applications carefully tuned this, some people care about
bufferbloat.
This is too late now to change this behavior, especially the way you did
it, breaking some applications.
Unless you can show me a real application that hit an issue, I will not
accept your patch.
From: kernel test robot <hidden> Date: 2017-02-15 01:47:04
FYI, we noticed the following commit:
commit: 0148239373801a9c0c63eefc481b710ae7ce2941 ("net: sock: Use double send/recv buff value to compare with max value")
url: https://github.com/0day-ci/linux/commits/fgao-ikuai8-com/net-sock-Use-double-send-recv-buff-value-to-compare-with-max-value/20170208-213745
in testcase: ltp
with following parameters:
test: net.sctp
test-description: The LTP testsuite contains a collection of tools for testing the Linux kernel and related features.
test-url: http://linux-test-project.github.io/
on test machine: 88 threads Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz with 128G memory
caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
user :notice: [ 54.674772] tag=test_1_to_1_sockopt stime=1487093637
user :notice: [ 54.675078] cmdline="test_1_to_1_sockopt"
user :notice: [ 54.675194] contacts=""
user :notice: [ 54.675333] analysis=exit
user :notice: [ 54.675513] <<<test_output>>>
user :notice: [ 54.676497] test_1_to_1_sockopt.c 1 TPASS : setsockopt() with a bad socket descriptor - EBADF
user :notice: [ 54.677439] test_1_to_1_sockopt.c 2 TPASS : setsockopt() with an invalid socket - ENOTSOCK
user :notice: [ 54.678409] test_1_to_1_sockopt.c 3 TPASS : setsockopt() with an invalid level - ENOPROTOOPT
user :notice: [ 54.679378] test_1_to_1_sockopt.c 4 TPASS : setsockopt() with invalid option buffer - EFAULT
user :notice: [ 54.680375] test_1_to_1_sockopt.c 5 TPASS : setsockopt() with invalid option name - EOPNOTSUPP
user :notice: [ 54.681354] test_1_to_1_sockopt.c 6 TPASS : getsockopt() with a bad socket descriptor - EBADF
user :notice: [ 54.682297] test_1_to_1_sockopt.c 7 TPASS : getsockopt() with an invalid socket - ENOTSOCK
user :notice: [ 54.683265] test_1_to_1_sockopt.c 8 TPASS : getsockopt() with invalid option buffer - EFAULT
user :notice: [ 54.684267] test_1_to_1_sockopt.c 9 TPASS : getsockopt() with invalid option name - EOPNOTSUPP
user :notice: [ 54.685079] test_1_to_1_sockopt.c 10 TPASS : getsockopt() SCTP_INITMSG - SUCCESS
user :notice: [ 54.685885] test_1_to_1_sockopt.c 11 TPASS : setsockopt() SCTP_INITMSG - SUCCESS
user :notice: [ 54.686653] test_1_to_1_sockopt.c 12 TPASS : setsockopt() SO_LINGER - SUCCESS
user :notice: [ 54.687418] test_1_to_1_sockopt.c 13 TPASS : getsockopt() SO_LINGER - SUCCESS
user :notice: [ 54.688187] test_1_to_1_sockopt.c 14 TPASS : getsockopt() SO_RCVBUF - SUCCESS
user :notice: [ 54.688979] test_1_to_1_sockopt.c 15 TPASS : getsockopt() SCTP_STATUS - SUCCESS
user :notice: [ 54.689752] test_1_to_1_sockopt.c 16 TPASS : setsockopt() SO_RCVBUF - SUCCESS
user :notice: [ 54.691539] test_1_to_1_sockopt.c 17 TBROK : test_1_to_1_sockopt.c:341: Comparison failed:Set value and got value differs Set Value=4096 Get Value=8192
user :notice: [ 54.692520] test_1_to_1_sockopt.c 18 TBROK : test_1_to_1_sockopt.c:341: Remaining cases broken
To reproduce:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/wfg/lkp-tests.git
cd lkp-tests
bin/lkp install job.yaml # job file is attached in this email
bin/lkp run job.yaml
Thanks,
Xiaolong
Hi Xiaolong,
On Wed, Feb 15, 2017 at 9:46 AM, kernel test robot
[off-list ref] wrote:
FYI, we noticed the following commit:
commit: 0148239373801a9c0c63eefc481b710ae7ce2941 ("net: sock: Use double send/recv buff value to compare with max value")
url: https://github.com/0day-ci/linux/commits/fgao-ikuai8-com/net-sock-Use-double-send-recv-buff-value-to-compare-with-max-value/20170208-213745
in testcase: ltp
with following parameters:
test: net.sctp
test-description: The LTP testsuite contains a collection of tools for testing the Linux kernel and related features.
test-url: http://linux-test-project.github.io/
on test machine: 88 threads Intel(R) Xeon(R) CPU E5-2699 v4 @ 2.20GHz with 128G memory
caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):
user :notice: [ 54.674772] tag=test_1_to_1_sockopt stime=1487093637
user :notice: [ 54.675078] cmdline="test_1_to_1_sockopt"
user :notice: [ 54.675194] contacts=""
user :notice: [ 54.675333] analysis=exit
user :notice: [ 54.675513] <<<test_output>>>
user :notice: [ 54.676497] test_1_to_1_sockopt.c 1 TPASS : setsockopt() with a bad socket descriptor - EBADF
user :notice: [ 54.677439] test_1_to_1_sockopt.c 2 TPASS : setsockopt() with an invalid socket - ENOTSOCK
user :notice: [ 54.678409] test_1_to_1_sockopt.c 3 TPASS : setsockopt() with an invalid level - ENOPROTOOPT
user :notice: [ 54.679378] test_1_to_1_sockopt.c 4 TPASS : setsockopt() with invalid option buffer - EFAULT
user :notice: [ 54.680375] test_1_to_1_sockopt.c 5 TPASS : setsockopt() with invalid option name - EOPNOTSUPP
user :notice: [ 54.681354] test_1_to_1_sockopt.c 6 TPASS : getsockopt() with a bad socket descriptor - EBADF
user :notice: [ 54.682297] test_1_to_1_sockopt.c 7 TPASS : getsockopt() with an invalid socket - ENOTSOCK
user :notice: [ 54.683265] test_1_to_1_sockopt.c 8 TPASS : getsockopt() with invalid option buffer - EFAULT
user :notice: [ 54.684267] test_1_to_1_sockopt.c 9 TPASS : getsockopt() with invalid option name - EOPNOTSUPP
user :notice: [ 54.685079] test_1_to_1_sockopt.c 10 TPASS : getsockopt() SCTP_INITMSG - SUCCESS
user :notice: [ 54.685885] test_1_to_1_sockopt.c 11 TPASS : setsockopt() SCTP_INITMSG - SUCCESS
user :notice: [ 54.686653] test_1_to_1_sockopt.c 12 TPASS : setsockopt() SO_LINGER - SUCCESS
user :notice: [ 54.687418] test_1_to_1_sockopt.c 13 TPASS : getsockopt() SO_LINGER - SUCCESS
user :notice: [ 54.688187] test_1_to_1_sockopt.c 14 TPASS : getsockopt() SO_RCVBUF - SUCCESS
user :notice: [ 54.688979] test_1_to_1_sockopt.c 15 TPASS : getsockopt() SCTP_STATUS - SUCCESS
user :notice: [ 54.689752] test_1_to_1_sockopt.c 16 TPASS : setsockopt() SO_RCVBUF - SUCCESS
user :notice: [ 54.691539] test_1_to_1_sockopt.c 17 TBROK : test_1_to_1_sockopt.c:341: Comparison failed:Set value and got value differs Set Value=4096 Get Value=8192
user :notice: [ 54.692520] test_1_to_1_sockopt.c 18 TBROK : test_1_to_1_sockopt.c:341: Remaining cases broken
To reproduce:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/wfg/lkp-tests.git
cd lkp-tests
bin/lkp install job.yaml # job file is attached in this email
bin/lkp run job.yaml
Thanks,
Xiaolong
This commit is not accepted, thanks.
After discuss with Eric, I know it is too late to correct it.
Regards
Feng