From: Eric Dumazet <eric.dumazet@gmail.com>
To: Matthew Wilcox <willy@infradead.org>,
Eric Dumazet <eric.dumazet@gmail.com>
Cc: Rama Nichanamatlu <rama.nichanamatlu@oracle.com>,
Dongli Zhang <dongli.zhang@oracle.com>,
linux-mm@kvack.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
davem@davemloft.net, kuba@kernel.org,
aruna.ramakrishna@oracle.com, bert.barbe@oracle.com,
venkat.x.venkatsubra@oracle.com, manjunath.b.patil@oracle.com,
joe.jin@oracle.com, srinivas.eeda@oracle.com
Subject: Re: [PATCH 1/1] mm: avoid re-using pfmemalloc page in page_frag_alloc()
Date: Wed, 4 Nov 2020 13:51:29 +0100 [thread overview]
Message-ID: <053d1d51-430a-2fa9-fb72-fee5d2f9785c@gmail.com> (raw)
In-Reply-To: <20201104123659.GA17076@casper.infradead.org>
On 11/4/20 1:36 PM, Matthew Wilcox wrote:
> On Wed, Nov 04, 2020 at 09:50:30AM +0100, Eric Dumazet wrote:
>> On 11/4/20 2:16 AM, Rama Nichanamatlu wrote:
>>>> Thanks for providing the numbers. Do you think that dropping (up to)
>>>> 7 packets is acceptable?
>>>
>>> net.ipv4.tcp_syn_retries = 6
>>>
>>> tcp clients wouldn't even get that far leading to connect establish issues.
>>
>> This does not really matter. If host was under memory pressure,
>> dropping a few packets is really not an issue.
>>
>> Please do not add expensive checks in fast path, just to "not drop a packet"
>> even if the world is collapsing.
>
> Right, that was my first patch -- to only recheck if we're about to
> reuse the page. Do you think that's acceptable, or is that still too
> close to the fast path?
I think it is totally acceptable.
The same strategy is used in NIC drivers, before recycling a page.
If page_is_pfmemalloc() returns true, they simply release the 'problematic'page
and attempt a new allocation.
( git grep -n page_is_pfmemalloc -- drivers/net/ethernet/ )
>
>> Also consider that NIC typically have thousands of pre-allocated page/frags
>> for their RX ring buffers, they might all have pfmemalloc set, so we are speaking
>> of thousands of packet drops before the RX-ring can be refilled with normal (non pfmemalloc) page/frags.
>>
>> If we want to solve this issue more generically, we would have to try
>> to copy data into a non pfmemalloc frag instead of dropping skb that
>> had frags allocated minutes ago under memory pressure.
>
> I don't think we need to copy anything. We need to figure out if the
> system is still under memory pressure, and if not, we can clear the
> pfmemalloc bit on the frag, as in my second patch. The 'least change'
> way of doing that is to try to allocate a page, but the VM could export
> a symbol that says "we're not under memory pressure any more".
>
> Did you want to move checking that into the networking layer, or do you
> want to keep it in the pagefrag allocator?
I think your proposal is fine, thanks !
next prev parent reply other threads:[~2020-11-04 12:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-03 19:32 [PATCH 1/1] mm: avoid re-using pfmemalloc page in page_frag_alloc() Dongli Zhang
2020-11-03 20:35 ` Matthew Wilcox
2020-11-03 20:57 ` Dongli Zhang
2020-11-03 21:15 ` Matthew Wilcox
2020-11-03 21:37 ` Dongli Zhang
2020-11-04 1:16 ` Rama Nichanamatlu
2020-11-04 8:50 ` Eric Dumazet
2020-11-04 12:36 ` Matthew Wilcox
2020-11-04 12:51 ` Eric Dumazet [this message]
2020-11-04 16:41 ` Dongli Zhang
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=053d1d51-430a-2fa9-fb72-fee5d2f9785c@gmail.com \
--to=eric.dumazet@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=aruna.ramakrishna@oracle.com \
--cc=bert.barbe@oracle.com \
--cc=davem@davemloft.net \
--cc=dongli.zhang@oracle.com \
--cc=joe.jin@oracle.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=manjunath.b.patil@oracle.com \
--cc=netdev@vger.kernel.org \
--cc=rama.nichanamatlu@oracle.com \
--cc=srinivas.eeda@oracle.com \
--cc=venkat.x.venkatsubra@oracle.com \
--cc=willy@infradead.org \
/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;
as well as URLs for NNTP newsgroup(s).