Re: [PATCH] mm/memcontrol: Add the drop_cache interface for cgroup v2

2020-09-22 Thread Yafang Shao
On Tue, Sep 22, 2020 at 3:27 PM Michal Hocko wrote: > > On Tue 22-09-20 12:20:52, Yafang Shao wrote: > > On Mon, Sep 21, 2020 at 7:36 PM Michal Hocko wrote: > > > > > > On Mon 21-09-20 19:23:01, Yafang Shao wrote: > > > > On Mon, S

Re: [PATCH] mm/memcontrol: Add the drop_cache interface for cgroup v2

2020-09-21 Thread Yafang Shao
On Mon, Sep 21, 2020 at 7:36 PM Michal Hocko wrote: > > On Mon 21-09-20 19:23:01, Yafang Shao wrote: > > On Mon, Sep 21, 2020 at 7:05 PM Michal Hocko wrote: > > > > > > On Mon 21-09-20 18:55:40, Yafang Shao wrote: > > > > On Mon, S

Re: [PATCH] mm/memcontrol: Add the drop_cache interface for cgroup v2

2020-09-21 Thread Yafang Shao
On Mon, Sep 21, 2020 at 7:05 PM Michal Hocko wrote: > > On Mon 21-09-20 18:55:40, Yafang Shao wrote: > > On Mon, Sep 21, 2020 at 4:12 PM Michal Hocko wrote: > > > > > > On Mon 21-09-20 16:02:55, zangchun...@bytedance.com wrote: > > > > From: Chunxin

Re: [PATCH] mm/memcontrol: Add the drop_cache interface for cgroup v2

2020-09-21 Thread Yafang Shao
On Mon, Sep 21, 2020 at 4:12 PM Michal Hocko wrote: > > On Mon 21-09-20 16:02:55, zangchun...@bytedance.com wrote: > > From: Chunxin Zang > > > > In the cgroup v1, we have 'force_mepty' interface. This is very > > useful for userspace to actively release memory. But the cgroup > > v2 does not. >

Re: [PATCH v3 net-next 2/2] net: sock: undefine SOCK_DEBUGGING

2019-02-25 Thread Yafang Shao
On Tue, Feb 26, 2019 at 6:58 AM Cong Wang wrote: > > On Mon, Feb 25, 2019 at 2:29 PM David Miller wrote: > > > > From: Cong Wang > > Date: Mon, 25 Feb 2019 14:00:09 -0800 > > > > > Just to clarify, I have been suggesting to completely remove > > > this unused macro, never suggest to just undefin

[PATCH] tcp: clean up SOCK_DEBUG()

2019-02-25 Thread Yafang Shao
Per discussion with Daniel[1] and Eric[2], these SOCK_DEBUG() calles in TCP are not needed now. We'd better clean up it. [1] https://patchwork.ozlabs.org/patch/1035573/ [2] https://patchwork.ozlabs.org/patch/1040533/ Signed-off-by: Yafang Shao --- net/ipv4/tcp_input.c

[PATCH v3 net-next 1/2] tcp: clean up SOCK_DEBUG()

2019-02-17 Thread Yafang Shao
Per discussion with Daniel[1] and Eric[2], these SOCK_DEBUG() calles in TCP are not needed now. We'd better clean up it. [1] https://patchwork.ozlabs.org/patch/1035573/ [2] https://patchwork.ozlabs.org/patch/1040533/ Signed-off-by: Yafang Shao --- net/ipv4/tcp_input.c

[PATCH v3 net-next 2/2] net: sock: undefine SOCK_DEBUGGING

2019-02-17 Thread Yafang Shao
able it by default. The reason why I don't remove it comepletely is that someone may still would like to use it for debugging. Signed-off-by: Yafang Shao Suggested-by: Joe Perches --- include/net/sock.h | 13 - net/core/sock.c| 3 +++ 2 files changed, 11 insertions(+), 5 del

[PATCH v3 net-next 0/2] clean up SOCK_DEBUG()

2019-02-17 Thread Yafang Shao
Per discussion with Daniel[1] and Eric[2], these SOCK_DEBUG() calles in TCP are not needed now. We'd better clean up it. Plus undefine SOCK_DEBUGGING by default. [1] https://patchwork.ozlabs.org/patch/1035573/ [2] https://patchwork.ozlabs.org/patch/1040533/ Yafang Shao (2): tcp: cle

Re: [PATCH v2 net-next 2/2] net: sock: undefine SOCK_DEBUGGING

2019-02-17 Thread Yafang Shao
On Sun, Feb 17, 2019 at 7:58 PM Joe Perches wrote: > > On Sun, 2019-02-17 at 00:28 +0800, Yafang Shao wrote: > > SOCK_DEBUG() is a old facility for debugging. > > If the user want to use it for debugging, the user must modify the > > application first, that doesn't

[PATCH v2 net-next 2/2] net: sock: undefine SOCK_DEBUGGING

2019-02-16 Thread Yafang Shao
able it by default. The reason why I don't remove it comepletely is that someone may still would like to use it for debugging. Signed-off-by: Yafang Shao Suggested-by: Joe Perches --- include/net/sock.h | 13 - net/core/sock.c| 3 +++ 2 files changed, 11 insertions(+), 5 del

[PATCH v2 net-next 1/2] tcp: clean up SOCK_DEBUG()

2019-02-16 Thread Yafang Shao
Per discussion with Daniel[1] and Eric[2], these SOCK_DEBUG() calles in TCP are not needed now. We'd better clean up it. [1] https://patchwork.ozlabs.org/patch/1035573/ [2] https://patchwork.ozlabs.org/patch/1040533/ Signed-off-by: Yafang Shao --- net/ipv4/tcp_input.c

[PATCH v2 net-next 0/2] clean up SOCK_DEBUG()

2019-02-16 Thread Yafang Shao
Per discussion with Daniel[1] and Eric[2], these SOCK_DEBUG() calles in TCP are not needed now. We'd better clean up it. Plus undefine SOCK_DEBUGGING by default. [1] https://patchwork.ozlabs.org/patch/1035573/ [2] https://patchwork.ozlabs.org/patch/1040533/ Yafang Shao (2): tcp: cle

Re: [net-next 5/5] net: sock: remove the definition of SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
On Sat, Feb 16, 2019 at 2:51 AM Joe Perches wrote: > > On Fri, 2019-02-15 at 10:22 -0800, Eric Dumazet wrote: > > On Fri, Feb 15, 2019 at 10:13 AM Cong Wang wrote: > > > On Fri, Feb 15, 2019 at 8:26 AM Eric Dumazet wrote: > > > > On Fri, Feb 15, 2019 at 6:

Re: [net-next 5/5] net: sock: remove the definition of SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
On Fri, Feb 15, 2019 at 10:58 PM Eric Dumazet wrote: > > On Fri, Feb 15, 2019 at 6:50 AM Yafang Shao wrote: > > > > As SOCK_DEBUG() isn't used any more, we can get ride of it now. > > > > No, we are still using this infrastructure from time to time. > >

[net-next 3/5] appletalk: clean up SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
40533/ Signed-off-by: Yafang Shao --- net/appletalk/ddp.c | 14 -- 1 file changed, 14 deletions(-) diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 9b6bc5a..326c4fd 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -1608,8 +1608,6 @@ static int atalk_sendmsg(s

[net-next 5/5] net: sock: remove the definition of SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
ll can use this option but don't take any effect from now on. Signed-off-by: Yafang Shao --- include/net/sock.h | 19 --- net/core/sock.c| 3 +++ 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 6679f3c..4c6b5

[net-next 1/5] tcp: clean up SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
igned-off-by: Yafang Shao --- net/ipv4/tcp_input.c | 19 +-- net/ipv6/tcp_ipv6.c | 2 -- 2 files changed, 1 insertion(+), 20 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 7a027dec..6d2750e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_in

[net-next 2/5] x25: clean up SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
igned-off-by: Yafang Shao --- net/x25/af_x25.c | 12 net/x25/x25_facilities.c | 32 ++-- net/x25/x25_out.c| 4 +--- 3 files changed, 11 insertions(+), 37 deletions(-) diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 5121729..5892d05 1

[net-next 4/5] dccp: clean up SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
igned-off-by: Yafang Shao --- net/dccp/ipv6.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index d5740ba..8e72e50 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c @@ -878,8 +878,6 @@ static int dccp_v6_connect(struct sock *sk, struct sockaddr *

[net-next 0/5] clean up SOCK_DEBUG()

2019-02-15 Thread Yafang Shao
aking applications. [1] https://patchwork.ozlabs.org/patch/1035573/ [2] https://patchwork.ozlabs.org/patch/1040533 Yafang Shao (5): tcp: clean up SOCK_DEBUG() x25: clean up SOCK_DEBUG() appletalk: clean up SOCK_DEBUG() dccp: clean up SOCK_DEBUG() net: sock: remove the definition of SOCK_

Re: [bpf-next 1/2] tcp: replace SOCK_DEBUG() with tcp_stats()

2019-02-12 Thread Yafang Shao
On Wed, Feb 13, 2019 at 10:49 AM Alexei Starovoitov wrote: > > On Tue, Feb 12, 2019 at 6:15 PM Eric Dumazet wrote: > > > > Do not add more debugging stuff unless you can demonstrate > > they actually allowed you to find a real bug and that you sent a > > public fix for it. > > > > Just adding "co

Re: [bpf-next 1/2] tcp: replace SOCK_DEBUG() with tcp_stats()

2019-02-12 Thread Yafang Shao
On Wed, Feb 13, 2019 at 10:15 AM Eric Dumazet wrote: > > On Tue, Feb 12, 2019 at 6:07 PM Yafang Shao wrote: > > > > > Let me explain the background for you. > > I want to track some TCP abnormal behavior in TCP/IP stack. But I > > find there's no good way

Re: [bpf-next 2/2] bpf: add BPF_SOCK_OPS_STATS_CB for tcp_stats()

2019-02-12 Thread Yafang Shao
On Tue, Feb 12, 2019 at 11:11 PM Eric Dumazet wrote: > > > > On 02/12/2019 03:31 AM, Yafang Shao wrote: > > Introuce this new op BPF_SOCK_OPS_STATS_CB for tcp_stats() such that it > > can be traced via BPF on a per socket basis. > > There's one argument in BP

Re: [bpf-next 1/2] tcp: replace SOCK_DEBUG() with tcp_stats()

2019-02-12 Thread Yafang Shao
On Tue, Feb 12, 2019 at 11:07 PM Eric Dumazet wrote: > > > > On 02/12/2019 03:31 AM, Yafang Shao wrote: > > SOCK_DEBUG is a very ancient debugging interface, and it's not very useful > > for debugging. > > So this patch removes the SOCK_DEBUG() and introduc

[bpf-next 1/2] tcp: replace SOCK_DEBUG() with tcp_stats()

2019-02-12 Thread Yafang Shao
nk it is better to keep as-is, because if we return an errno to tell the application that this optname isn't supported for TCP, it may break the application. The application still can use this option but don't take any effect for TCP. Signed-off-by: Yafang Shao --- include/uapi/li

[bpf-next 0/2] cleanup SOCK_DEBUG() and introduce BPF_SOCK_OPS_STATS_CB

2019-02-12 Thread Yafang Shao
rnel.org/netconf2018_files/BrendanGregg_netconf2018.pdf Yafang Shao (2): tcp: replace SOCK_DEBUG() with tcp_stats() bpf: add BPF_SOCK_OPS_STATS_CB for tcp_stats() include/uapi/linux/bpf.h | 5 + include/uapi/linux/snmp.h | 3 +++ net/ipv4/proc.c | 3 +++ net/ipv4/tcp_input.c

[bpf-next 2/2] bpf: add BPF_SOCK_OPS_STATS_CB for tcp_stats()

2019-02-12 Thread Yafang Shao
igned-off-by: Yafang Shao --- include/uapi/linux/bpf.h | 5 + net/ipv4/tcp_input.c | 1 + 2 files changed, 6 insertions(+) diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 1777fa0..0314ddd 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -2

Re: [PATCH bpf-next] bpf: support SO_DEBUG in bpf_setsockopt()

2019-02-05 Thread Yafang Shao
On Tue, Feb 5, 2019 at 4:23 AM Daniel Borkmann wrote: > > On 02/04/2019 06:35 PM, Alexei Starovoitov wrote: > > On Sun, Feb 03, 2019 at 04:15:07PM +0800, Yafang Shao wrote: > >> Then we can enable/disable socket debugging without modifying user code. > >> That is

Re: [PATCH bpf-next] bpf: support SO_DEBUG in bpf_setsockopt()

2019-02-05 Thread Yafang Shao
On Tue, Feb 5, 2019 at 1:35 AM Alexei Starovoitov wrote: > > On Sun, Feb 03, 2019 at 04:15:07PM +0800, Yafang Shao wrote: > > Then we can enable/disable socket debugging without modifying user code. > > That is more convenient for debugging. > > > &

[PATCH bpf-next] bpf: support SO_DEBUG in bpf_setsockopt()

2019-02-03 Thread Yafang Shao
Then we can enable/disable socket debugging without modifying user code. That is more convenient for debugging. Signed-off-by: Yafang Shao --- include/net/sock.h | 8 net/core/filter.c | 3 +++ net/core/sock.c| 8 3 files changed, 11 insertions(+), 8 deletions(-) diff

[PATCH v2 bpf-next] bpf: use the proper optlen when doing strncpy in bpf_getsockopt()

2019-01-23 Thread Yafang Shao
As strncpy(..., TCP_CA_NAME_MAX-1) is used in bpf_setsockopt(), this change will make it more consistent with the bpf_setsockopt() above. Acked-by: Martin KaFai Lau Acked-by: Lawrence Brakmo Signed-off-by: Yafang Shao --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[PATCH v2 bpf] bpf: sock recvbuff must be limited by rmem_max in bpf_setsockopt()

2019-01-22 Thread Yafang Shao
When sock recvbuff is set by bpf_setsockopt(), the value must by limited by rmem_max. It is the same with sendbuff. Fixes: 8c4b4c7e9ff0 ("bpf: Add setsockopt helper function to bpf") Acked-by: Martin KaFai Lau Acked-by: Lawrence Brakmo Signed-off-by: Yafang Shao --- net/core/fi

[PATCH bpf-next] bpf: use the proper optlen when doing strncpy in bpf_getsockopt()

2019-01-18 Thread Yafang Shao
As the last character of optval will be set with 0, so just copying (optlen - 1) characters is enough. Signed-off-by: Yafang Shao --- net/core/filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/core/filter.c b/net/core/filter.c index 447dd1b..7a4de22 100644 --- a

[PATCH bpf-next] bpf: sock recvbuff must be limited by rmem_max in bpf_setsockopt()

2019-01-18 Thread Yafang Shao
When sock recvbuff is set by bpf_setsockopt(), the value must by limited by rmem_max. It is the same with sendbuff. Signed-off-by: Yafang Shao --- net/core/filter.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/core/filter.c b/net/core/filter.c index 447dd1b..f30b58a 100644 --- a

[PATCH v2 net-next] net: sock: do not set sk_cookie in sk_clone_lock()

2019-01-17 Thread Yafang Shao
The only call site of sk_clone_lock is in inet_csk_clone_lock, and sk_cookie will be set there. So we don't need to set sk_cookie in sk_clone_lock(). Reviewed-by: Eric Dumazet Signed-off-by: Yafang Shao --- net/core/sock.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/core/soc

Re: [PATCH net-next] net: sock: do not set sk_cookie in sk_clone_lock()

2019-01-17 Thread Yafang Shao
On Fri, Jan 18, 2019 at 12:40 AM Eric Dumazet wrote: > > On Thu, Jan 17, 2019 at 2:02 AM Yafang Shao wrote: > > > > The only call site of sk_clone_lock is in inet_csk_clone_lock, > > and sk_cookie will be set there. > > So we don't need to set sk_cookie in sk

[PATCH net-next] tcp: declare tcp_mmap() only when CONFIG_MMU is set

2019-01-17 Thread Yafang Shao
Since tcp_mmap() is defined when CONFIG_MMU is set. Signed-off-by: Yafang Shao --- include/net/tcp.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/net/tcp.h b/include/net/tcp.h index e0a65c0..5c95018 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -406,8 +406,10 @@ int

[PATCH net-next] net: sock: do not set sk_cookie in sk_clone_lock()

2019-01-17 Thread Yafang Shao
The only call site of sk_clone_lock is in inet_csk_clone_lock, and sk_cookie will be set there. So we don't need to set sk_cookie in sk_clone_lock(). That can save an atomic operation. Signed-off-by: Yafang Shao --- net/core/sock.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net

[PATCH net-next] tcp: minor optimization for calculating packets_out in tcp connect

2018-12-15 Thread Yafang Shao
ve us a little improvement. Signed-off-by: Yafang Shao --- net/ipv4/tcp_output.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 730bc44..12bb5e7 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -

Re: [PATCH 4/5] netfilter: fix missed NULL check in nf_conntrack_proto_pernet_init()

2018-12-13 Thread Yafang Shao
On Thu, Dec 13, 2018 at 7:26 AM Pablo Neira Ayuso wrote: > > On Wed, Dec 05, 2018 at 08:56:29PM +0800, Yafang Shao wrote: > > nf_ct_l4proto_net() may return NULL. > > That may happens if some module forget to set both l4proto->get_net_proto > > and l4proto->net_id. &

[PATCH 2/5] netfilter: register sysctl table for gre

2018-12-05 Thread Yafang Shao
After this patch, there will be two sysctl knobs for GRE. net.netfilter.nf_conntrack_gre_timeout_replied = 180 net.netfilter.nf_conntrack_gre_timeout_unreplied = 30 Signed-off-by: Yafang Shao --- net/netfilter/nf_conntrack_proto_gre.c | 43 +- 1

[PATCH 3/5] procfs: fix double drop_sysctl_table()

2018-12-05 Thread Yafang Shao
All of the callers will execute drop_sysctl_table() whatever the callee insert_header() successes or fails. So we can't execute drop_sysctl_table() in insert_header(). Signed-off-by: Yafang Shao --- fs/proc/proc_sysctl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/proc/proc_sysct

[PATCH 1/5] netfilter: fix general protection fault when unregister sysctl table

2018-12-05 Thread Yafang Shao
n fault issue. After this patch, an error message will be printed to indicate some error happens, for example, in this case bellow message will be printed, "nf_conntrack_gre4: pernet registration failed." Signed-off-by: Yafang Shao --- net/netfilter/nf_conntrack

[PATCH 5/5] netfilter: fix error return value of nf_ct_l4proto_pernet_register_one()

2018-12-05 Thread Yafang Shao
If pn is NULL, it will return 0. That's not proper. We should return an error. Signed-off-by: Yafang Shao --- net/netfilter/nf_conntrack_proto.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/netfilter/nf_conntrack_proto.c b/net/netfilter/nf_conntrack_proto.c index 316fef3..3c

[PATCH 4/5] netfilter: fix missed NULL check in nf_conntrack_proto_pernet_init()

2018-12-05 Thread Yafang Shao
nf_ct_l4proto_net() may return NULL. That may happens if some module forget to set both l4proto->get_net_proto and l4proto->net_id. We'd check the return value here, in case crash happens. Signed-off-by: Yafang Shao --- net/netfilter/nf_conntrack_proto.c | 3 +++ 1 file changed, 3

Re: [PATCH net-next] tcp: introduce skb_rbtree_walk_safe() and use it in tcp_clean_rtx_queue()

2018-11-28 Thread Yafang Shao
On Wed, Nov 28, 2018 at 10:44 PM Eric Dumazet wrote: > > > > On 11/28/2018 04:16 AM, Yafang Shao wrote: > > When walk RB tree, we'd better use skb_rbtree_walk* helpers, that can make > > the code more clear. > > As skb_rbtree_walk() can't be used in tcp_

[PATCH net-next] tcp: introduce skb_rbtree_walk_safe() and use it in tcp_clean_rtx_queue()

2018-11-28 Thread Yafang Shao
When walk RB tree, we'd better use skb_rbtree_walk* helpers, that can make the code more clear. As skb_rbtree_walk() can't be used in tcp_clean_rtx_queue(), so the new helper skb_rbtree_walk_safe() is introduced. Signed-off-by: Yafang Shao --- include/linux/skbuff.h | 5 +

Re: [PATCH net-next] tcp: add SNMP counter for the number of packets pruned from ofo queue

2018-07-25 Thread Yafang Shao
On Wed, Jul 25, 2018 at 9:55 PM, Eric Dumazet wrote: > > > On 07/25/2018 06:40 AM, Yafang Shao wrote: > >> >> Because we want to know why packets were dropped. >> If that could be show in netstat, we could easily find that it is >> dropped due to ofo prune.

Re: [PATCH net-next] tcp: add SNMP counter for the number of packets pruned from ofo queue

2018-07-25 Thread Yafang Shao
On Wed, Jul 25, 2018 at 9:33 PM, Eric Dumazet wrote: > > > On 07/25/2018 06:06 AM, Yafang Shao wrote: >> LINUX_MIB_OFOPRUNED is used to count how many times ofo queue is pruned, >> but sometimes we want to know how many packets are pruned from this queue, >> that

[PATCH net-next] tcp: add SNMP counter for the number of packets pruned from ofo queue

2018-07-25 Thread Yafang Shao
LINUX_MIB_OFOPRUNEDROP, which could be showed in netstat as OfoPruneDrop. Signed-off-by: Yafang Shao --- include/uapi/linux/snmp.h | 1 + net/ipv4/proc.c | 1 + net/ipv4/tcp_input.c | 1 + 3 files changed, 3 insertions(+) diff --git a/include/uapi/linux/snmp.h b/include/uapi/linux/snmp.h index

[PATCH net-next] tcp: add SNMP counter for zero-window drops

2018-06-24 Thread Yafang Shao
It will be helpful if we could display the drops due to zero window or no enough window space. So a new SNMP MIB entry is added to track this behavior. This entry is named LINUX_MIB_TCPZEROWINDOWDROP and published in /proc/net/netstat in TcpExt line as TCPZeroWindowDrop. Signed-off-by: Yafang

[PATCH net-next 2/2] ipv6: replace ip_hdr() with skb->data for optimization

2018-06-05 Thread Yafang Shao
replace ip_hdr() with skb->data in these situations for optimization. Signed-off-by: Yafang Shao --- net/ipv6/ip6_input.c | 4 ++-- net/ipv6/ip6_output.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c index f08d344..2ff4fe8 1006

[PATCH net-next 1/2] ipv4: replace ip_hdr() with skb->data for optimization

2018-06-05 Thread Yafang Shao
ip_hdr() with skb->data in these situations for optimization. Signed-off-by: Yafang Shao --- net/ipv4/ip_input.c | 8 net/ipv4/ip_output.c | 8 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 7582713..7a03e8c 1006

Re: [PATCH v3 net-next 2/2] tcp: minor optimization around tcp_hdr() usage in tcp receive path

2018-05-28 Thread Yafang Shao
On Tue, May 29, 2018 at 12:36 AM, Eric Dumazet wrote: > On Mon, May 28, 2018 at 8:36 AM Yafang Shao wrote: > >> This is additional to the commit ea1627c20c34 ("tcp: minor optimizations > around tcp_hdr() usage"). >> At this point, skb->data is same with tcp_h

[PATCH v3 net-next 2/2] tcp: minor optimization around tcp_hdr() usage in tcp receive path

2018-05-28 Thread Yafang Shao
This is additional to the commit ea1627c20c34 ("tcp: minor optimizations around tcp_hdr() usage"). At this point, skb->data is same with tcp_hdr() as tcp header has not been pulled yet. Cc: Eric Dumazet Signed-off-by: Yafang Shao --- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/tcp_ipv

[PATCH v3 net-next 1/2] tcp: use data length instead of skb->len in tcp_probe

2018-05-28 Thread Yafang Shao
At this point skb->len is including tcp header length, so it is meaningless to user. data length could be more helpful, with which we can easily filter out the packet without payload. Cc: Eric Dumazet Acked-by: Song Liu Signed-off-by: Yafang Shao --- v3: tcp_hdr() is a little expensive t

Re: [PATCH net-next] bpfilter: fix a build err

2018-05-26 Thread Yafang Shao
On Sat, May 26, 2018 at 10:25 AM, YueHaibing wrote: > On 2018/5/26 0:19, Alexei Starovoitov wrote: >> On Fri, May 25, 2018 at 06:17:57PM +0800, YueHaibing wrote: >>> gcc-7.3.0 report following err: >>> >>> HOSTCC net/bpfilter/main.o >>> In file included from net/bpfilter/main.c:9:0: >>> ./inclu

[PATCH v2 net-next] tcp: use data length instead of skb->len in tcp_probe

2018-05-25 Thread Yafang Shao
skb->len is meaningless to user. data length could be more helpful, with which we can easily filter out the packet without payload. Signed-off-by: Yafang Shao --- include/trace/events/tcp.h | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/trace/events/tcp.

[PATCH net-next] tcp: use data length instead of skb->len in tcp_probe

2018-05-24 Thread Yafang Shao
skb->len is meaningless to user. data length could be more helpful, with which we can easily filter out the packet without payload. Signed-off-by: Yafang Shao --- include/trace/events/tcp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/trace/events/tcp.

Re: [PATCH net-next] Revert "net: init sk_cookie for inet socket"

2018-04-24 Thread Yafang Shao
On Tue, Apr 24, 2018 at 11:49 PM, Eric Dumazet wrote: > > > On 04/24/2018 08:12 AM, Yafang Shao wrote: >> On Tue, Apr 24, 2018 at 8:38 PM, Eric Dumazet wrote: >>> >>> >>> On 04/24/2018 05:05 AM, Yafang Shao wrote: >>>> This revert commit

Re: [PATCH net-next] Revert "net: init sk_cookie for inet socket"

2018-04-24 Thread Yafang Shao
On Tue, Apr 24, 2018 at 8:38 PM, Eric Dumazet wrote: > > > On 04/24/2018 05:05 AM, Yafang Shao wrote: >> This revert commit ("net: init sk_cookie for inet socket") >> >> Per discussion with Eric. >> > > I suggest you include a bit more details,

[PATCH v2 net-next] Revert "net: init sk_cookie for inet socket"

2018-04-24 Thread Yafang Shao
"Performance is reduced from ~5 Mpps to ~3.8 Mpps with 16 RX queues on my host" when running synflood test. Have to revert it to prevent from cache line false sharing. Signed-off-by: Yafang Shao --- include/linux/sock_diag.h | 9 - net/ipv4/tcp_input.c | 8 +--- 2 fil

Re: [PATCH net-next] Revert "net: init sk_cookie for inet socket"

2018-04-24 Thread Yafang Shao
On Tue, Apr 24, 2018 at 8:38 PM, Eric Dumazet wrote: > > > On 04/24/2018 05:05 AM, Yafang Shao wrote: >> This revert commit ("net: init sk_cookie for inet socket") >> >> Per discussion with Eric. >> > > I suggest you include a bit more details,

[PATCH net-next] Revert "net: init sk_cookie for inet socket"

2018-04-24 Thread Yafang Shao
This revert commit ("net: init sk_cookie for inet socket") Per discussion with Eric. Signed-off-by: Yafang Shao --- include/linux/sock_diag.h | 9 - net/ipv4/tcp_input.c | 8 +--- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/include/linux/soc

Re: [PATCH net-next] net: init sk_cookie for inet socket

2018-04-24 Thread Yafang Shao
On Tue, Apr 24, 2018 at 7:41 PM, Eric Dumazet wrote: > > > On 04/23/2018 09:39 PM, Yafang Shao wrote: >> On Tue, Apr 24, 2018 at 12:09 AM, Eric Dumazet >> wrote: >>> >>> >>> On 04/23/2018 08:58 AM, David Miller wrote: >>>> F

Re: [PATCH net-next] net: init sk_cookie for inet socket

2018-04-23 Thread Yafang Shao
On Tue, Apr 24, 2018 at 12:09 AM, Eric Dumazet wrote: > > > On 04/23/2018 08:58 AM, David Miller wrote: >> From: Yafang Shao >> Date: Sun, 22 Apr 2018 21:50:04 +0800 >> >>> With sk_cookie we can identify a socket, that is very helpful for >>> tracein

[PATCH net-next] net: init sk_cookie for inet socket

2018-04-22 Thread Yafang Shao
With sk_cookie we can identify a socket, that is very helpful for traceing and statistic, i.e. tcp tracepiont and ebpf. So we'd better init it by default for inet socket. When using it, we just need call atomic64_read(&sk->sk_cookie). Signed-off-by: Yafang Shao --- include/linux/soc

Re: [PATCH v3 net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-20 Thread Yafang Shao
On Fri, Apr 20, 2018 at 11:21 PM, David Miller wrote: > > Why are you sending this same patch twice? > > Thank you. Some mistake. Sorry about that. Pls. use the second patch. Thanks Yafang

[PATCH v3 net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-20 Thread Yafang Shao
ow us the whole lifespan of this packet. But we could also implement that with pid as these functions are executed in process context. Signed-off-by: Yafang Shao --- v2 -> v3: use sock_gen_cookie in tcp_event_sk as well. Maybe we could init sk_cookie in the stack then in ot

[PATCH net-next v3] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-20 Thread Yafang Shao
ow us the whole lifespan of this packet. But we could also implement that with pid as these functions are executed in process context. Signed-off-by: Yafang Shao --- v2 -> v3: use sock_gen_cookie in tcp_event_sk as well. Maybe we could init sk_cookie in the stack then in ot

Re: [PATCH net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-17 Thread Yafang Shao
On Wed, Apr 18, 2018 at 7:44 AM, Alexei Starovoitov wrote: > On Mon, Apr 16, 2018 at 08:43:31AM -0700, Eric Dumazet wrote: >> >> >> On 04/16/2018 08:33 AM, Yafang Shao wrote: >> > tcp_rcv_space_adjust is called every time data is copied to user space, >> >

Re: [PATCH v2 net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-17 Thread Yafang Shao
On Wed, Apr 18, 2018 at 1:38 AM, Song Liu wrote: > > >> On Apr 17, 2018, at 9:36 AM, Yafang Shao wrote: >> >> tcp_rcv_space_adjust is called every time data is copied to user space, >> introducing a tcp tracepoint for which could show us when the packet is >>

Re: [PATCH v2 net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-17 Thread Yafang Shao
On Wed, Apr 18, 2018 at 1:27 AM, Eric Dumazet wrote: > > > On 04/17/2018 09:36 AM, Yafang Shao wrote: >> tcp_rcv_space_adjust is called every time data is copied to user space, >> introducing a tcp tracepoint for which could show us when the packet is >> copied to

[PATCH v2 net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-17 Thread Yafang Shao
int with epoll/read/recv* tracepoints, and finally that could show us the whole lifespan of this packet. But we could also implement that with pid as these functions are executed in process context. Signed-off-by: Yafang Shao --- v1 -> v2: use sk_cookie as key suggested by Eric. --- include/t

Re: [PATCH net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-16 Thread Yafang Shao
On Mon, Apr 16, 2018 at 11:43 PM, Eric Dumazet wrote: > > > On 04/16/2018 08:33 AM, Yafang Shao wrote: >> tcp_rcv_space_adjust is called every time data is copied to user space, >> introducing a tcp tracepoint for which could show us when the packet is >> copied to

[PATCH net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-16 Thread Yafang Shao
ead/recv* tracepoint, and finally that could show us the whole lifespan of this packet. But we could also implement that with pid as these functions are executed in process context. Signed-off-by: Yafang Shao --- include/trace/events/tcp.h | 21 +++-- net/ipv4/tcp_input.c | 2 ++

[PATCH net-next] net: introduce a new tracepoint for tcp_rcv_space_adjust

2018-04-14 Thread Yafang Shao
ead/recv* tracepoint, and finally that could show us the whole lifespan of this packet. But we could also implement that with pid as these functions are executed in process context. Signed-off-by: Yafang Shao --- include/trace/events/tcp.h | 21 +++-- net/ipv4/tcp_input.c | 2 ++

[PATCH bpf-next] bpf: NULL pointer check is not needed in BPF_CGROUP_RUN_PROG_INET_SOCK

2018-02-22 Thread Yafang Shao
sk is already allocated in inet_create/inet6_create, hence when BPF_CGROUP_RUN_PROG_INET_SOCK is executed sk will never be NULL. The logic is as bellow, sk = sk_alloc(); if (!sk) goto out; BPF_CGROUP_RUN_PROG_INET_SOCK(sk); Signed-off-by: Yafang Shao

[PATCH net-next] tcp: remove the hardcode in the definition of TCPF Macro

2018-02-20 Thread Yafang Shao
TCPF_ macro depends on the definition of TCP_ macro. So it is better to define them with TCP_ marco. Signed-off-by: Yafang Shao --- include/net/tcp_states.h | 26 +- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/net/tcp_states.h b/include/net

[PATCH v2 net-next] net: tracepoint: exposing sk_faimily in tracepoint inet_sock_set_state

2018-01-06 Thread Yafang Shao
em as tracepoint arguments. Suggested-by: Brendan Gregg Suggested-by: Song Liu Signed-off-by: Yafang Shao --- include/trace/events/sock.h | 15 +-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h index 3537c5f..31

Re: [PATCH net-next] net: tracepoint: adding new tracepoint arguments in inet_sock_set_state

2018-01-06 Thread Yafang Shao
On Sun, Jan 7, 2018 at 1:46 AM, Song Liu wrote: > >> On Jan 5, 2018, at 12:09 AM, Yafang Shao wrote: >> >> On Fri, Jan 5, 2018 at 3:21 PM, Song Liu wrote: >>> >>>> On Jan 4, 2018, at 10:42 PM, Yafang Shao wrote: >>>> >>>> sk-

Re: [PATCH net-next] net: tracepoint: adding new tracepoint arguments in inet_sock_set_state

2018-01-05 Thread Yafang Shao
On Fri, Jan 5, 2018 at 3:21 PM, Song Liu wrote: > >> On Jan 4, 2018, at 10:42 PM, Yafang Shao wrote: >> >> sk->sk_protocol and sk->sk_family are exposed as tracepoint arguments. >> Then we can conveniently use these two arguments to do the filter. >> >&g

[PATCH net-next] net: tracepoint: adding new tracepoint arguments in inet_sock_set_state

2018-01-04 Thread Yafang Shao
sk->sk_protocol and sk->sk_family are exposed as tracepoint arguments. Then we can conveniently use these two arguments to do the filter. Suggested-by: Brendan Gregg Signed-off-by: Yafang Shao --- include/trace/events/sock.h | 24 ++-- net/ipv4/af_inet.c

Re: [PATCH v3 net-next 2/5] net: tracepoint: replace tcp_set_state tracepoint with inet_sock_set_state tracepoint

2018-01-02 Thread Yafang Shao
On Wed, Jan 3, 2018 at 3:46 AM, Brendan Gregg wrote: > On Sat, Dec 30, 2017 at 7:06 PM, Yafang Shao wrote: >> On Sun, Dec 31, 2017 at 6:33 AM, Brendan Gregg >> wrote: >>> On Tue, Dec 19, 2017 at 7:12 PM, Yafang Shao wrote: >>>> As sk_state is a common

Re: [PATCH v3 net-next 2/5] net: tracepoint: replace tcp_set_state tracepoint with inet_sock_set_state tracepoint

2017-12-30 Thread Yafang Shao
On Sun, Dec 31, 2017 at 6:33 AM, Brendan Gregg wrote: > On Tue, Dec 19, 2017 at 7:12 PM, Yafang Shao wrote: >> As sk_state is a common field for struct sock, so the state >> transition tracepoint should not be a TCP specific feature. >> Currently it traces all AF_INET s

[PATCH v2 net-next] net/trace: fix printk format in inet_sock_set_state

2017-12-24 Thread Yafang Shao
Signed-off-by: Yafang Shao --- include/trace/events/sock.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h index 3b9094a..3537c5f 100644 --- a/include/trace/events/sock.h +++ b/include/trace/events/sock.h @

Re: [PATCH net-next] net/trace: fix printk format in inet_sock_set_state

2017-12-23 Thread Yafang Shao
On Sat, Dec 23, 2017 at 5:42 PM, Sergei Shtylyov wrote: > On 12/23/2017 4:10 AM, Yafang Shao wrote: > >>>> There's a space character missed in the printk messages. >>>> This error should be prevented with checkscript.pl, but it couldn't >>>> c

Re: [PATCH net-next] net/trace: fix printk format in inet_sock_set_state

2017-12-22 Thread Yafang Shao
On Sat, Dec 23, 2017 at 9:10 AM, Yafang Shao wrote: > On Sat, Dec 23, 2017 at 1:04 AM, Sergei Shtylyov > wrote: >> Hello! >> >> On 12/22/2017 06:37 PM, Yafang Shao wrote: >> >>> There's a space character missed in the printk messages. >>> Th

[PATCH net-next] net/trace: fix printk format in inet_sock_set_state

2017-12-22 Thread Yafang Shao
cepoint: replace tcp_set_state tracepoint with inet_sock_set_state tracepoint") Cc: Sergei Shtylyov Signed-off-by: Yafang Shao --- include/trace/events/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h index 3b9094a..

Re: [PATCH net-next] net/trace: fix printk format in inet_sock_set_state

2017-12-22 Thread Yafang Shao
On Sat, Dec 23, 2017 at 1:04 AM, Sergei Shtylyov wrote: > Hello! > > On 12/22/2017 06:37 PM, Yafang Shao wrote: > >> There's a space character missed in the printk messages. >> This error should be prevented with checkscri

[PATCH net-next] net/trace: fix printk format in inet_sock_set_state

2017-12-22 Thread Yafang Shao
cepoint: replace tcp_set_state tracepoint with inet_sock_set_state tracepoint") Signed-off-by: Yafang Shao --- include/trace/events/sock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h index 3b9094a..598399da 100644 ---

[PATCH v3 net-next 3/5] net: sock: replace sk_state_load with inet_sk_state_load and remove sk_state_store

2017-12-19 Thread Yafang Shao
sk_state_load is only used by AF_INET/AF_INET6, so rename it to inet_sk_state_load and move it into inet_sock.h. sk_state_store is removed as it is not used any more. Signed-off-by: Yafang Shao --- include/net/inet_sock.h | 25 - include/net/sock.h

[PATCH v3 net-next 1/5] tcp: Export to userspace the TCP state names for the trace events

2017-12-19 Thread Yafang Shao
;TCP_TIME_WAIT" }, { 7, "TCP_CLOSE" }, { 8, "TCP_CLOSE_WAIT" }, { 9, "TCP_LAST_ACK" }, { 10, "TCP_LISTEN" }, { 11, "TCP_CLOSING" }, { 12, "TCP_NEW_SYN_RECV" }) Signed-off-by: Steven Rostedt (VMware) Acked

[PATCH v3 net-next 0/5] replace tcp_set_state tracepoint with inet_sock_set_state

2017-12-19 Thread Yafang Shao
r protocol should be traced, I will modify the code to trace it. I just want to make the code easy and not output useless information. Steven Rostedt (VMware) (1): tcp: Export to userspace the TCP state names for the trace events Yafang Shao (4): net: tracepoint: replace tcp_set_state trace

[PATCH v3 net-next 4/5] net: tracepoint: using sock_set_state tracepoint to trace DCCP state transition

2017-12-19 Thread Yafang Shao
With changes in inet_ files, DCCP state transitions are traced with inet_sock_set_state tracepoint. Signed-off-by: Yafang Shao --- net/dccp/proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 9d43c1f..7a75a1d 100644 --- a/net

[PATCH v3 net-next 5/5] net: tracepoint: using sock_set_state tracepoint to trace SCTP state transition

2017-12-19 Thread Yafang Shao
: Yafang Shao --- net/sctp/endpointola.c | 2 +- net/sctp/sm_sideeffect.c | 4 ++-- net/sctp/socket.c| 12 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/net/sctp/endpointola.c b/net/sctp/endpointola.c index ee1e601..8b31468 100644 --- a/net/sctp

[PATCH v3 net-next 2/5] net: tracepoint: replace tcp_set_state tracepoint with inet_sock_set_state tracepoint

2017-12-19 Thread Yafang Shao
included in other header files, so they are defined in sock.c. The protocol such as SCTP maybe compiled as a ko, hence export inet_sk_set_state(). Signed-off-by: Yafang Shao --- include/net/inet_sock.h | 2 + include/trace/events/sock.h | 107

Re: [PATCH v2 net-next 2/4] net: tracepoint: replace tcp_set_state tracepoint with sock_set_state tracepoint

2017-12-15 Thread Yafang Shao
2017-12-16 6:47 GMT+08:00 Song Liu : > >> On Dec 15, 2017, at 9:56 AM, Yafang Shao wrote: >> >> As sk_state is a common field for struct sock, so the state >> transition should not be a TCP specific feature. >> So I rename tcp_set_state tracepoint to sock_set_st

[PATCH v2 net-next 1/4] tcp: Export to userspace the TCP state names for the trace events

2017-12-15 Thread Yafang Shao
;TCP_TIME_WAIT" }, { 7, "TCP_CLOSE" }, { 8, "TCP_CLOSE_WAIT" }, { 9, "TCP_LAST_ACK" }, { 10, "TCP_LISTEN" }, { 11, "TCP_CLOSING" }, { 12, "TCP_NEW_SYN_RECV" }) Signed-off-by: Steven Rostedt (VMware) Acked

  1   2   >