Received: by 10.192.165.148 with SMTP id m20csp398469imm; Fri, 20 Apr 2018 00:46:46 -0700 (PDT) X-Google-Smtp-Source: AIpwx4810zH0ZesZw3DSrZogRiButmOq9xyDeW5jYsWdRp/aL/vUILEx5CJ8fpxjhkOZLAYbnUUC X-Received: by 2002:a17:902:6f16:: with SMTP id w22-v6mr9106957plk.216.1524210406847; Fri, 20 Apr 2018 00:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524210406; cv=none; d=google.com; s=arc-20160816; b=qUzpV5oGda4Q0bmS1jz44ZV2m4EnCwxmI+2N0bfq5ddbJvB9W6QCMkGQOEKJEel17A uiTcjnEoKG/0CN+93gQqVRkmFNwYOJ9drEpAyEyDut4khAlBB6qKsCIKDCLxDPdt+qqI RkieAmUIbLaUnmnKiP/Zk35Rdx3r0TOt4TB8rn1eDNrkD/5hy/kF0dQP6YI2L/bHn/q4 Cn9uzkkEnjpsuXldc4jyREtl9NunhZUCIoRA1OgQwc9AEuViPSHmNmGYatMdB9VtDU/N YE5j2JOyCsSLsnl8F9anI9dItxELFjpcEsYMgVScTMMy49dgjm2JO5vgwYbBeOUXTdAx 2Wag== 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=v3vo2oU2NluOP2uHeNNwwkqowUPPWHf08fKNCt0waaU=; b=z3itWbIFkEYkpYioXkjGo9uKSLnLo9fQkYb6IQQlKPnGmZG6kTIvJqq2KIUW6+6Q3S X1P8Gv7TwiADXgyc748u8tWawSZDMTVlEvr80BoVkmmtAc789cqrvqSclzYtZDtkCra+ /dmOgbaexeNL74vAAznPG87k4iWKYxoNX3lCcZRLG1Lmln/9AJmGdqWB1y9hGBeQfSy0 mK0RdoAbj16RxkWpyc+ffmw6hQmAKL5WAvJk0LOG7mPufrP0gXiHp+UjEq6lite1Cf5F XGD+mL4AnOxWq8zZ8CLb7YG84b22m6xfA2CL+XUUo0223rxmsGdfI8zELVA31SPqvYgI Q+1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=A39fZwnH; 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 r7-v6si5300737plo.486.2018.04.20.00.46.32; Fri, 20 Apr 2018 00:46:46 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=A39fZwnH; 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 S1753918AbeDTHpY (ORCPT + 99 others); Fri, 20 Apr 2018 03:45:24 -0400 Received: from merlin.infradead.org ([205.233.59.134]:46154 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751033AbeDTHpX (ORCPT ); Fri, 20 Apr 2018 03:45:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=v3vo2oU2NluOP2uHeNNwwkqowUPPWHf08fKNCt0waaU=; b=A39fZwnHqylU1u7ZcAIp4Gfcl h8p70KzwUhDfQvioUVFm4kSYPnjQ8abCmbiGZ2QfwSN4VJz6GvKs9wQvDg82EeKZ7SyXsYL4WMLGO ZB8neBKBPMopQ7mdvt3GYtG0KqXLRjcpGOpQZmCc70KMr66rtbcGTDKYnX/Vz3NOIqWfFPeyhUa2W dE4Qu3xQ5p97mzHC85t2o6JIsMT91VPzs51kDKXYpCVlRYKPtCvPQJHg+NybhNl03PRZFMqbLfQTU nLl809Ixg9CKKPPIthKd2WO4Yfzdj14NmJRAeAVN5hp4E+aR+t/SMeSFjnCqZEGYIyyJZNC2xtnXS cbFIB3E+g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1f9Qj5-0001eE-45; Fri, 20 Apr 2018 07:45:01 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DDAA52029B0F8; Fri, 20 Apr 2018 09:44:56 +0200 (CEST) Date: Fri, 20 Apr 2018 09:44:56 +0200 From: Peter Zijlstra To: Nicholas Piggin Cc: linux-kernel@vger.kernel.org, Ingo Molnar , "Rafael J. Wysocki" , "Paul E . McKenney" Subject: Re: [RFC PATCH] kernel/sched/core: busy wait before going idle Message-ID: <20180420074456.GA4064@hirez.programming.kicks-ass.net> References: <20180415133149.24112-1-npiggin@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180415133149.24112-1-npiggin@gmail.com> User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 15, 2018 at 11:31:49PM +1000, Nicholas Piggin wrote: > This is a quick hack for comments, but I've always wondered -- > if we have a short term polling idle states in cpuidle for performance > -- why not skip the context switch and entry into all the idle states, > and just wait for a bit to see if something wakes up again. Is that context switch so expensive? And what kernel did you test on? We recently merged a bunch of patches from Rafael that avoided disabling the tick for short idle predictions. This also has a performance improvements for such workloads. Did your kernel include those? > It's not uncommon to see various going-to-idle work in kernel profiles. > This might be a way to reduce that (and just the cost of switching > registers and kernel stack to idle thread). This can be an important > path for single thread request-response throughput. So I feel that _if_ we do a spin here, it should only be long enough to amortize the schedule switch context. However, doing busy waits here has the downside that the 'idle' time is not in fact fed into the cpuidle predictor.