Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp491803ybk; Wed, 13 May 2020 05:36:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyK3DnJxf+QYkkp64kiUyE/9yAxGTh7h/SkLIreo5lqKdyDfeQuqyLAufNJFFxTqld8aGy X-Received: by 2002:a17:906:ccc7:: with SMTP id ot7mr7118658ejb.62.1589373376521; Wed, 13 May 2020 05:36:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589373376; cv=none; d=google.com; s=arc-20160816; b=LhvTWitifRITOvvCB6GBRneLch4Mq8IRDHW+rDrvTk1u2uzFCsrLzSo7rOuJjVBYQR rIjLQ68UEM2eWiS3BpNQFInUwktcgePRzY9+yvpSQuU1T6AqJwKjVq67p4l0H0uqNImh lnihT8bWrbt+r6+gtRZW4NQFeaxfcqnBLu6lG6ERkP+2NPgfCfU6ahPA4nnUqawvO3yT GByZUtqRD3TMVDExzobiFAD+wlEtXnZH4dKCLL/OvjLc0Y8EOe0m3jSfr7PBx59LzCk7 eHBgpQuegU/4yKCd0fHVQCS63Ds+K6vpkqg8bN5uWNTW1qNY5wHBvnlfYL/AyOj6+uqj RCAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=7Tl+umAXxaFZmg+h3MiCh9BcwGGX463rT+HMe9WI5LA=; b=mtpzUUyLMXCf+xaeyd8GAz/hLvn5GtF/ADs+3rzGhC8l2hYqsFV/tcDfoJ24vbcpOn YdkujqurIz3lPXo1lA0Nq69H3P8DeKjZiDzhE8Le1hh3LEIcXZ1N87IEXqoKao2PUNDK BC/6JGuUqGnbUaZbGWRDN62scczGYHa7tjIuJgV35zaOcIFvLhkWvmna/y+StlCZh3p6 wJs6qjOUFQ7aTYW9Uzkza0dhijvP2eBCerWVpl3r/oTRzUuP7F4C7j5fP05bwyD/PrEE v+bXIAyQoAuJCJy8Hk9l3KAHDyXNL3tnfvxPG+x5cBzXiatyzQzhy6N7UBhSrts96Q4r D9Nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="UHV0u0r/"; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r16si1823054edp.57.2020.05.13.05.35.53; Wed, 13 May 2020 05:36:16 -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=@linaro.org header.s=google header.b="UHV0u0r/"; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732009AbgEMMdn (ORCPT + 99 others); Wed, 13 May 2020 08:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731785AbgEMMdm (ORCPT ); Wed, 13 May 2020 08:33:42 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C061CC061A0C for ; Wed, 13 May 2020 05:33:40 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id y3so20672513wrt.1 for ; Wed, 13 May 2020 05:33:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=7Tl+umAXxaFZmg+h3MiCh9BcwGGX463rT+HMe9WI5LA=; b=UHV0u0r/kHH4lbu6GZhNTqQ9tSIOrkGR3f8OXUawKg3g1tJ6mn3eZTxtmnY+VTqvGQ 7LEovhQsVTCKSfVH+y3dWSaHYramda3shcZVjMARZhTy7KB5rsIH+mmpEDBw+gRvHHYZ EGQ0CxJrSlCAizFO2PuV9jnUSSo4Ko3MwjbRVT2SD+Up8U8jV+vJymRU/2K402yJITV1 O59QELcxpp8pwUnFLSdlwV9ybvYZvq1Uc3xWiyZ+q9OG8ZLV6leBzBCrLKEeXLdmOlV2 jxOkCeMHghOZvHzBKr+zMGYiBJuvUgXXi0GfF4L8TLeuyd93dapz0uxEmnr3MZ4SfeAi Je1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7Tl+umAXxaFZmg+h3MiCh9BcwGGX463rT+HMe9WI5LA=; b=SWLyfJaP+1lZ8hcds85gWxWe+/Za5cfuXDGfouOVFE2w7iRSKlVsh5mQQmG5dJILYH CzCW+wncwsjxm8mrsVvCjC+D+h6XCYWNaNxpr8M9WAQoqmqgxWfm3tY7c+FdVabQwPB0 jyiOXmih4E+6eF/RWS8SOdKTONLeB3WbMXnOv8wYBbvDS70GbL43u/+PEIT7FWl4ODft HG2EPqT3S9arwi3QtT6rDOmDWyGOsez1JZp4vi+DLO7/l/e1tDBcmRICNKahnWl5liUA isTnlMpTFjbSSJ8BmPz56g9kqv5mi5fFExS/LEyOJTSuMvT+n9LkN9uT7dupKsWKR+xG qaTg== X-Gm-Message-State: AGi0PuZY7y8BCSogOY4PEh07tc5wC7yQgD2ScSKnDkXYbJUynEWqyu3a gzRz2nShyrlsYZmHgbCvLcRVPQ== X-Received: by 2002:adf:fe87:: with SMTP id l7mr32538857wrr.360.1589373219397; Wed, 13 May 2020 05:33:39 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:e00f:4685:acf1:ea5e]) by smtp.gmail.com with ESMTPSA id o205sm22065190wmo.32.2020.05.13.05.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 May 2020 05:33:38 -0700 (PDT) From: Vincent Guittot To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, linux-kernel@vger.kernel.org Cc: pauld@redhat.com, ouwen210@hotmail.com, pkondeti@codeaurora.org, Vincent Guittot Subject: [PATCH v2] sched/fair: enqueue_task_fair optimization Date: Wed, 13 May 2020 14:33:35 +0200 Message-Id: <20200513123335.28122-1-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org enqueue_task_fair jumps to enqueue_throttle label when cfs_rq_of(se) is throttled which means that se can't be NULL and we can skip the test. Reviewed-by: Phil Auld Signed-off-by: Vincent Guittot --- v2 changes: - Remove useless if statement kernel/sched/fair.c | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index a0c690d57430..b51b12d63c39 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -5513,28 +5513,29 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) list_add_leaf_cfs_rq(cfs_rq); } -enqueue_throttle: - if (!se) { - add_nr_running(rq, 1); - /* - * Since new tasks are assigned an initial util_avg equal to - * half of the spare capacity of their CPU, tiny tasks have the - * ability to cross the overutilized threshold, which will - * result in the load balancer ruining all the task placement - * done by EAS. As a way to mitigate that effect, do not account - * for the first enqueue operation of new tasks during the - * overutilized flag detection. - * - * A better way of solving this problem would be to wait for - * the PELT signals of tasks to converge before taking them - * into account, but that is not straightforward to implement, - * and the following generally works well enough in practice. - */ - if (flags & ENQUEUE_WAKEUP) - update_overutilized_status(rq); + /* At this point se is NULL and we are at root level*/ + add_nr_running(rq, 1); + + /* + * Since new tasks are assigned an initial util_avg equal to + * half of the spare capacity of their CPU, tiny tasks have the + * ability to cross the overutilized threshold, which will + * result in the load balancer ruining all the task placement + * done by EAS. As a way to mitigate that effect, do not account + * for the first enqueue operation of new tasks during the + * overutilized flag detection. + * + * A better way of solving this problem would be to wait for + * the PELT signals of tasks to converge before taking them + * into account, but that is not straightforward to implement, + * and the following generally works well enough in practice. + */ + if (flags & ENQUEUE_WAKEUP) + update_overutilized_status(rq); } +enqueue_throttle: if (cfs_bandwidth_used()) { /* * When bandwidth control is enabled; the cfs_rq_throttled() -- 2.17.1