public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCHSET 0/3] io-wq locking improvements
@ 2023-08-09 19:43 Jens Axboe
  2023-08-09 19:43 ` [PATCH 1/3] io_uring/io-wq: don't grab wq->lock for worker activation Jens Axboe
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jens Axboe @ 2023-08-09 19:43 UTC (permalink / raw)
  To: io-uring

Hi,

In chatting with someone that was trying to use io_uring to read
mailddirs, they found that running a test case that does:

open file, statx file, read file, close file

The culprit here is statx, and argumentation aside on whether it makes
sense to statx in the first place, it does highlight that io-wq is
pretty locking intensive.

This (very lightly tested [1]) patchset attempts to improve this
situation, but reducing the frequency of grabbing wq->lock and
acct->lock.

The first patch gets rid of wq->lock on work insertion. io-wq grabs it
to iterate the free worker list, but that is not necessary.

Second patch reduces the frequency of acct->lock grabs, when we need to
run the queue and process new work. We currently grab the lock and check
for work, then drop it, then grab it again to process the work. That is
unneccessary.

Final patch just optimizes how we activate new workers. It's not related
to the locking itself, just reducing the overhead of activating a new
worker.

Running the above test case on a directory with 50K files, each being
between 10 and 4096 bytes, before these patches we get spend 160-170ms
running the workload. With this patchset, we spend 90-100ms doing the
same work. A bit of profile information is included in the patch commit
messages.

Can also be found here:

https://git.kernel.dk/cgit/linux/log/?h=io_uring-wq-lock

[1] Runs the test suite just fine, with PROVE_LOCKING enabled and raw
    lockdep as well.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-11 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-09 19:43 [PATCHSET 0/3] io-wq locking improvements Jens Axboe
2023-08-09 19:43 ` [PATCH 1/3] io_uring/io-wq: don't grab wq->lock for worker activation Jens Axboe
2023-08-09 19:43 ` [PATCH 2/3] io_uring/io-wq: reduce frequency of acct->lock acquisitions Jens Axboe
2023-08-09 19:43 ` [PATCH 3/3] io_uring/io-wq: don't gate worker wake up success on wake_up_process() Jens Axboe
2023-08-11  4:00 ` [PATCHSET 0/3] io-wq locking improvements Hao Xu
2023-08-11 16:36   ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox