Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1317224

Re: [PATCH v4 10/22] kthread: Allow to modify delayed kthread work

From Tejun Heo <tj@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v4 10/22] kthread: Allow to modify delayed kthread work
Date 2016-01-25 20:20 +0100
Message-ID <qUUQa-cl-21@gated-at.bofh.it> (permalink)
References <qURyW-64A-19@gated-at.bofh.it> <qURyW-64A-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Mon, Jan 25, 2016 at 04:44:59PM +0100, Petr Mladek wrote:
> +bool mod_delayed_kthread_work(struct kthread_worker *worker,
> +			      struct delayed_kthread_work *dwork,
> +			      unsigned long delay)
> +{
> +	struct kthread_work *work = &dwork->work;
> +	unsigned long flags;
> +	int ret = 0;
> +
> +try_again:
> +	spin_lock_irqsave(&worker->lock, flags);
> +	WARN_ON_ONCE(work->worker && work->worker != worker);
> +
> +	if (work->canceling)
> +		goto out;
> +
> +	ret = try_to_cancel_kthread_work(work, &worker->lock, &flags);
> +	if (ret == -EAGAIN)
> +		goto try_again;
> +
> +	if (work->canceling)

Does this test need to be repeated?  How would ->canceling change
while worker->lock is held?

Thanks.

-- 
tejun

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v4 10/22] kthread: Allow to modify delayed kthread work Petr Mladek <pmladek@suse.com> - 2016-01-25 16:50 +0100
  Re: [PATCH v4 10/22] kthread: Allow to modify delayed kthread work Tejun Heo <tj@kernel.org> - 2016-01-25 20:20 +0100

csiph-web