All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: LongPing Wei <weilongping@oppo.com>
Cc: dm-devel@lists.linux.dev, eranm@google.com, guoweichao@oppo.com,
	mpatocka@redhat.com, snitzer@kernel.org,
	Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH] dm-verity: support block number limits for different ioprio classes
Date: Wed, 26 Mar 2025 09:40:57 -0700	[thread overview]
Message-ID: <20250326164057.GA1243@sol.localdomain> (raw)
In-Reply-To: <6c4f18d8-39f9-4eac-9bb2-d6f0d9c3b376@oppo.com>

On Wed, Mar 26, 2025 at 10:09:22AM +0800, LongPing Wei wrote:
> Hi, Eric
> 
> > If the CPU has been in softirq context for too long, then stop
> > choosing softirq context and instead fall back to the traditional
> > workqueue.  This could help address objections about increased use of >
> softirq context.
> 
> Could you share me some example about this?
> 

The objection that keeps getting raised to doing more work in softirq context is
that the latency of real-time tasks, such as audio tasks, may increase due to
softirqs having a higher priority than all tasks.  Causing audio skipping, etc.

The logic in handle_softirqs() in kernel/softirq.c actually goes a ways towards
addressing this already: it processes softirqs for at most 2 ms or until
rescheduling of the interrupted task gets requested, before deferring them to
ksoftirqd which runs at normal task priority.

The gaps that I see are (a) 2 ms is longer than desired, and (b) the limit does
not apply to *individual* softirqs.  Looking at (b), observe that the block
softirq (blk_done_softirq()) completes a list of I/O requests.  If there are a
lot of requests in that list, it could theoretically take more than the 2 ms
limit that kernel/softirq.c is meant to enforce (which is already too long).

So the objection would be that, even with dm-verity choosing to do in-line
verification only for 4 KiB requests which take only a few microseconds each, a
lot of requests could still add up to cause a long time to be spent in a single
softirq context.  (At least in theory.  AFAIK no one has confirmed that this is
actually a problem in practice with the 4 KiB limit applied.  But this is the
objection that I keep hearing whenever anyone suggests doing more in softirqs.)

But if dm-verity could detect this case happening and start deferring
verification work to task context, that should mostly address this concern, IMO.

One idea which *might* get us most of the way there pretty easily would be to do
the in-line verification only when need_resched() returns false.

- Eric

  reply	other threads:[~2025-03-26 16:40 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-25 10:49 [PATCH] dm-verity: support block number limits for different ioprio classes LongPing Wei
2025-03-25 17:43 ` Eric Biggers
2025-03-26  2:09   ` LongPing Wei
2025-03-26 16:40     ` Eric Biggers [this message]
2025-03-25 21:17 ` Mikulas Patocka
2025-03-26  1:30   ` [PATCH v2] " LongPing Wei
2025-03-26  5:18     ` Eric Biggers
2025-03-26  6:34       ` LongPing Wei
2025-03-26 11:04     ` Mikulas Patocka
2025-03-26 13:32       ` LongPing Wei
2025-03-26 16:53         ` Eric Biggers
2025-03-26 18:50           ` Mikulas Patocka
2025-03-26 20:32             ` Bart Van Assche
2025-03-26 20:48             ` Eric Biggers
2025-03-27  0:52               ` LongPing Wei
2025-03-27 17:05                 ` Eric Biggers
2025-03-27 17:12                   ` Mikulas Patocka
2025-03-27 17:35                     ` Eric Biggers
2025-03-27 19:03                       ` Mikulas Patocka
2025-03-27 19:39                         ` Mikulas Patocka
2025-03-27  2:18             ` [PATCH v3] " LongPing Wei
2025-03-27 16:16               ` Mikulas Patocka
2025-03-27 16:57               ` Eric Biggers

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=20250326164057.GA1243@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@lists.linux.dev \
    --cc=eranm@google.com \
    --cc=guoweichao@oppo.com \
    --cc=mpatocka@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=weilongping@oppo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.