Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-12 Thread Xie He
On Fri, Apr 9, 2021 at 12:12 PM Xie He wrote: > > This is exactly what I'm talking about. "skb_pfmemalloc_protocol" > cannot guarantee pfmemalloc skbs are not delivered to unrelated > protocols, because "__netif_receive_skb" will sometimes treat > pfmemalloc skbs as normal skbs. > I'm not sure

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Xie He
On Fri, Apr 9, 2021 at 4:50 AM Eric Dumazet wrote: > > On 4/9/21 12:14 PM, Xie He wrote: > > Then simply copy the needed logic. No, there's no such thing as "sockets" in some of the protocols. There is simply no way to copy "the needed logic". > > Also, I think this is a problem in

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Eric Dumazet
On 4/9/21 12:14 PM, Xie He wrote: > On Fri, Apr 9, 2021 at 3:04 AM Eric Dumazet wrote: >> >> Note that pfmemalloc skbs are normally dropped in sk_filter_trim_cap() >> >> Simply make sure your protocol use it. > > It seems "sk_filter_trim_cap" needs an "struct sock" argument. Some of > my

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Xie He
On Fri, Apr 9, 2021 at 3:04 AM Eric Dumazet wrote: > > Note that pfmemalloc skbs are normally dropped in sk_filter_trim_cap() > > Simply make sure your protocol use it. It seems "sk_filter_trim_cap" needs an "struct sock" argument. Some of my protocols act like a middle layer to another protocol

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Xie He
On Fri, Apr 9, 2021 at 2:58 AM Mel Gorman wrote: > > On Fri, Apr 09, 2021 at 02:14:12AM -0700, Xie He wrote: > > > > Do you mean that at the time "sk_memalloc_socks()" changes from "true" > > to "false", there would be no in-flight skbs currently being received, > > and all network communications

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Eric Dumazet
On 4/9/21 11:14 AM, Xie He wrote: > On Fri, Apr 9, 2021 at 1:44 AM Mel Gorman wrote: >> >> That would imply that the tap was communicating with a swap device to >> allocate a pfmemalloc skb which shouldn't happen. Furthermore, it would >> require the swap device to be deactivated while

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Mel Gorman
On Fri, Apr 09, 2021 at 02:14:12AM -0700, Xie He wrote: > On Fri, Apr 9, 2021 at 1:44 AM Mel Gorman wrote: > > > > That would imply that the tap was communicating with a swap device to > > allocate a pfmemalloc skb which shouldn't happen. Furthermore, it would > > require the swap device to be

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Xie He
On Fri, Apr 9, 2021 at 1:44 AM Mel Gorman wrote: > > That would imply that the tap was communicating with a swap device to > allocate a pfmemalloc skb which shouldn't happen. Furthermore, it would > require the swap device to be deactivated while pfmemalloc skbs still > existed. Have you

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Mel Gorman
On Fri, Apr 09, 2021 at 01:33:24AM -0700, Xie He wrote: > On Fri, Apr 9, 2021 at 12:30 AM Mel Gorman > wrote: > > > > Under what circumstances do you expect sk_memalloc_socks() to be false > > and skb_pfmemalloc() to be true that would cause a problem? > > For example, if at the time the skb is

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Xie He
On Fri, Apr 9, 2021 at 12:30 AM Mel Gorman wrote: > > Under what circumstances do you expect sk_memalloc_socks() to be false > and skb_pfmemalloc() to be true that would cause a problem? For example, if at the time the skb is allocated, "sk_memalloc_socks()" was true, then the skb might be

Re: Problem in pfmemalloc skb handling in net/core/dev.c

2021-04-09 Thread Mel Gorman
On Thu, Apr 08, 2021 at 11:52:01AM -0700, Xie He wrote: > Hi Mel Gorman, > > I may have found a problem in pfmemalloc skb handling in > net/core/dev.c. I see there are "if" conditions checking for > "sk_memalloc_socks() && skb_pfmemalloc(skb)", and when the condition > is true, the skb is handled