Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp47416rwn; Wed, 14 Sep 2022 15:45:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4mIffs38aglRu+PS7hEARr9BOIQESVaX0JQp2XFwnKhHYMSYkepm1x7zPteUTWQR0MFIAP X-Received: by 2002:a17:902:ecc2:b0:178:1313:afc3 with SMTP id a2-20020a170902ecc200b001781313afc3mr1211134plh.139.1663195522245; Wed, 14 Sep 2022 15:45:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663195522; cv=none; d=google.com; s=arc-20160816; b=FloYSbkapvg/0GzAoLy4ODVuowVRsAK8C2iC+5PAH81FiWMEl21ZRrT5s5K7jAFg7o UsN1UC6JMPdDwTQ5vsp4QZRtTGvyWtsLEiePc5IBUkqFf9dpi0i1fHZqQYiimplfmMOA 9EgtVBSIBCZ7dkOXektOxtx3oWGabvN4wetKtalqZR7mdXC6rXuQngxDXCm1xmWCNgwk ymoyYjdpq5qsO6nUE7x3waHSPUukH51lsNIbZdmtlRtU+sg+peKZg4psKpkZcFLZKOWk 0R9glRb2+Cm8PKeWbaQ19YKaiVLlXXGC8eINRbtl4REISLdwN3KlfZKY8Fmz0DBmePPa lScA== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=SIBhrWELIom3bdcCe13NiQrXAgS7pdoKlNHiAmELUMU=; b=ai6VfoN/C4+SHVmNENDIFbqLZmlCmIXKeR4MYnsXNeAoPTKa3hWZqJLby6UJRjAElM YrMldROKGBmRSh26yrzd8vkU5uYGzqFD/hPuUmgss24fmwW5m90SYvMeQ/nPkiPkF/wX 4RDEz02IrNX1Q0sBmB2PvpVljz0nwY8tSlYlUwr/86s174ZYVgGz2jtyjIrTGAjqY0wf soQDIF1zWkjivHEX/+y+8bgrWieBOhbyFvqyN5Ic4z5osP7PSZxvbhypy7EyFMxHqoGv pRaM/A9uUVhUFyaKbzY3L+vilj4zAQxU+fbaRXDo1cmuKcXEUO1QF0/QJsbGQ18shciO MUgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PRRhHJxv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n126-20020a632784000000b0042890f36264si17243343pgn.34.2022.09.14.15.45.11; Wed, 14 Sep 2022 15:45:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PRRhHJxv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbiINWhj (ORCPT + 99 others); Wed, 14 Sep 2022 18:37:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229650AbiINWhh (ORCPT ); Wed, 14 Sep 2022 18:37:37 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BF967F256 for ; Wed, 14 Sep 2022 15:37:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663195056; x=1694731056; h=message-id:subject:from:to:cc:date:in-reply-to: references:mime-version:content-transfer-encoding; bh=YFXaXof79mww4Loh9N42gVv+6OfztCBM3O7BFT4aSe8=; b=PRRhHJxvj0sOX6ZAwrr8xTNzI2FZSlefC6n16ubrUg9sCPFMAyGsYZBi q42bSidnoIUdrwQfdkxNwFg7mn//a+a4rxU2b+Lv+v9cjuZ2VHguV7/Eq vybO2M3Bbhvat4+iHim44q66OhSZdfsqCxBB5Sls/FXjliRP97VTxr16y vPDDbEchkCwb2wUzSnCsM/PmkVfU9/0/OKDuDvuA611vZ9kqG8naoarci SelSM6YKnUBEGCX9mFlI0eOAcmyuYZcsYA1RPwXSxPUzBKuokmoh1mVv4 xWZUQVR+DZZ1wkWB9SrvMbK+6oJJpICahWfc4D93dy+JWfSKEyaJQakWf Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10470"; a="299916860" X-IronPort-AV: E=Sophos;i="5.93,316,1654585200"; d="scan'208";a="299916860" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 15:37:34 -0700 X-IronPort-AV: E=Sophos;i="5.93,316,1654585200"; d="scan'208";a="594569094" Received: from schen9-mobl.amr.corp.intel.com ([10.209.26.213]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Sep 2022 15:37:34 -0700 Message-ID: <3f4f98cf61e4b08dcc85e3ac308a80f0b9cf814e.camel@linux.intel.com> Subject: Re: [PATCH v5 3/5] sched/fair: Skip core update if task pending From: Tim Chen To: Abel Wu , Peter Zijlstra , Mel Gorman , Vincent Guittot Cc: Josh Don , Chen Yu , K Prateek Nayak , "Gautham R . Shenoy" , linux-kernel@vger.kernel.org Date: Wed, 14 Sep 2022 15:37:34 -0700 In-Reply-To: <20220909055304.25171-4-wuyun.abel@bytedance.com> References: <20220909055304.25171-1-wuyun.abel@bytedance.com> <20220909055304.25171-4-wuyun.abel@bytedance.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Fri, 2022-09-09 at 13:53 +0800, Abel Wu wrote: > The function __update_idle_core() considers this cpu is idle so > only checks its siblings to decide whether the resident core is > idle or not and update has_idle_cores hint if necessary. But the > problem is that this cpu might not be idle at that moment any > more, resulting in the hint being misleading. > > It's not proper to make this check everywhere in the idle path, > but checking just before core updating can make the has_idle_core > hint more reliable with negligible cost. > Reviewed-by: Tim Chen > Signed-off-by: Abel Wu > --- > kernel/sched/fair.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 7abe188a1533..fad289530e07 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -6294,6 +6294,9 @@ void __update_idle_core(struct rq *rq) > int core = cpu_of(rq); > int cpu; > > + if (rq->ttwu_pending) > + return; > + > rcu_read_lock(); > if (test_idle_cores(core, true)) > goto unlock;