[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+FuTSeT9WWQYjDMCAOqjLuT-LjYOO+yrfE=qU=cwXRt+ExCug@mail.gmail.com>
Date: Wed, 23 Jun 2021 22:40:53 -0400
From: Willem de Bruijn <willemdebruijn.kernel@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: Jakub Kicinski <kuba@...nel.org>, davem@...emloft.net,
netdev@...r.kernel.org, eric.dumazet@...il.com, dsahern@...il.com,
yoshfuji@...ux-ipv6.org, brouer@...hat.com, Dave Jones <dsj@...com>
Subject: Re: [PATCH net-next v4] net: ip: avoid OOM kills with large UDP sends
over loopback
> > if (transhdrlen) {
> > - skb = sock_alloc_send_skb(sk,
> > - alloclen + hh_len + 15,
> > + skb = sock_alloc_send_skb(sk, alloclen,
> > (flags & MSG_DONTWAIT), &err);
> > } else {
> > skb = NULL;
> > if (refcount_read(&sk->sk_wmem_alloc) + wmem_alloc_delta <=
> > 2 * sk->sk_sndbuf)
> > - skb = alloc_skb(alloclen + hh_len + 15,
> > + skb = alloc_skb(alloclen,
> > sk->sk_allocation);
> > if (unlikely(!skb))
> > err = -ENOBUFS;
>
> Is there any risk of regressions? If so, would it be preferable to try
> regular alloc and only on failure, just below here, do the size and SG
> test and if permitted jump back to the last of the three alloc_len
> options?
sk_page_frag_refill when using frags will try also try large allocations first
(SKB_FRAG_PAGE_ORDER == order-3) , but can degrade more gracefully
under memory pressure than this header alloc. Which can only succeed
or fail for the total size. So without memory pressure this only takes two
extra allocations for a 64KB skb.
Powered by blists - more mailing lists