Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp758784ybl; Fri, 13 Dec 2019 04:14:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwdwVCxuBfBJr/YhXPUjh7iTWNKVrLwgNZgm9ustreN9JkM1YXElKeUodCLBL01lnDqUsrL X-Received: by 2002:a9d:4f0f:: with SMTP id d15mr14716697otl.179.1576239264825; Fri, 13 Dec 2019 04:14:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576239264; cv=none; d=google.com; s=arc-20160816; b=TM9rNlQC7w0mTmerDXaCyjfSdlyfqe7UaH9Lc0FRfAF+EDQZv9L4MCp7S5/EVezrna dSkBrGs9JA6WFZSET6b6eeDFPq2z6ZjElo5guWApekdSI7OFvXGM9Ha7HVFFlmQyEE0v q7huSDc+8rO3FQyg1ZYIZYgJH42afVrGEwD/JFOZ4j4vP/6Jlca+G30mYs/L7x/59BS2 CF01FyggUey+ThCRNU8beiSAWS7jyK0ASEpwe/xZYeQ2vxifOA05xaIEhKpP8P3PzCBp DbHMedPwGrQsRaFdOqLzICoy0Fe/nvWrck0rsNTBjsK/WErbNa+w5XUSqSDmhaJjWRsL 0Vog== 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; bh=utMjoxUDezcWxJk4mk8LSviqN/OVWsX79SL4Aqpy8v0=; b=cadRbfkFF5ONGod39l3nwlSVFlQxoMpzwo30MOxTWciyCNthS8SsFiF7nCFnFT+WzQ +jauYghefmPKj3rFSeCUAkeZdTl/2JNejY0x5H49cJ84t4lHkVLPZwOyMfjgT8fjFe3R lQTzCz0d/vlx1J5T186H+tPs60Fz7RRFJpOGk5oTqQhX6Aou2d/IANo0KbyzTWvu+owk 9VnUIBzfnYcpSM1sk7koPrvyw8nlQyn97SD+wYY9AUi+HBfVXp/lRTP4PdIS9V6xA4RI ycwDnI9+i2nWnxoMO/NquumPDy3tmPYySJcviU7Nv3yFDSDvuyx6zuvDhJJgrBQEKenW DMkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=X8T0kfd9; 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 f60si5165661otf.119.2019.12.13.04.14.11; Fri, 13 Dec 2019 04:14:24 -0800 (PST) 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=X8T0kfd9; 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 S1726890AbfLMMN0 (ORCPT + 99 others); Fri, 13 Dec 2019 07:13:26 -0500 Received: from merlin.infradead.org ([205.233.59.134]:48704 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbfLMMN0 (ORCPT ); Fri, 13 Dec 2019 07:13:26 -0500 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=utMjoxUDezcWxJk4mk8LSviqN/OVWsX79SL4Aqpy8v0=; b=X8T0kfd96r7lIgFHNCTWx+MQq 74YSXj7t43tq/9BwRPWobFD7JFCl2nifRB1qdaQxatTQf+A7gpA2kBFM6fl1nij6hLTkMsqEVMTNS bMEeExUxeGHN5e0SNqlCS71xSn/jxq9IpfksszxKHwDhk8Jc3WDSBz7VPl0Kyx5kYxpAgVJbV2pD4 i6dt0ORFYpWFtz5dKmm9YhxV9k6lvXeW3/DeKxDN28/htxEwhg9fDdiBy6RBvZCttLczuxhEp/l0r uys+XTf6eD0w+npDhCc7zI6CibINH9bdfo6uN0L+CzmSU75hQP/J0X8gTJP9eRCZSvnDJflTj+afs H2a6jqCzw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1ifjoh-0003cX-3A; Fri, 13 Dec 2019 12:13:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id D5A8C304637; Fri, 13 Dec 2019 13:11:43 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 9C5AF2B1886CC; Fri, 13 Dec 2019 13:13:04 +0100 (CET) Date: Fri, 13 Dec 2019 13:13:04 +0100 From: Peter Zijlstra To: Peng Wang Cc: mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] schied/fair: Skip calculating @contrib without load Message-ID: <20191213121304.GC2844@hirez.programming.kicks-ass.net> References: <1575648862-12095-1-git-send-email-rocking@linux.alibaba.com> <1576208740-35609-1-git-send-email-rocking@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1576208740-35609-1-git-send-email-rocking@linux.alibaba.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 13, 2019 at 11:45:40AM +0800, Peng Wang wrote: > diff --git a/kernel/sched/pelt.c b/kernel/sched/pelt.c > index a96db50..4392953 100644 > --- a/kernel/sched/pelt.c > +++ b/kernel/sched/pelt.c > @@ -129,8 +129,9 @@ static u32 __accumulate_pelt_segments(u64 periods, u32 d1, u32 d3) > * Step 2 > */ > delta %= 1024; > - contrib = __accumulate_pelt_segments(periods, > - 1024 - sa->period_contrib, delta); > + if (load) > + contrib = __accumulate_pelt_segments(periods, > + 1024 - sa->period_contrib, delta); > } > sa->period_contrib = delta; I've made that: --- a/kernel/sched/pelt.c +++ b/kernel/sched/pelt.c @@ -129,8 +129,20 @@ accumulate_sum(u64 delta, struct sched_a * Step 2 */ delta %= 1024; - contrib = __accumulate_pelt_segments(periods, - 1024 - sa->period_contrib, delta); + if (load) { + /* + * This relies on the: + * + * if (!load) + * runnable = running = 0; + * + * clause from ___update_load_sum(); this results in + * the below usage of @contrib to dissapear entirely, + * so no point in calculating it. + */ + contrib = __accumulate_pelt_segments(periods, + 1024 - sa->period_contrib, delta); + } } sa->period_contrib = delta; @@ -205,7 +217,9 @@ ___update_load_sum(u64 now, struct sched * This means that weight will be 0 but not running for a sched_entity * but also for a cfs_rq if the latter becomes idle. As an example, * this happens during idle_balance() which calls - * update_blocked_averages() + * update_blocked_averages(). + * + * Also see the comment in accumulate_sum(). */ if (!load) runnable = running = 0;