Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp114378pxa; Mon, 10 Aug 2020 20:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzH0UzODs2FkR1OXIAhLJcdTkqcxgxzok4yTcHkD384O7cs0Nabs64dC+KREU6wKM5yDo9+ X-Received: by 2002:aa7:dbd9:: with SMTP id v25mr24796938edt.137.1597117322790; Mon, 10 Aug 2020 20:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597117322; cv=none; d=google.com; s=arc-20160816; b=ibuDlpBdgSvlpOHT2kYZnvZ8/K9+U9w+XF/WEKxoHVWrnAY1n2AJfUevY7LKwwxzM8 Lhy1EkfsqSCmquBgCQfQQXivytaGVbsQCn5CsWvEr80Gk1yXQOvbmLEqyrpcfe7e9NO1 dceUdB+4V13OPRwZPg9RbbvoqUhtjDU01SC7EHkz9w3OlGRZBwykEW8sIJg+WcegxpOI u86J//Gb98oAnZRC88IkHlvK3kS8Kcp02cjOAf+8xRrP2bO2365XQ443hUcC8lT390MB Q7mGCfhI0/a7ovSmSWqnZ9+3raBQZFC5eoi00hJWiKEZChBbuwPBiGmydPLdZ5Kncn6N SEug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3PrVDtMQf169Kljc/JK35t0tZa58l2V+hE8WfvQXbUU=; b=PqVEnZ8BJfW2UI3XdyzA2Nw+Ae2n+e7qeqbwjGeHFHH1Vf+pfR7qvLzb31NwC7H8YE PeuWyAEazsDeJuoFAq+t64/wgQpfH6USA4ppZU9R0AZVvNVqm8SPbpY0omPx+IxrzLdA l6In7qsFBFsG+ZcojoWYVL57FXwBzoudbW1EPKIzyi9xXA1nTsRBCm2T7wkM4w/HxGGM drpexHnjRH7qXP5sYO0wbnaWDhP19q/RKcr9xx9IVWz8MziZaPM2QGbiUN8gTsJ30TiX Z9fcMFcTxVhjtKw/BqgUJP6W1xp6hk8cEyADrAf8ZpfN/Uj17PogFK2VNXwjrdcPx6Af /TQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WqRD8Xzu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si12543776ejr.110.2020.08.10.20.41.39; Mon, 10 Aug 2020 20:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=WqRD8Xzu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728210AbgHKDkA (ORCPT + 99 others); Mon, 10 Aug 2020 23:40:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727819AbgHKDj7 (ORCPT ); Mon, 10 Aug 2020 23:39:59 -0400 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF23CC06174A for ; Mon, 10 Aug 2020 20:39:59 -0700 (PDT) Received: by mail-pl1-x643.google.com with SMTP id x15so1404646plr.11 for ; Mon, 10 Aug 2020 20:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=3PrVDtMQf169Kljc/JK35t0tZa58l2V+hE8WfvQXbUU=; b=WqRD8XzuFmI7FgOc+faxexmXkfNuYXIVbVbOKqCTiaiNPzlrpIsFQr73VqfAEE91Cx 89CTb59eS3Jui5BRjC81pjCpdrCoshMc7PbhmzV2EnnSHcwphwvdolhKvTSTwGtszWUW PlQtwx+tWHnaWqUt9jMFIfABgfkqkBXSoZyelJHSRP1iYz8EXaI+uZipa/7NIbPcq3Va kp430q28wRFsNIC8c9z0kIxQJHjQHvaMCS4pGPFw3zSCfani4NbTOpE0kkGjkKPyr0Wi oJT6SiiTVED2QsYwdGnUTvmgRDAJ82yO9t7ST+NaZnhZF1aGab+0XquTxqt05DwHoY1D FGVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=3PrVDtMQf169Kljc/JK35t0tZa58l2V+hE8WfvQXbUU=; b=ukfJPOw35RV8QFPOUmnwb30hecPk9Ff4brPZEU+UUnZSBSbsTxWrniPjBJ6XtnIteW rxYlOWsfnExBamqZYX2Ufac7wMbbeqxyFETzCkh9wl7S3DzR7e/lb2LP4fd0VU8YTdc7 +Jnceuuafz0p7QUbZo+vV/HyqKKl+1yDkRGlyrhMCJdYhokkjQQRdT49k5rLdQI1z2lm u2OZu5wRBei3Qm2LONersfr+8oo9L26xUfQCumvSrQPRQV1LFluyrJXCfOlYmXIsESFi JYwfHyzYki1vsMwF3DUhHHxf4BG2zXZEWORkWFfA0d+XXPfeuHCZ21c9TdKU7FQWwzIL mUUg== X-Gm-Message-State: AOAM533W4BewPmcoTtD/jSHnQRbVwjO42eTYQTsBylAu+JhAdh2G/ztI wjAntAdG5+3vsqU/ZqRPK/YavXkd X-Received: by 2002:a17:902:8a88:: with SMTP id p8mr26854678plo.184.1597117199088; Mon, 10 Aug 2020 20:39:59 -0700 (PDT) Received: from [0.0.0.0] ([198.13.39.231]) by smtp.gmail.com with ESMTPSA id v10sm7493997pff.192.2020.08.10.20.39.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Aug 2020 20:39:58 -0700 (PDT) Subject: Re: [PATCH] sched/fair: Remove the duplicate check from group_has_capacity() To: Valentin Schneider Cc: mingo@redhat.com, peterz@infradead.org, 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 References: <20200810010009.92758-1-arch0.zheng@gmail.com> From: Qi Zheng Message-ID: <9425382c-2a42-57ca-512d-c93c589dc701@gmail.com> Date: Tue, 11 Aug 2020 11:39:52 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/8/11 上午2:33, Valentin Schneider wrote: > > On 10/08/20 02:00, Qi Zheng wrote: >> 1. The group_has_capacity() function is only called in >> group_classify(). >> 2. The following inequality has already been checked in >> group_is_overloaded() which was also called in >> group_classify(). >> >> (sgs->group_capacity * imbalance_pct) < >> (sgs->group_runnable * 100) >> > > Consider group_is_overloaded() returns false because of the first > condition: > > if (sgs->sum_nr_running <= sgs->group_weight) > return false; > > then group_has_capacity() would be the first place where the group_runnable > vs group_capacity comparison would be done. > > Now in that specific case we'll actually only check it if > > sgs->sum_nr_running == sgs->group_weight > > and the only case where the runnable vs capacity check can fail here is if > there's significant capacity pressure going on. TBH this capacity pressure > could be happening even when there are fewer tasks than CPUs, so I'm not > sure how intentional that corner case is. Maybe some cpus in sg->cpumask are no longer active at the == case, which causes the significant capacity pressure? > > > For the > > sgs->sum_nr_running > sgs->group_weight > > case I agree with your patch, there just is that oddity at the == case. > >> So just remove the duplicate check from group_has_capacity(). >> >> Signed-off-by: Qi Zheng >> --- >> kernel/sched/fair.c | 4 ---- >> 1 file changed, 4 deletions(-) >> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 2ba8f230feb9..a41903fb327a 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -8234,10 +8234,6 @@ group_has_capacity(unsigned int imbalance_pct, struct sg_lb_stats *sgs) >> if (sgs->sum_nr_running < sgs->group_weight) >> return true; >> >> - if ((sgs->group_capacity * imbalance_pct) < >> - (sgs->group_runnable * 100)) >> - return false; >> - >> if ((sgs->group_capacity * 100) > >> (sgs->group_util * imbalance_pct)) >> return true;