From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758263AbcAYTTQ (ORCPT ); Mon, 25 Jan 2016 14:19:16 -0500 Received: from mail-pa0-f66.google.com ([209.85.220.66]:33322 "EHLO mail-pa0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758247AbcAYTTN (ORCPT ); Mon, 25 Jan 2016 14:19:13 -0500 Date: Mon, 25 Jan 2016 14:19:09 -0500 From: Tejun Heo To: Petr Mladek Cc: Andrew Morton , Oleg Nesterov , Ingo Molnar , Peter Zijlstra , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Thomas Gleixner , Linus Torvalds , Jiri Kosina , Borislav Petkov , Michal Hocko , linux-mm@kvack.org, Vlastimil Babka , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 10/22] kthread: Allow to modify delayed kthread work Message-ID: <20160125191909.GF3628@mtj.duckdns.org> References: <1453736711-6703-1-git-send-email-pmladek@suse.com> <1453736711-6703-11-git-send-email-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453736711-6703-11-git-send-email-pmladek@suse.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH v4 10/22] kthread: Allow to modify delayed kthread work Date: Mon, 25 Jan 2016 14:19:09 -0500 Message-ID: <20160125191909.GF3628@mtj.duckdns.org> References: <1453736711-6703-1-git-send-email-pmladek@suse.com> <1453736711-6703-11-git-send-email-pmladek@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <1453736711-6703-11-git-send-email-pmladek@suse.com> Sender: owner-linux-mm@kvack.org To: Petr Mladek Cc: Andrew Morton , Oleg Nesterov , Ingo Molnar , Peter Zijlstra , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Thomas Gleixner , Linus Torvalds , Jiri Kosina , Borislav Petkov , Michal Hocko , linux-mm@kvack.org, Vlastimil Babka , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-api@vger.kernel.org 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org