Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756337AbbFPHy0 (ORCPT ); Tue, 16 Jun 2015 03:54:26 -0400 Received: from cantor2.suse.de ([195.135.220.15]:44248 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756206AbbFPHyS (ORCPT ); Tue, 16 Jun 2015 03:54:18 -0400 Date: Tue, 16 Jun 2015 09:54:14 +0200 From: Petr Mladek To: Oleg Nesterov Cc: Andrew Morton , Tejun Heo , Ingo Molnar , Peter Zijlstra , Richard Weinberger , Steven Rostedt , David Woodhouse , linux-mtd@lists.infradead.org, Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org, Chris Mason , "Paul E. McKenney" , Thomas Gleixner , Linus Torvalds , Jiri Kosina , Borislav Petkov , Michal Hocko , live-patching@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH 06/18] signal/kthread: Initial implementation of kthread signal handling Message-ID: <20150616075414.GE3135@pathway.suse.cz> References: <1433516477-5153-1-git-send-email-pmladek@suse.cz> <1433516477-5153-7-git-send-email-pmladek@suse.cz> <20150606215816.GB15591@redhat.com> <20150608135107.GB3135@pathway.suse.cz> <20150608211336.GB24869@redhat.com> <20150615131341.GN9409@pathway.suse.cz> <20150615191429.GA29727@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150615191429.GA29727@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1059 Lines: 32 On Mon 2015-06-15 21:14:29, Oleg Nesterov wrote: > Ah, understand. You think that we need to take ->siglock in advance > to avoid the race with SIGCONT? exactly > No, we don't. Let me show you the code I suggested again: > > void kthread_do_signal_stop(void) > { > spin_lock_irq(&curtent->sighand->siglock); > if (current->jobctl & JOBCTL_STOP_DEQUEUED) > __set_current_state(TASK_STOPPED); > spin_unlock_irq(¤t->sighand->siglock); > > schedule(); > } > > so you can dequeue_signal() and call kthread_do_signal_stop() without > holding ->siglock. We can rely on JOBCTL_STOP_DEQUEUED bit. SIGCONT > clears it, so kthread_do_signal_stop() can't race. Heureka, I have got it. I have previously missed the meaning of the JOBCTL_STOP_DEQUEUED bit. Thanks for explanation. Best Regards, Petr -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/