From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: Alexander Lobakin <aleksander.lobakin@intel.com>,
Maciej Fijalkowski <maciej.fijalkowski@intel.com>,
Larysa Zaremba <larysa.zaremba@intel.com>,
Yunsheng Lin <linyunsheng@huawei.com>,
Alexander Duyck <alexanderduyck@fb.com>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Ilias Apalodimas <ilias.apalodimas@linaro.org>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH RFC net-next v2 2/7] net: page_pool: place frag_* fields in one cacheline
Date: Fri, 14 Jul 2023 19:08:45 +0200 [thread overview]
Message-ID: <20230714170853.866018-3-aleksander.lobakin@intel.com> (raw)
In-Reply-To: <20230714170853.866018-1-aleksander.lobakin@intel.com>
On x86_64, frag_* fields of struct page_pool are scattered across two
cachelines despite the summary size of 24 bytes. The last field,
::frag_users, is pushed out to the next one, sharing it with
::alloc_stats.
All three fields are used in pretty much the same places. There are some
holes and cold members to move around. Move frag_* one block up, placing
them right after &page_pool_params perfectly at the beginning of CL2.
This doesn't do any meaningful to the second block, as those are some
destroy-path cold structures, and doesn't do anything to ::alloc_stats,
which still starts at 200-byte offset, 8 bytes after CL3 (still fitting
into 1 cacheline).
On my setup, this yields 1-2% of Mpps when using PP frags actively.
When it comes to 32-bit architectures with 32-byte CL: &page_pool_params
plus ::pad is 44 bytes, the block taken care of is 16 bytes within one
CL, so there should be at least no regressions from the actual change.
Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com>
---
include/net/page_pool.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/include/net/page_pool.h b/include/net/page_pool.h
index 829dc1f8ba6b..212d72b5cfec 100644
--- a/include/net/page_pool.h
+++ b/include/net/page_pool.h
@@ -130,16 +130,16 @@ static inline u64 *page_pool_ethtool_stats_get(u64 *data, void *stats)
struct page_pool {
struct page_pool_params p;
+ long frag_users;
+ struct page *frag_page;
+ unsigned int frag_offset;
+ u32 pages_state_hold_cnt;
+
struct delayed_work release_dw;
void (*disconnect)(void *);
unsigned long defer_start;
unsigned long defer_warn;
- u32 pages_state_hold_cnt;
- unsigned int frag_offset;
- struct page *frag_page;
- long frag_users;
-
#ifdef CONFIG_PAGE_POOL_STATS
/* these stats are incremented while in softirq context */
struct page_pool_alloc_stats alloc_stats;
--
2.41.0
next prev parent reply other threads:[~2023-07-14 17:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-14 17:08 [PATCH RFC net-next v2 0/7] net: page_pool: a couple of assorted optimizations Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 1/7] net: skbuff: don't include <net/page_pool.h> to <linux/skbuff.h> Alexander Lobakin
2023-07-14 17:08 ` Alexander Lobakin [this message]
2023-07-14 17:14 ` [PATCH RFC net-next v2 2/7] net: page_pool: place frag_* fields in one cacheline Alexander Lobakin
2023-07-14 18:37 ` Jesper Dangaard Brouer
2023-07-18 13:50 ` Alexander Lobakin
2023-07-26 8:13 ` Ilias Apalodimas
2023-07-26 10:39 ` Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 2/7] net: page_pool: shrink &page_pool_params a tiny bit Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 3/7] net: page_pool: place frag_* fields in one cacheline Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 3/7] net: page_pool: shrink &page_pool_params a tiny bit Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 4/7] net: page_pool: don't use driver-set flags field directly Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 5/7] net: page_pool: avoid calling no-op externals when possible Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 6/7] net: skbuff: avoid accessing page_pool if !napi_safe when returning page Alexander Lobakin
2023-07-14 17:08 ` [PATCH RFC net-next v2 7/7] net: skbuff: always try to recycle PP pages directly when in softirq Alexander Lobakin
2023-07-19 0:40 ` Jakub Kicinski
2023-07-19 16:34 ` Alexander Lobakin
2023-07-19 20:51 ` Jakub Kicinski
2023-07-20 16:46 ` Alexander Lobakin
2023-07-20 17:12 ` Jakub Kicinski
2023-07-20 17:48 ` Alexander Lobakin
2023-07-20 18:00 ` Jakub Kicinski
2023-07-20 18:01 ` Alexander Lobakin
2023-07-20 18:13 ` Alexander Lobakin
2023-07-20 19:20 ` Jakub Kicinski
2023-07-20 19:33 ` Alexander Lobakin
2023-07-20 19:46 ` Jakub Kicinski
2023-07-21 11:53 ` Yunsheng Lin
2023-07-21 15:37 ` Alexander Lobakin
2023-07-21 16:01 ` Jakub Kicinski
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=20230714170853.866018-3-aleksander.lobakin@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=alexanderduyck@fb.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=ilias.apalodimas@linaro.org \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linyunsheng@huawei.com \
--cc=maciej.fijalkowski@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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
all inboxes | Powered by JetHome®