[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <168262348084.2036355.16294550378793036683.stgit@firesoul>
Date: Thu, 27 Apr 2023 21:25:06 +0200
From: Jesper Dangaard Brouer <brouer@...hat.com>
To: Ilias Apalodimas <ilias.apalodimas@...aro.org>,
netdev@...r.kernel.org, Eric Dumazet <eric.dumazet@...il.com>,
linux-mm@...ck.org, Mel Gorman <mgorman@...hsingularity.net>
Cc: Jesper Dangaard Brouer <brouer@...hat.com>, lorenzo@...nel.org,
Toke Høiland-Jørgensen <toke@...hat.com>,
linyunsheng@...wei.com, bpf@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Andrew Morton <akpm@...ux-foundation.org>, willy@...radead.org
Subject: [PATCH RFC net-next/mm V2 0/2] page_pool: new approach for leak
detection and shutdown phase
Patchset change summary:
- Remove PP workqueue and inflight warnings, instead rely on inflight
pages to trigger cleanup
- Moves leak detection to the MM-layer page allocator when combined
with CONFIG_DEBUG_VM.
The page_pool (PP) workqueue calling page_pool_release_retry generate
too many false-positive reports. Further more, these reports of
page_pool shutdown still having inflight packets are not very helpful
to track down the root-cause.
In the past these reports have helped us catch driver bugs, that
leaked pages by invoking put_page directly, often in code paths
handling error cases. PP pages had a shorter lifespan (within driver
and XDP code paths). Since PP pages got a recycle return path for
SKBs, the lifespan for a PP page can be much longer. Thus, it is time
to revisit periodic release retry mechanism. The default 60 sec
lifespan assumption is obviously wrong/obsolete, as things like TCP
sockets can keep SKBs around for much longer (e.g. retransmits,
timeouts, NAPI defer schemes etc).
The inflight reports, means one of two things: (1) API user is still
holding on, or (2) page got leaked and will never be returned to PP.
The PP need to accept it have no control over (1) how long outstanding
PP pages are kept by the API users. What we really want to is to catch
are(2) pages that "leak". Meaning they didn't get proper returned via
PP APIs.
Leaked PP pages result in these issues: (A) We can never release
page_pool memory structs, which (B) holds on to a refcnt on struct
device for DMA mapping, and (C) leaking DMA-mappings that (D) means a
hardware device can potentially write into a page returned to the page
allocator.
V2: Fix race found by Yunsheng Lin <linyunsheng@...wei.com>
---
Jesper Dangaard Brouer (2):
page_pool: Remove workqueue in new shutdown scheme
mm/page_pool: catch page_pool memory leaks
include/net/page_pool.h | 9 ++--
mm/page_alloc.c | 7 +++
net/core/page_pool.c | 100 +++++++++++++++++++++++++---------------
3 files changed, 73 insertions(+), 43 deletions(-)
--
Jesper
Powered by blists - more mailing lists