netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Tejun Heo <tj@kernel.org>
Cc: Sherry Yang <sherry.yang@oracle.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rt-users@vger.kernel.org,
	Lai Jiangshan <jiangshanlai@gmail.com>,
	Sebastian Siewior <bigeasy@linutronix.de>,
	Jack Vogel <jack.vogel@oracle.com>,
	Tariq Toukan <tariqt@nvidia.com>,
	sultan@kerneltoast.com
Subject: Re: 10% regression in qperf tcp latency after introducing commit "4a61bf7f9b18 random: defer fast pool mixing to worker"
Date: Thu, 22 Sep 2022 18:45:37 +0200	[thread overview]
Message-ID: <YyyRMam6Eu8nmeCd@zx2c4.com> (raw)
In-Reply-To: <YyukQ/oU/jkp0OXA@slm.duckdns.org>

Hi Tejun,

On Wed, Sep 21, 2022 at 01:54:43PM -1000, Tejun Heo wrote:
> Hello,
> 
> On Thu, Sep 22, 2022 at 12:32:49AM +0200, Jason A. Donenfeld wrote:
> > What are our options? Investigate queue_work_on() bottlenecks? Move back
> > to the original pattern, but use raw spinlocks? Some thing else?
> 
> I doubt it's queue_work_on() itself if it's called at very high frequency as
> the duplicate calls would just fail to claim the PENDING bit and return but
> if it's being called at a high frequency, it'd be waking up a kthread over
> and over again, which can get pretty expensive. Maybe that ends competing
> with softirqd which is handling net rx or sth?

Huh, yea, interesting theory. Orrr, the one time that it _does_ pass the
test_and_set_bit check, the extra overhead here is enough to screw up
the latency? Both theories sound at least plausible.

> So, yeah, I'd try something which doesn't always involve scheduling and a
> context switch whether that's softirq, tasklet, or irq work.

Alright, I'll do that. I posted a diff for Sherry to try, and I'll make
that into a real patch and wait for her test.

> I probably am
> mistaken but I thought RT kernel pushes irq handling to threads so that
> these things can be handled sanely. Is this some special case?

It does mostly. But there's still a hard IRQ handler, somewhere, because
IRQs gotta IRQ, and the RNG benefits from getting a timestamp exactly
when that happens. So here we are.

Jason

  reply	other threads:[~2022-09-22 16:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <B1BC4DB8-8F40-4975-B8E7-9ED9BFF1D50E@oracle.com>
     [not found] ` <CAHmME9rUn0b5FKNFYkxyrn5cLiuW_nOxUZi3mRpPaBkUo9JWEQ@mail.gmail.com>
     [not found]   ` <04044E39-B150-4147-A090-3D942AF643DF@oracle.com>
     [not found]     ` <CAHmME9oKcqceoFpKkooCp5wriLLptpN=+WrrG0KcDWjBahM0bQ@mail.gmail.com>
     [not found]       ` <BD03BFF6-C369-4D34-A38B-49653F1CBC53@oracle.com>
2022-09-21 22:32         ` 10% regression in qperf tcp latency after introducing commit "4a61bf7f9b18 random: defer fast pool mixing to worker" Jason A. Donenfeld
2022-09-21 23:35           ` Jason A. Donenfeld
2022-09-21 23:54           ` Tejun Heo
2022-09-22 16:45             ` Jason A. Donenfeld [this message]
2022-09-22 16:55               ` [PATCH] random: use tasklet rather than workqueue for mixing fast pool Jason A. Donenfeld
2022-09-26 22:04                 ` [PATCH v2] random: use immediate per-cpu timer " Jason A. Donenfeld
2022-09-27  7:41                   ` David Laight
2022-09-27  8:23                     ` Jason A. Donenfeld
2022-09-27 10:42                       ` [PATCH v3] random: use expired per-cpu timer rather than wq " Jason A. Donenfeld
2022-09-28 12:06                         ` Sebastian Andrzej Siewior
2022-09-28 16:15                           ` Jason A. Donenfeld
2022-09-29 14:18                             ` Sebastian Andrzej Siewior
2022-09-28 11:23             ` 10% regression in qperf tcp latency after introducing commit "4a61bf7f9b18 random: defer fast pool mixing to worker" Sebastian Siewior

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=YyyRMam6Eu8nmeCd@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=bigeasy@linutronix.de \
    --cc=jack.vogel@oracle.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sherry.yang@oracle.com \
    --cc=sultan@kerneltoast.com \
    --cc=tariqt@nvidia.com \
    --cc=tj@kernel.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).