Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3430924pxb; Mon, 4 Apr 2022 16:46:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHuQf9U5eRR/kJWsLogTutdYTGrw4rqvcNi+T3jxfMMwMel214MEZZYnLuoSttP593VA4T X-Received: by 2002:a62:1ad3:0:b0:4fa:9adc:7680 with SMTP id a202-20020a621ad3000000b004fa9adc7680mr781145pfa.25.1649116013979; Mon, 04 Apr 2022 16:46:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649116013; cv=none; d=google.com; s=arc-20160816; b=qNwoujVJi1Rk0ZGWZ+sxGOwFYEZ3HQJjq4B2JB1lBjBIjIIqNtbaM+x/TQ16HYygDk ClABX51jmsE+F/UOlrUATjVyPGQx3ePtN8OrkfthTxuhwQjmaKJDk+5ftJta5+zGZCyk 7EnJ6YS+xQd4bV/wXEquUphAwpLsysCT1YReYbs52arBPPSyPxAGggfORQEjFD54MS3w Of3Nz7gV1G7uiQCc/gQC3/3pqDfwXNKmFTPUGxNEyxO6HaKL4549C2lEfCgoUdAPBH8f JLB9pY+Yso5rXobM+w/mnpStcelRHbwO87ORugWHnWbu5VDbFHO8oJQOqoNh96wd58wG Su3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=rj22f0kFZ7NUcXO468exbIwbC8edz8OwX/wtkMZHahM=; b=b0RF0VErutj8D5wtBHqI90ljj31aOZU/Z6t1CzOX7qQtUYkETrIvJ2TeCjIWT5RlPP 3ItvLKNKHkoD9mkx6KSmmKStVpFUhLcf48Yl6hOnhoaI0bWI3uGHZLLUnLbMi1m6+RXp lTp17T0lhjdo6Egmt9bsqZ0Pt8Z8WfVL9zVF1TtK8QfcdBGmMuYRQQkl9MbUaEPwqrSM /JcOXhOEZzzALeQ/tymeQwsPHruvjKaIITFY2rSS1iZ+aAblKdS7hgyHjpNUPSO3CE0n 7tKFnSwraPkx2ihVd+QszbmFQbeuZShO8y8IIZLb7eINov96bl0Ajz191n7Zly3OuzKL AbCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=YGfztAsT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i75-20020a636d4e000000b0039895942fb1si11898721pgc.228.2022.04.04.16.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:46:53 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=YGfztAsT; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A1A1E13DDC; Mon, 4 Apr 2022 16:34:02 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359434AbiDCQfa (ORCPT + 99 others); Sun, 3 Apr 2022 12:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349759AbiDCQf2 (ORCPT ); Sun, 3 Apr 2022 12:35:28 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58FDA11140 for ; Sun, 3 Apr 2022 09:33:31 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1649003607; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=rj22f0kFZ7NUcXO468exbIwbC8edz8OwX/wtkMZHahM=; b=YGfztAsTroxPMmfd7BhFy+VreKT9Cj3uBXpixs7sK5SIUG2AkJWzDMHF5LgxD/4x+R8bHf rPUdjv3duUMwAOU2DH7L7rE01gyF5nHWx3f63zaMeaHpiB6eN8sglGc6MUE/IAVxekWTb4 QX/xbsBQpm7zcAGD7hWyBk6OxOEdVTk= From: Tao Zhou To: linux-kernel@vger.kernel.org, tao.zhou@linux.dev Subject: [PATCH] sched/fair: Minor making update_blocked_load_status() be able to set has_blocked_load to 1 Date: Mon, 4 Apr 2022 00:33:38 +0800 Message-Id: <20220403163338.6341-1-tao.zhou@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I realize that newidle_balance() can not set rq->has_blocked_load to 1 when it has block load. When no task pulled then nohz_newidle_balance() will set flag NOHZ_NEWILB_KICK to trigger ILB. In do_idle(), nohz_run_idle_balance() will call _nohz_idle_balance() to update status using update_nohz_stats() to make sure there has blocked load. If it is not set in newidle_balance(), update_nohz_stats() will exit early and do not do update_blocked_averages()(time spent from newidle_balance() to update_nohz_stats will not be used to update load avg). There has chance to call cpuidle_idle_call() to set has_blocked_load to 1 and can also update later but if cpuidle_idle_call() is not called, the lost update in nohz_run_idle_balance() will not be permitted that me not thoroughly think. I know this is likely a invalid commit log. --- kernel/sched/fair.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 5146163bfabb..fc8765792a77 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8091,7 +8091,9 @@ static inline void update_blocked_load_tick(struct rq *rq) static inline void update_blocked_load_status(struct rq *rq, bool has_blocked) { - if (!has_blocked) + if (has_blocked) + rq->has_blocked_load = 1; + else rq->has_blocked_load = 0; } #else @@ -10597,7 +10599,7 @@ void nohz_balance_enter_idle(int cpu) * If a clear happens, it will have evaluated last additions because * rq->lock is held during the check and the clear */ - rq->has_blocked_load = 1; + update_blocked_load_status(rq, 1); /* * The tick is still stopped but load could have been added in the -- 2.35.1