From: Breno Leitao <leitao@debian.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: davem@davemloft.net, pabeni@redhat.com, edumazet@google.com,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 4/4] net: dqs: make struct dql more cache efficient
Date: Wed, 10 Apr 2024 06:52:56 -0700 [thread overview]
Message-ID: <ZhaZuOjq+b5nzqcs@gmail.com> (raw)
In-Reply-To: <20240409172149.6f285b68@kernel.org>
On Tue, Apr 09, 2024 at 05:21:49PM -0700, Jakub Kicinski wrote:
> On Mon, 8 Apr 2024 10:25:56 -0700 Breno Leitao wrote:
> > With the previous change, struct dqs->stall_thrs will be in the hot path
> > (at queue side), even if DQS is disabled.
> >
> > The other fields accessed in this function (last_obj_cnt and num_queued)
> > are in the first cache line, let's move this field (stall_thrs) to the
> > very first cache line, since there is a hole there.
> >
> > This does not change the structure size, since it moves an short (2
> > bytes) to 4-bytes whole in the first cache line.
>
> Doesn't this move the cache line bouncing problem to the other side?
I think so. Looking at dql_check_stall(), it only uses fields in the
second cache line, except now 'dql->stall_thrs' that is in the first
cache line.
> Eric said "copy" I read that as "have two fields with the same value".
Sorry, I misunderstood it. I can create two fields, and update them
together at the only place where they will be updated
(bql_set_stall_thrs).
> I think it's single digit number of alu instructions we'd be saving
> here, not super convinced patch 3 is the right trade off...
Right. I was more concerned about the write barriers (smp_wmb()) inside
the loop which happen quite frequently.
But, if you think that the this is not the right approach, I can drop
this whole patchset. Do you think a profiler will us here?
Thanks!
next prev parent reply other threads:[~2024-04-10 13:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 17:25 [PATCH v2 0/4] net : dqs: optimize if stall threshold is not set Breno Leitao
2024-04-08 17:25 ` [PATCH net-next v2 1/4] net: dql: Avoid calling BUG() when WARN() is enough Breno Leitao
2024-04-08 17:25 ` [PATCH net-next v2 2/4] net: dql: Separate queue function responsibilities Breno Leitao
2024-04-08 17:25 ` [PATCH net-next v2 3/4] net: dql: Optimize stall information population Breno Leitao
2024-04-08 17:25 ` [PATCH net-next v2 4/4] net: dqs: make struct dql more cache efficient Breno Leitao
2024-04-10 0:21 ` Jakub Kicinski
2024-04-10 13:52 ` Breno Leitao [this message]
2024-04-11 1:45 ` 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=ZhaZuOjq+b5nzqcs@gmail.com \
--to=leitao@debian.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).