From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD00AC47089 for ; Thu, 27 May 2021 15:14:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 97FDE61358 for ; Thu, 27 May 2021 15:14:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 97FDE61358 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bsrNK9D93WmNeZU4d7YbD7bWzJD5D6lBBnCF01xAKRs=; b=l44PPbyIqRjObm RHC69O3+DAz/LJS8YSF/QMXxgTW1fX7eluf8IHqCYegw5j0d2DVfF8j4jGoarbWx+9ULX4d+grFN6 mJRdedT/r2HLuKGRUfKunsqKboWWmXxpUGJuF7MG40LWjjBWQB+wwK1txTol2KCrpZ1r/7c84+Bo5 9ukAvTShlgyv76zGDcb69lqGChT/f1KnSmZFTRjia//xue8XBVjuwM60LQNQeTe1yWyKVkEkyptVy wmfrQ9iIBjUjnFVJvEgqvCPrdIQTDRwLNQcs9Urhwv5K/1rVFPfnIiLABWmdai1ODuDL4bHDrX5pG KwOHpYYTE6Jx+71WgZEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmHd1-00731d-AL; Thu, 27 May 2021 15:08:59 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lmHFD-006svy-KV for linux-arm-kernel@lists.infradead.org; Thu, 27 May 2021 14:44:21 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 825CF61181; Thu, 27 May 2021 14:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622126658; bh=bC9l7MRsxVJ2kY1MsF0KeFCAkODPDJOZ+Ldk31//gtw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CGMYmmsX+GwjQ4QJpoNA3tllJTW+i8lxKQRNYU4scvoTSMQI67B9xFMjxWEBvMQhl h7doWGV3LCla6k4h+egE1uVipNEO/eCAQM48UiakRiPtCdEpw8PEDU+EPzTxFrnM47 Z5NzykJr3DJZX0WiWU6tyyhMXuTzW1xVUv+3p+atck1Gt1ALC7bDRC79z135cTRibo Vd88Ix9Px34jUaluSJD5Ss1RjLvEFypalPshY1Kxe4ZTsRWiZ+fVjAeAWwqhLvY7fW A7HkAkxUkB8ys3aBuIxDhlb40Qg1do3JdBqlnIh0xeOCTf9LdQZ/yjuq4AeqbFvK/+ 27cvAxLOpuNIA== Date: Thu, 27 May 2021 15:44:12 +0100 From: Will Deacon To: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, Catalin Marinas , Marc Zyngier , Greg Kroah-Hartman , Morten Rasmussen , Qais Yousef , Suren Baghdasaryan , Quentin Perret , Tejun Heo , Johannes Weiner , Ingo Molnar , Juri Lelli , Vincent Guittot , "Rafael J. Wysocki" , Dietmar Eggemann , Daniel Bristot de Oliveira , kernel-team@android.com Subject: Re: [PATCH v7 16/22] sched: Defer wakeup in ttwu() for unschedulable frozen tasks Message-ID: <20210527144412.GB23086@willie-the-truck> References: <20210525151432.16875-1-will@kernel.org> <20210525151432.16875-17-will@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210527_074419_803056_A737E703 X-CRM114-Status: GOOD ( 22.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 27, 2021 at 04:31:51PM +0200, Peter Zijlstra wrote: > On Thu, May 27, 2021 at 04:10:16PM +0200, Peter Zijlstra wrote: > > On Tue, May 25, 2021 at 04:14:26PM +0100, Will Deacon wrote: > > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > > > index 42e2aecf087c..6cb9677d635a 100644 > > > --- a/kernel/sched/core.c > > > +++ b/kernel/sched/core.c > > > @@ -3529,6 +3529,19 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags) > > > if (!(p->state & state)) > > > goto unlock; > > > > > > +#ifdef CONFIG_FREEZER > > > + /* > > > + * If we're going to wake up a thread which may be frozen, then > > > + * we can only do so if we have an active CPU which is capable of > > > + * running it. This may not be the case when resuming from suspend, > > > + * as the secondary CPUs may not yet be back online. See __thaw_task() > > > + * for the actual wakeup. > > > + */ > > > + if (unlikely(frozen_or_skipped(p)) && > > > + !cpumask_intersects(cpu_active_mask, task_cpu_possible_mask(p))) > > > + goto unlock; > > > +#endif > > > + > > > trace_sched_waking(p); > > > > > > /* We're going to change ->state: */ > > > > OK, I really hate this. This is slowing down the very hot wakeup path > > for the silly freezer that *never* happens. Let me try and figure out if > > there's another option. > > > How's something *completely* untested like this? I'm not seeing how this handles tasks which weren't put in the freezer because they have PF_FREEZER_SKIP set. For these tasks, we need to make sure that they don't become runnable before we have onlined a core which is capable of running them, and this could occur because of any old wakeup (i.e. whatever it was that they blocked on). Will _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel