From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752061AbdHLUDZ (ORCPT ); Sat, 12 Aug 2017 16:03:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:41944 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751086AbdHLUDX (ORCPT ); Sat, 12 Aug 2017 16:03:23 -0400 Date: Sat, 12 Aug 2017 22:03:19 +0200 (CEST) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: Josh Poimboeuf cc: Miroslav Benes , jeyu@kernel.org, pmladek@suse.com, lpechacek@suse.cz, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Oleg Nesterov , Michael Ellerman , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v2 2/3] livepatch: send a fake signal to all blocking tasks In-Reply-To: <20170811213046.bpbnhbbhqxn4jnmj@treble> Message-ID: References: <20170810104815.14727-1-mbenes@suse.cz> <20170810104815.14727-3-mbenes@suse.cz> <20170811213046.bpbnhbbhqxn4jnmj@treble> User-Agent: Alpine 2.20 (LSU 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 11 Aug 2017, Josh Poimboeuf wrote: > > + read_lock(&tasklist_lock); > > + for_each_process_thread(g, task) { > > + if (!klp_patch_pending(task)) > > + continue; > > + > > + /* > > + * There is a small race here. We could see TIF_PATCH_PENDING > > + * set and decide to wake up a kthread or send a fake signal. > > + * Meanwhile the task could migrate itself and the action > > + * would be meaningless. It is not serious though. > > + */ > > + if (task->flags & PF_KTHREAD) { > > + /* > > + * Wake up a kthread which still has not been migrated. > > + */ > > + wake_up_process(task); > > + } else { > > + /* > > + * Send fake signal to all non-kthread tasks which are > > + * still not migrated. > > + */ > > + spin_lock_irq(&task->sighand->siglock); > > + signal_wake_up(task, 0); > > + spin_unlock_irq(&task->sighand->siglock); > > + } > > + } > > + read_unlock(&tasklist_lock); > > I can't remember if we talked about this before, is it possible to also > signal/wake the idle tasks? Scheduler won't select idle task in case there is *anything* else runnable in any other sched class anyway. And if that is the case, there is no need for explicit wakeup, as idle task would get scheduled anyway implicitly. So idle task is a little bit more difficult than that, unfortunately. -- Jiri Kosina SUSE Labs