Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2022359pxa; Mon, 3 Aug 2020 05:37:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqLQU2wCUSLi9ALVRF1KH5Si7jJrot4Y3CwFKO5/2l1qZIN5gGBQ4h5rnxCorw786gRKzH X-Received: by 2002:a17:906:16c8:: with SMTP id t8mr16164999ejd.484.1596458237929; Mon, 03 Aug 2020 05:37:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596458237; cv=none; d=google.com; s=arc-20160816; b=LSo0pVZeXHDWesMMM+dmOETdIrPSEwE7RaKqJUm4gh47MGRDXIWX+/H/jcRKVKiXoA Su0UAiFbhQJVQ//Xc4wQ9UB1pybS5M84qgI1oVAiF+dBtFi4hcHP+N5ST59EXyIom6X2 59/DgFF6vXPEnUHEIYyfMzMMk09mhlVsiCw336OlQ3OluptMC+FHs4Dr1U0soxDRojUk F8IJ3IARv9hHTuwIeTrR11OaI6jI7RcC51AhcQKfCbZAi5UWZ0p+iasVzaMOPxlz/Ccl uOG+A99Mecw6kfOWTRa8X4s7hSfUsLI14WuALcNMN/i4fwhcPieXKCqjqht5/OWAch2T F5Mg== 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=uM2vZnd6apiHVlprtfwpHKfrja9VsUva5BQDdDFeOqI=; b=rXsZYcNcgYTNtp+NEIuUpxbdrKz2OAXWvbt6Lg7rZI0RuBo1gh/0cHkxe+dFOoq7jm Mqr0bCq/dgB1pYn0+Yiczk+4k9/eNT51Cd8cwI9omQRyOR6kUCGcnS1qRhr4C4dfQYnr vrQvMBFazVr1lxy7yG1oZW5KoMRoFr6FgEkaytuxxOsOITvxCQV2F1hW9abr88Z2RLlG H8wbK0MsqG4tmONoBbeINn1k3e56LWeOGG681wc/2Xznd1QoMDerExNPCCvUCqH5nU/3 0CrhFRbPgPG5oOAqeRwiaseNS/WoqOngH5wIo8DcD70vjdtKINp8yCUP3jkSHp87dfmx 7rxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GZA0wsa4; 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 bd28si3705823edb.460.2020.08.03.05.36.55; Mon, 03 Aug 2020 05:37:17 -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=GZA0wsa4; 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 S1729161AbgHCMeQ (ORCPT + 99 others); Mon, 3 Aug 2020 08:34:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729518AbgHCMeC (ORCPT ); Mon, 3 Aug 2020 08:34:02 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE83BC06174A for ; Mon, 3 Aug 2020 05:34:02 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id y206so7739190pfb.10 for ; Mon, 03 Aug 2020 05:34:02 -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=uM2vZnd6apiHVlprtfwpHKfrja9VsUva5BQDdDFeOqI=; b=GZA0wsa4JHDCBaPz1RKHDehOq/1VUdU66+kj/avxY9pSBZ6SwPyRxoTRf5xwNIZIap Ry3e6JKGWp9kAAQF5HcIef+9j0cmFJ06CDwK2r/m0IsFyh7f2ouyt+pN7gdh+y6SH0xo Ko0Vr7zZPTLwXo51JIYczfh6Oy22JldW2lce4JGo2BKa10FR6HcoQ8o/r/rFQ5MJI8qV NaK+vvZ2Dxdo+fEHfONbFc0jAppOuNd4/7toRnGO17uUxUEtvunzAM8N/NvGAZtfO13/ kY5EbJIF4hu0u2C9CDsgMd5p4ScqYIdwaplaRue3snb9wtpUtoUiBYljOtaPHQ2smzDQ WQaA== 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=uM2vZnd6apiHVlprtfwpHKfrja9VsUva5BQDdDFeOqI=; b=YDc3eciZYB9voWg78JnSmM2l6aO5Ikxwe/w2NRvUjYNMxESJrA2Q6PFBRhEZO1j1Gl 8BsCjygkSF4Kc1VhbI1wINdvRCyyAo3JrcHRfK9Przw5ufZIBNgO1Agrx6pIkc/hTggu 60LkDrj6yVq9Akb+JlOoTjbERmHyq3rnVdm2KRTfTNjnNmHT8nYO2tRXAiUTZoiheea9 T1Eh7vVPQ/auc6UAQnZAaHr0Cp3YdNVnZIvzCjpHiiuBFV36brOZurMk3zi136Iyu1Hv hddSd9AYZOd1B5GbbL+89v6cxlPvsXTpY68r3fcaiqLwX6LeQfnpPpXiB42Lud2fm3Et 2mdQ== X-Gm-Message-State: AOAM530Uh/3YKDjxumDDS7oEMMOI6RwjEr1cJ3JdnoOgiKtto8egzN3D BbQ1qBW74h22CxemAJov+zbfBhyx X-Received: by 2002:aa7:94b5:: with SMTP id a21mr15523274pfl.237.1596458042235; Mon, 03 Aug 2020 05:34:02 -0700 (PDT) Received: from [0.0.0.0] ([101.32.42.91]) by smtp.gmail.com with ESMTPSA id r202sm9649046pfc.127.2020.08.03.05.33.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Aug 2020 05:34:01 -0700 (PDT) Subject: Re: [PATCH] sched/fair: Fix the logic about active_balance in load_balance() To: Dietmar Eggemann , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de Cc: linux-kernel@vger.kernel.org References: <20200802045141.130533-1-arch0.zheng@gmail.com> From: Qi Zheng Message-ID: <9b584a64-b419-e7ea-249e-6fed9db804c0@gmail.com> Date: Mon, 3 Aug 2020 20:33:58 +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 Hi Dietmar, I understand, thank you for your review and very detailed explanation. Yours, Qi Zheng On 2020/8/3 下午3:36, Dietmar Eggemann wrote: > On 02/08/2020 06:51, Qi Zheng wrote: >> I think the unbalance scenario here should be that we need to >> do active balance but it is not actually done. So fix it. >> >> Signed-off-by: Qi Zheng >> --- >> kernel/sched/fair.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 2ba8f230feb9..6d8c53718b67 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -9710,7 +9710,7 @@ static int load_balance(int this_cpu, struct rq *this_rq, >> } else >> sd->nr_balance_failed = 0; >> >> - if (likely(!active_balance) || voluntary_active_balance(&env)) { >> + if (likely(!active_balance) && voluntary_active_balance(&env)) { >> /* We were unbalanced, so reset the balancing interval */ >> sd->balance_interval = sd->min_interval; >> } else { >> > > Active balance is potentially already been done when we reach this code. > > See 'if (need_active_balance(&env))' and 'if (!busiest->active_balance)' > further up. > > Here we only reset sd->balance_interval in case: > (A) the last load balance wasn't an active one > (B) the reason for the active load balance was: > (1) asym packing > (2) capacity of src_cpu is reduced compared to the one of dst_cpu > (3) misfit handling > > (B) is done to not unnecessarily increase of balance interval, see > commit 46a745d90585 ("sched/fair: Fix unnecessary increase of balance > interval"). >