[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YDUkoTGk2G/GZj8w@alley>
Date: Tue, 23 Feb 2021 16:52:01 +0100
From: Petr Mladek <pmladek@...e.com>
To: Yiwei Zhang <zzyiwei@...roid.com>
Cc: Christoph Hellwig <hch@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Felix Kuehling <Felix.Kuehling@....com>,
Jens Axboe <axboe@...nel.dk>,
"J. Bruce Fields" <bfields@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Frederic Weisbecker <frederic@...nel.org>,
Marcelo Tosatti <mtosatti@...hat.com>,
Ilias Stamatis <stamatis.iliass@...il.com>,
Rob Clark <robdclark@...omium.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Liang Chen <cl@...k-chips.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
kernel-team <kernel-team@...roid.com>
Subject: Re: [PATCH] kthread: add kthread_mod_pending_delayed_work api
On Mon 2021-02-22 16:58:46, Yiwei Zhang wrote:
> Since you awesome guys are here, I do have another kthread related
> question, and hopefully to get some suggestions:
>
> Below are the conditions:
> 1. The caller threads queuing the work are normal threads(non-RT).
> 2. The worker thread is a realtime kernel thread with relatively high prio.
> 3. We are not allowed to pin caller threads to fixed cpu clusters.
>
> Sometimes when the CPU is busy, the worker thread starts preempting
> the caller thread,
This works as expected. RT tasks have higher priority than normal tasks.
> 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.
Best Regards,
Petr
Powered by blists - more mailing lists