Received: by 10.192.165.148 with SMTP id m20csp2318062imm; Thu, 26 Apr 2018 09:04:04 -0700 (PDT) X-Google-Smtp-Source: AIpwx49uPvh1isMzG69oE1miKWbq3AI32BTGVl0DQc2B3zZXEcLOioZsO7YLq6uExfsFCk6l8r8U X-Received: by 10.98.92.129 with SMTP id q123mr33201397pfb.252.1524758644595; Thu, 26 Apr 2018 09:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524758644; cv=none; d=google.com; s=arc-20160816; b=mQx+TtvBXcarVTkbuZ8xPqrkKqpPi78449pdjdcNqA/V6B0OnhCedye+LTrSmChJtW H5r9t43tCa6Dzs+KiJk7aXseL9Xx0MtriybCEGZoGpZdj9IHN5thNpVevkEaf5dfeasN jgMJU497kKynXGs5ZPNfDicl3jx/yyWovVeoL31L3d9BEncXovon6xKDuMr6kFlztRYA 6O/EIrXglZRFr+w8QiArk1QyQUnEZi71K4h4t6Unn0ERZu59RvniJOTPRXdluSqwipz7 mTgGaKdxBi+5gv29UAc6INCjc4B5grAG4cnO+4wXGxi/mbAiVkEC8ikfLoWkupn0sQlL uTVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ttC1bfr9JAhQPl6r2B/cFJMIJzZLWzmGwPBT5YO8WAw=; b=P7aUkDrHP+8XRmk+aGb8SpOI1V0tPXSzCeVFfY4sJ+qEgOR3JAVytfr4ieHA8MpNBQ FRQ+ydJldpi0G8vzVHfYUg10MR+e942fB8B3LzIap03xSu1gInKffB4dh0B2JS9mhm0B 4W1kS72wGFexIe9SK8JyCM8yYePsm39+Ldpd4IY7EzjM1/kAjao1dyOjp9v0mHoH0nz2 ciYADuxBTzbsdguMI4qsVXvgx3CIwS34PxL2LwS1ioF56bV0uqdFP36TeAOxfYrLzGcx zOmVJ+l9XwLZ+QdW1s1Fm7jRnAPhkZU6KiurGG4uGI9qfW9X/JrtS9ivCDvQ6MmsZ9Rp ewaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Uajj9oxn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i71si6310072pge.436.2018.04.26.09.03.50; Thu, 26 Apr 2018 09:04:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Uajj9oxn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756781AbeDZQCl (ORCPT + 99 others); Thu, 26 Apr 2018 12:02:41 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:40804 "EHLO mail-wm0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756519AbeDZQCh (ORCPT ); Thu, 26 Apr 2018 12:02:37 -0400 Received: by mail-wm0-f50.google.com with SMTP id j5so14317834wme.5 for ; Thu, 26 Apr 2018 09:02:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ttC1bfr9JAhQPl6r2B/cFJMIJzZLWzmGwPBT5YO8WAw=; b=Uajj9oxnsR8D+SgzFdCewTOnKe2mCV2aLwOpfJbMBY7xB60M8vVUBZuP8Se6PT8EQz BvhQcWHvEYx7NBRrt9BNE/CGHnewuEOmbaa4C8OZmY7K4z6a6pBR+/+QvGH4z670esCc 0qaat4JA295PrWLhvix+Zb0PjzatqBIS6Uea0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ttC1bfr9JAhQPl6r2B/cFJMIJzZLWzmGwPBT5YO8WAw=; b=Te9TSh6yynM9IL8oEH56KWtwbogfCr8U6HQ1ca3K2vpa63uB7wHyRRRH3Bj3+9m8Cq IYmoQIy8pXDuI5YY3yitSKQozoLwKEgsL/00zeyAKZSXSD9vavT7tGW79IQaKNT0pKmP 9R/jH35PATK8EmUG19EtFSYwUNtsq7466y3XE6yt+23YFe5wa17ltKQAsxbtK98eapMI yJrRV6YOw6328Gmr5jeF4sRkr73f8KqxkODxjr5EC0RGFBy7U9axciXsKVBf5c5udYEE uKBkyhGFAn6tdz9gRmHdRzTF8JCqthacNmTiFirt9CYRm1ElyeJD1Q5dlb01VD+b2tcI FVEg== X-Gm-Message-State: ALQs6tCM1ScqYCC/qynurt9oLt7knOhYK/FiK9Gz0LfSQlwiixMyGCxP vaNLnvbIlTJQUnXL7wrJP5x/GA== X-Received: by 10.28.166.9 with SMTP id p9mr3814074wme.146.1524758555790; Thu, 26 Apr 2018 09:02:35 -0700 (PDT) Received: from andrea (85.100.broadband17.iol.cz. [109.80.100.85]) by smtp.gmail.com with ESMTPSA id 80sm21384700wmk.46.2018.04.26.09.02.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 09:02:33 -0700 (PDT) Date: Thu, 26 Apr 2018 18:02:27 +0200 From: Andrea Parri To: Peter Zijlstra Cc: Gaurav Kohli , tglx@linutronix.de, mpe@ellerman.id.au, mingo@kernel.org, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Neeraj Upadhyay , Will Deacon , Oleg Nesterov Subject: Re: [PATCH v1] kthread/smpboot: Serialize kthread parking against wakeup Message-ID: <20180426160227.GA6297@andrea> References: <1524645199-5596-1-git-send-email-gkohli@codeaurora.org> <20180425200917.GZ4082@hirez.programming.kicks-ass.net> <20180426084131.GV4129@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180426084131.GV4129@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 26, 2018 at 10:41:31AM +0200, Peter Zijlstra wrote: [...] > +/* > + * Special states are those that do not use the normal wait-loop pattern. See > + * the comment with set_special_state(). > + */ > +#define is_special_state(state) \ > + ((state) == TASK_DEAD || \ > + (state) == TASK_STOPPED) > + > #ifdef CONFIG_DEBUG_ATOMIC_SLEEP > > +/* > + * Assert we don't use the regular *set_current_state() helpers for special > + * states. See the comment with set_special_state(). > + */ > +#define assert_special_state(state) WARN_ON_ONCE(is_special_state(state)) Nitpicking, this name suggests "Shout if the state is NOT special" to me: maybe, #define assert_special_state(state) WARN_ON_ONCE(!is_special_state(state)) #define assert_regular_state(state) WARN_ON_ONCE(is_special_state(state)) or just do with the WARN_ON_ONCE()s ? Andrea > + > #define __set_current_state(state_value) \ > do { \ > + assert_special_state(state_value); \ > current->task_state_change = _THIS_IP_; \ > current->state = (state_value); \ > } while (0) > + > #define set_current_state(state_value) \ > do { \ > + assert_special_state(state_value); \ > current->task_state_change = _THIS_IP_; \ > smp_store_mb(current->state, (state_value)); \ > } while (0) > > +#define set_special_state(state_value) \ > + do { \ > + unsigned long flags; /* may shadow */ \ > + WARN_ON_ONCE(!is_special_state(state_value)); \ > + raw_spin_lock_irqsave(¤t->pi_lock, flags); \ > + current->task_state_change = _THIS_IP_; \ > + current->state = (state_value); \ > + raw_spin_unlock_irqrestore(¤t->pi_lock, flags); \ > + } while (0)