Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp2338661ima; Mon, 22 Oct 2018 08:11:24 -0700 (PDT) X-Google-Smtp-Source: ACcGV60OWxs0NmGEJOf5ZW8AVKsNt09iBDE1A+fQFlnEcO0twlK0filxsgKER2VtRf84L9zAZwTm X-Received: by 2002:a63:bd41:: with SMTP id d1-v6mr41145853pgp.367.1540221084311; Mon, 22 Oct 2018 08:11:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540221084; cv=none; d=google.com; s=arc-20160816; b=uslRn79CJqiPwQJZLZfUgM8VXW3nwL21RjahXk3KNi04A/lYKdKJr3BuZ2Y2RnTbkt bbQSazsDrY7kmZQHfuvM08/JE/kf9b0Io2jYMG6Y9Efv3XXmJuhVahXcpYlaPlOzRSPH TgMK2d70SNMnoU8vmzlzXBT85/aFtGUO7o9C2kGGWiS8+yPlFcRAZ/w5p/WnJK07sPfX 9uniIkiCxb+qwtQ6IB9EDCcs3dEStH5nomznA6HwlLr325ZRE1AVvjJ/KWKNhmLXVwOB iWpGf3HPxVfIPu7WZGaA0zibMexsLhMuivkJm1JgQeojfhfI1t8H+MEGJKlTOXODLERA DejQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=da7PUOoMepjpEtnTf06GesnbDow1qEny5EWxxBlZ/sU=; b=uGF6V3EnMG8Qlq6xjOWlSIwh8oJfYI2UxGdUeFJMVa8e4fnpxhrYyj2skY013j6UqA nqGIswCGumCl7bePA1yIip9rJzt/qMrPL0/86iB5lkPmskcPA24GrI8o/wQGAtOhi4S9 nrwzoVwuH3oDNN7q3ID2EGjqkYR896k1XuSssngJ35ihYCeoMbu4c1wzrW7kl2L2AZlC AutzdW+o54fwDIhAMlDzF8y1JoJiTrQotZ1g39nrUJ2vLKLOaKEsDy/gE7/988+gMR8x mjdmXCbQB9TKz4XpgTJmM2H7kPbLn6W9w9VTd6AXQ+/K8Hw1XZH7RKzfJSku0CdXSRZR +3Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="Gi/Ke1rs"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a7-v6si37475726pll.38.2018.10.22.08.10.54; Mon, 22 Oct 2018 08:11:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b="Gi/Ke1rs"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728564AbeJVX2n (ORCPT + 99 others); Mon, 22 Oct 2018 19:28:43 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:52362 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727763AbeJVX2m (ORCPT ); Mon, 22 Oct 2018 19:28:42 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w9MF48sN103992; Mon, 22 Oct 2018 15:09:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=da7PUOoMepjpEtnTf06GesnbDow1qEny5EWxxBlZ/sU=; b=Gi/Ke1rsbpl0cwxMCCS6qqC1Mb5CIaqwIOBhbJXlgCZ7kkyGQIDtLH9GBn8vshIJtItc wy80/BdM64NZmBXcjIZXXmZN6Z6d8xefnetulh44ZjYodw/+6z0st+3aCbUcs/1IVwvn MVtBSikvJQ/F4mwp92Vn2vIMAE6JKyB1akgXnNBgYgYIs8vvMevOyThSYe+uS2kmo2b6 XwafB/xoP5IvhAXBHBjCyjevV9E7vcNwhBoRjq7boQtvJ29lMzTHL/2IZscCawhVRiuv 1qdgC0xdZfK2LviSEaX2w094xyRLwKj2Yp2RS+05Mc/YbEIJ+tlPMFvIFA6SqABpOhhP WQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2120.oracle.com with ESMTP id 2n7w0qf4t2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Oct 2018 15:09:10 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w9MF99g6009010 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 22 Oct 2018 15:09:09 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w9MF99Bx020743; Mon, 22 Oct 2018 15:09:09 GMT Received: from ca-dev63.us.oracle.com (/10.211.8.221) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 22 Oct 2018 08:09:08 -0700 From: Steve Sistare To: mingo@redhat.com, peterz@infradead.org Cc: subhra.mazumdar@oracle.com, dhaval.giani@oracle.com, rohit.k.jain@oracle.com, daniel.m.jordan@oracle.com, pavel.tatashin@microsoft.com, matt@codeblueprint.co.uk, umgwanakikbuti@gmail.com, riel@redhat.com, jbacik@fb.com, juri.lelli@redhat.com, steven.sistare@oracle.com, linux-kernel@vger.kernel.org Subject: [PATCH 05/10] sched/fair: Hoist idle_stamp up from idle_balance Date: Mon, 22 Oct 2018 07:59:36 -0700 Message-Id: <1540220381-424433-6-git-send-email-steven.sistare@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1540220381-424433-1-git-send-email-steven.sistare@oracle.com> References: <1540220381-424433-1-git-send-email-steven.sistare@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9053 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810220129 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the update of idle_stamp from idle_balance to the call site in pick_next_task_fair, to prepare for a future patch that adds work to pick_next_task_fair which must be included in the idle_stamp interval. No functional change. Signed-off-by: Steve Sistare --- kernel/sched/fair.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index c623338..9f31045 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -3724,6 +3724,8 @@ static inline bool within_margin(int value, int margin) WRITE_ONCE(p->se.avg.util_est, ue); } +#define IF_SMP(statement) statement + static void overload_clear(struct rq *rq) { struct sparsemask *overload_cpus; @@ -3769,6 +3771,8 @@ static inline int idle_balance(struct rq *rq, struct rq_flags *rf) return 0; } +#define IF_SMP(statement) /* empty */ + static inline void overload_clear(struct rq *rq) {} static inline void overload_set(struct rq *rq) {} @@ -6740,8 +6744,19 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_ return p; idle: + /* + * We must set idle_stamp _before_ calling idle_balance(), such that we + * measure the duration of idle_balance() as idle time. + */ + IF_SMP(rq->idle_stamp = rq_clock(rq);) + new_tasks = idle_balance(rq, rf); + if (new_tasks) + IF_SMP(rq->idle_stamp = 0;) + + schedstat_end_time(rq->find_time, time); + /* * Because idle_balance() releases (and re-acquires) rq->lock, it is * possible for any higher priority task to appear. In that case we @@ -9504,12 +9519,6 @@ static int idle_balance(struct rq *this_rq, struct rq_flags *rf) u64 curr_cost = 0; /* - * We must set idle_stamp _before_ calling idle_balance(), such that we - * measure the duration of idle_balance() as idle time. - */ - this_rq->idle_stamp = rq_clock(this_rq); - - /* * Do not pull tasks towards !active CPUs... */ if (!cpu_active(this_cpu)) @@ -9600,9 +9609,6 @@ static int idle_balance(struct rq *this_rq, struct rq_flags *rf) if (this_rq->nr_running != this_rq->cfs.h_nr_running) pulled_task = -1; - if (pulled_task) - this_rq->idle_stamp = 0; - rq_repin_lock(this_rq, rf); return pulled_task; -- 1.8.3.1