[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKB3++b+n=VWuXZqZqyZJvAf1+Wqogvi07L21GqdRwThSRdf2w@mail.gmail.com>
Date: Thu, 18 Feb 2021 22:29:24 -0800
From: Yiwei Zhangā€ˇ <zzyiwei@...roid.com>
To: Petr Mladek <pmladek@...e.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
> 2. User triggered clean up races with the clean up triggered by
> timeout. You try to handle this scenario by this patch.
Yes, exactly.
> 3. User does clean up after the clean up has already been done
> by the timeout.
This case is well handled. So only (2) has a potential race.
Let me clarify a bit more here. The "clean up" is not the clean up
when a process tears down, but it's actually a "post-work" to cancel
out an early "pre-work". The "pre-work" enqueues the delayed "post
work" for the timeout purpose. That pair of operations can repeatedly
happen.
The racing is currently worked around by refcounting the delayed_work
container, and the later "post-work" will take care of the work
deallocation.
I mainly want to reach out to see if we agree that this is a valid API
to be supported by kthread. Or we extend the existing
kthread_mod_delayed_work api to take another option to not re-queue if
the cancel failed.
Best,
Yiwei
Powered by blists - more mailing lists