From: Eric Dumazet <eric.dumazet@gmail.com>
To: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: David Miller <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
Tariq Toukan <tariqt@mellanox.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH net-next] mlx4: support __GFP_MEMALLOC for rx
Date: Wed, 18 Jan 2017 07:24:31 -0800 [thread overview]
Message-ID: <1484753071.13165.106.camel@edumazet-glaptop3.roam.corp.google.com> (raw)
In-Reply-To: <ed9a6b2a-428e-ac78-bba8-742f5e7c1eed@yandex-team.ru>
On Wed, 2017-01-18 at 18:11 +0300, Konstantin Khlebnikov wrote:
> On 18.01.2017 17:23, Eric Dumazet wrote:
> >
> > Take a look at sk_filter_trim_cap(), where the RX packets received on a
> > socket which does not have SOCK_MEMALLOC is dropped.
> >
> > /*
> > * If the skb was allocated from pfmemalloc reserves, only
> > * allow SOCK_MEMALLOC sockets to use it as this socket is
> > * helping free memory
> > */
> > if (skb_pfmemalloc(skb) && !sock_flag(sk, SOCK_MEMALLOC))
> > return -ENOMEM;
>
> I suppose this happens in BH context right after receiving packet?
>
> Potentially any ACK could free memory in TCP send queue,
> so using reserves here makes sense.
Yes, but only sockets with SOCK_MEMALLOC have this contract with the mm
layer.
For 'other' sockets, one possible trick would be that if only the page
fragment attached to skb had the pfmemalloc bit, and not the sk_buff
itself, we could attempt a skb_condense() operation [1], but it is not
really easy to properly recompute skb->pfmemalloc.
Pure TCP ACK packets can usually be trimmed by skb_condense().
Since they have no payload, we have a guarantee they wont sit in a queue
and hold memory.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2017-01-18 15:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1484712850.13165.86.camel@edumazet-glaptop3.roam.corp.google.com>
2017-01-18 9:31 ` Konstantin Khlebnikov
2017-01-18 14:23 ` Eric Dumazet
2017-01-18 15:11 ` Konstantin Khlebnikov
2017-01-18 15:24 ` Eric Dumazet [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1484753071.13165.106.camel@edumazet-glaptop3.roam.corp.google.com \
--to=eric.dumazet@gmail.com \
--cc=davem@davemloft.net \
--cc=khlebnikov@yandex-team.ru \
--cc=linux-mm@kvack.org \
--cc=netdev@vger.kernel.org \
--cc=tariqt@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox