[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4c9dbcc4-cae7-c7ad-8066-31d49239750a@kernel.dk>
Date: Fri, 2 Oct 2020 09:52:24 -0600
From: Jens Axboe <axboe@...nel.dk>
To: Thomas Gleixner <tglx@...utronix.de>,
Oleg Nesterov <oleg@...hat.com>
Cc: linux-kernel@...r.kernel.org, io-uring@...r.kernel.org,
peterz@...radead.org
Subject: Re: [PATCH 3/3] task_work: use TIF_TASKWORK if available
On 10/2/20 9:31 AM, Thomas Gleixner wrote:
> On Fri, Oct 02 2020 at 17:14, Oleg Nesterov wrote:
>> Heh. To be honest I don't really like 1-2 ;)
>
> I do not like any of this :)
>
>> So I think that if we are going to add TIF_TASKWORK we should generalize
>> this logic and turn it into TIF_NOTIFY_SIGNAL. Similar to TIF_NOTIFY_RESUME
>> but implies signal_pending().
>>
>> IOW, something like
>>
>> void set_notify_signal(task)
>> {
>> if (!test_and_set_tsk_thread_flag(task, TIF_NOTIFY_SIGNAL)) {
>> if (!wake_up_state(task, TASK_INTERRUPTIBLE))
>> kick_process(t);
>> }
>> }
>>
>> // called by exit_to_user_mode_loop() if ti_work & _TIF_NOTIFY_SIGNAL
>> void tracehook_notify_signal(regs)
>> {
>> clear_thread_flag(TIF_NOTIFY_SIGNAL);
>> smp_mb__after_atomic();
>> if (unlikely(current->task_works))
>> task_work_run();
>> }
>>
>> This way task_work_run() doesn't need to clear TIF_NOTIFY_SIGNAL and it can
>> have more users.
>
> I think it's fundamentaly wrong that we have several places and several
> flags which handle task_work_run() instead of having exactly one place
> and one flag.
I don't disagree with that. I know it's not happening in this series, but
if we to the TIF_NOTIFY_SIGNAL route and get all archs supporting that,
then we can kill the signal and notify resume part of running task_work.
And that leaves us with exactly one place that runs it.
So we can potentially improve the current situation in that regard.
--
Jens Axboe
Powered by blists - more mailing lists