From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751371AbbEBQ1y (ORCPT ); Sat, 2 May 2015 12:27:54 -0400 Received: from mail-ie0-f177.google.com ([209.85.223.177]:33234 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750966AbbEBQ1u (ORCPT ); Sat, 2 May 2015 12:27:50 -0400 MIME-Version: 1.0 In-Reply-To: <20150502183001.07eae212@notabene.brown> References: <1430502057.4472.255.camel@redhat.com> <20150501193813.GA2812@gmail.com> <20150502183001.07eae212@notabene.brown> Date: Sat, 2 May 2015 09:27:49 -0700 X-Google-Sender-Auth: spvf-xoa8YIPa2dPnrAq40tZQSQ Message-ID: Subject: Re: [PATCH] signals: Generate warning when flush_signals() is called from non-kthread context From: Linus Torvalds To: NeilBrown Cc: Ingo Molnar , Evgeniy Polyakov , Stephen Smalley , Alex Williamson , Oleg Nesterov , linux-kernel , kvm Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, May 2, 2015 at 1:30 AM, NeilBrown wrote: > > All the calls in md.c are in a kernel thread so safe, but I'd rather have an > explicit "uninterruptible, but no load-average" wait.... Hmm. Our task state is a bitmask anyway, so we could probably just add a #define __TASK_NOLOAD 16 (and move the EXIT_xyz defines *away* from the list that is actually the task state), and teach our load average thing to not count those kinds of waits. Then you could just use TASK_UNINTERRUPTIBLE | __TASK_NOLOAD to make processes not count towards the load. Or - probably preferably - we could really clean things up, and make things much more like the bitmask it *should* be, and have explicit bits for - SLEEPING/STOPPED/EXITING ("why not running?") - LOADAVG (accounted towards load) - WAKESIG (ie "interruptible") - WAKEKILL (this we already have) and just make the rule be that we use "__TASK_xyz" for the actual individual bits, and "TASK_xyz" for the helper combinations. So then we'd have #define TASK_UNINTERRUPTIBLE (__TASK_SLEEPING | __TASK_LOADAVG) #define TASK_INTERRUPTIBLE (__TASK_SLEEPING | __TASK_WAKESIG) #define TASK_KILLABLE (__TASK_SLEEPING | __TASK_WAKEKILL) #define TASK_NOLOADAVG (__TASK_SLEEPING) which is almost certainly how this *should* have been done, but isn't, because of historical use. Cleaning up like that *should* be fairly simple, but I'd be a bit nervous about getting all the state comparisons right (we have an unholy mix of "check this bit" and "check this whole state", and we'd need to make sure we get those cases all right). Ingo, what do you think? This is mostly a scheduler interface issue.. Linus