All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Yiwei Zhang <zzyiwei@android.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Felix Kuehling <Felix.Kuehling@amd.com>,
	Jens Axboe <axboe@kernel.dk>,
	"J. Bruce Fields" <bfields@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Frederic Weisbecker <frederic@kernel.org>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Ilias Stamatis <stamatis.iliass@gmail.com>,
	Rob Clark <robdclark@chromium.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Liang Chen <cl@rock-chips.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	kernel-team <kernel-team@android.com>
Subject: Re: [PATCH] kthread: add kthread_mod_pending_delayed_work api
Date: Wed, 24 Feb 2021 10:34:25 +0100	[thread overview]
Message-ID: <YDYdoRwezfVsWS4W@alley> (raw)
In-Reply-To: <CAKB3++Yf5cv8shHU0T1nqfNTgbknU1uMu54YXWqNGqXHpa_oAA@mail.gmail.com>

On Tue 2021-02-23 14:29:37, Yiwei Zhang wrote:
> > > which is not cool because it will make the
> > > asynchronous effort a no-op. Is there a way we can include caller
> > > thread metadata(task_struct pointer?) when it enqueues the work so
> > > that the RT worker thread won't preempt the caller thread when that
> > > queued work gets scheduled? Probably require the CPU scheduler to poke
> > > at the next work...or any other ideas will be very appreciated,
> > > thanks!
> >
> > This sounds like a very strange use case.
> > Why is the worker kthread RT when the work can be delayed?
> >
> > If the kthread has to be RT because of another work then
> > your proposal will not work. The delayed processing of
> > low priority work might block and delay any pending
> > high priority work.
> >
> > You should consider handling the less important work in a separate
> > kthread worker with a lower priority or by the system workqueue.
> 
> Just want to clarify that it's not about delayed_work any more. In my
> latest question, it's a RT thread with normal work queued and
> scheduled to be run immediately. However, I simply don't want the
> worker to preempt the thread that queues the work.
> 
> It's a high prio work that we don't want other random tasks to preempt
> it. Meanwhile, we don't want it to preempt the called thread. In
> addition, assume we can't raise the priority of those caller
> threads(otherwise I'd be fine with using a workqueue).

Honestly, it sounds weird to me. Either the caller or the
worker has higher priority.

Well, I think that behavior could be achieved by
CONFIG_PREEMPT_NONE or CONFIG_PREEMPT_VOLUNTARY.

Anyway, this is rather a question for scheduler experts.
It is possible that it has some solution. But it is also
possible that it is so specific behavior and it would
complicate the scheduler too much.

Best Regards,
Petr

  reply	other threads:[~2021-02-24  9:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14  0:06 [PATCH] kthread: add kthread_mod_pending_delayed_work api Yiwei Zhang
2021-02-15 13:28 ` Petr Mladek
2021-02-16  9:11 ` Christoph Hellwig
2021-02-16 18:58   ` Yiwei Zhang‎
2021-02-17 11:14     ` Petr Mladek
2021-02-19  6:29       ` Yiwei Zhang‎
2021-02-19 10:27         ` Petr Mladek
2021-02-19 10:30           ` Christoph Hellwig
2021-02-19 10:56 ` Petr Mladek
2021-02-23  0:39   ` Yiwei Zhang‎
2021-02-23  0:58     ` Yiwei Zhang‎
2021-02-23 15:52       ` Petr Mladek
2021-02-23 22:29         ` Yiwei Zhang‎
2021-02-24  9:34           ` Petr Mladek [this message]
2021-02-25 22:17             ` Yiwei Zhang‎

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=YDYdoRwezfVsWS4W@alley \
    --to=pmladek@suse.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bfields@redhat.com \
    --cc=cl@rock-chips.com \
    --cc=frederic@kernel.org \
    --cc=hch@infradead.org \
    --cc=kernel-team@android.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mtosatti@redhat.com \
    --cc=peterz@infradead.org \
    --cc=robdclark@chromium.org \
    --cc=stamatis.iliass@gmail.com \
    --cc=zzyiwei@android.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.