Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11166644ybi; Thu, 25 Jul 2019 11:08:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWstW8O12yZAfQPXRu9JEm2+FoTgCubWtYpHjELJYgdEAAE15d57UQ0bBNtDoQm6Njf05J X-Received: by 2002:a17:90a:23a4:: with SMTP id g33mr96676851pje.115.1564078095328; Thu, 25 Jul 2019 11:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564078095; cv=none; d=google.com; s=arc-20160816; b=Jg3jLWENDO50j+2zmvdsbu0bOEJ1LZPeO3LpidQQN1KSQsdHpfRfTK28TqJ5KsAk0B oCd2y23suMwPItflUkwUrYv4h5GX3dOJiAYBbD0Y9VDSTqIw2a1phhG8pMWSgh0r0vxk ttb/jmXr3XW+e2oD8pzvtaSQZN83K1JEvMHZbGirkTyR1r19hmPe5n4u12BGD1IF36sd Gn7M/u6T3ep2DRDXsS8Dh7/KNHBK0qwdMWv/Lv25YERYKfMCYJw1lZf9pGtgRYAVVw9F Rrb/bFsUFaUIXQCbMA4t8U9KF7KHw1NBlNYbvg0STG1oiE1qjqYSVvxv9PH+TKjJAHIl vUDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:mime-version:robot-unsubscribe:robot-id :git-commit-id:subject:to:references:in-reply-to:reply-to:cc :message-id:from:date:dkim-signature:dkim-filter; bh=28hNTJUWySJ7mONJThPH7+Zsj8pU+f/59Q8yun5JHTw=; b=cbZAgmno4IjHQmI3oDvzNWNKHViUgtMhCClr6Fd2r5L45C11mhRc7s5Nlk+pl8dyP6 EqNOE00XfUnljiryRXpmnUVP/ADLms5yIhVjMi8HTL7+ZTwhUKJv4BwkvR1fmPMtcC44 04Hvl8wdsFzVdKnZqs7gT0ZRS3vF8mVHKJREwBmOdXjCHOWhrmdpKzuj2qgS17bjlLVo CPlGP8wuKNZgfjmfJNv+ip+aX6CbUg5woE6VAoluKXwYHBTzj+ygoBDyylRi/RGawWVq so+dusRG22GdawlJUrTfHBtTvcZIWuH4+U8U98SWYWn/qrCn9eXTieQtMlmiMCZSnJ3E w13A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2019071901 header.b=AoSUvOgH; 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=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x32si15807215pld.252.2019.07.25.11.08.00; Thu, 25 Jul 2019 11:08:15 -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=@zytor.com header.s=2019071901 header.b=AoSUvOgH; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390190AbfGYQPc (ORCPT + 99 others); Thu, 25 Jul 2019 12:15:32 -0400 Received: from terminus.zytor.com ([198.137.202.136]:42153 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726640AbfGYQPc (ORCPT ); Thu, 25 Jul 2019 12:15:32 -0400 Received: from terminus.zytor.com (localhost [127.0.0.1]) by terminus.zytor.com (8.15.2/8.15.2) with ESMTPS id x6PGFKEf1075074 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 25 Jul 2019 09:15:20 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 terminus.zytor.com x6PGFKEf1075074 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2019071901; t=1564071321; bh=28hNTJUWySJ7mONJThPH7+Zsj8pU+f/59Q8yun5JHTw=; h=Date:From:Cc:Reply-To:In-Reply-To:References:To:Subject:From; b=AoSUvOgHzIk6Hlb7nZV1FbDEEsvHVURngzenDG8Y3tzmaZwcT/zh/TUw+NyxAen3U UHXBpPA3haRkSmHZQbQY/qRjuI2KFVGRHTsQfUsqk7RDd5fe95C5BHbarcxNzZZRZQ k8HZfHRq/8luOIWKLHXaIDXMY0a8emUunem47EAVKDIXORuCbYMuMp+R14HVqANEeC FzSdvRJ1mDVZrpBqsA6J6p+V1bx0Jt2YG8nThOF+oG4ZHLg4R8QXRiXg6XaeoXq5SH LVWVwsgPfE9AS+/obZfdwGKgXguXmw0+nyr/7wr02ZHGrmFlv4TCJOiCuMaknbyfPB K2f70QdQsb92g== Received: (from tipbot@localhost) by terminus.zytor.com (8.15.2/8.15.2/Submit) id x6PGFKdA1075071; Thu, 25 Jul 2019 09:15:20 -0700 Date: Thu, 25 Jul 2019 09:15:20 -0700 X-Authentication-Warning: terminus.zytor.com: tipbot set sender to tipbot@zytor.com using -f From: tip-bot for Viresh Kumar Message-ID: Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, daniel.lezcano@linaro.org, torvalds@linux-foundation.org, mingo@kernel.org, vincent.guittot@linaro.org, hpa@zytor.com, viresh.kumar@linaro.org Reply-To: torvalds@linux-foundation.org, vincent.guittot@linaro.org, mingo@kernel.org, viresh.kumar@linaro.org, hpa@zytor.com, tglx@linutronix.de, peterz@infradead.org, daniel.lezcano@linaro.org, linux-kernel@vger.kernel.org In-Reply-To: <0d3cdc427fc68808ad5bccc40e86ed0bf9da8bb4.1561523542.git.viresh.kumar@linaro.org> References: <0d3cdc427fc68808ad5bccc40e86ed0bf9da8bb4.1561523542.git.viresh.kumar@linaro.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:sched/core] sched/fair: Start tracking SCHED_IDLE tasks count in cfs_rq Git-Commit-ID: 43e9f7f231e40e4534fc3a735da152911a085c16 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline X-Spam-Status: No, score=-0.3 required=5.0 tests=ALL_TRUSTED,BAYES_00, DATE_IN_FUTURE_96_Q,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on terminus.zytor.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 43e9f7f231e40e4534fc3a735da152911a085c16 Gitweb: https://git.kernel.org/tip/43e9f7f231e40e4534fc3a735da152911a085c16 Author: Viresh Kumar AuthorDate: Wed, 26 Jun 2019 10:36:29 +0530 Committer: Ingo Molnar CommitDate: Thu, 25 Jul 2019 15:51:53 +0200 sched/fair: Start tracking SCHED_IDLE tasks count in cfs_rq Track how many tasks are present with SCHED_IDLE policy in each cfs_rq. This will be used by later commits. Signed-off-by: Viresh Kumar Signed-off-by: Peter Zijlstra (Intel) Cc: Daniel Lezcano Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vincent Guittot Cc: chris.redpath@arm.com Cc: quentin.perret@linaro.org Cc: songliubraving@fb.com Cc: steven.sistare@oracle.com Cc: subhra.mazumdar@oracle.com Cc: tkjos@google.com Link: https://lkml.kernel.org/r/0d3cdc427fc68808ad5bccc40e86ed0bf9da8bb4.1561523542.git.viresh.kumar@linaro.org Signed-off-by: Ingo Molnar --- kernel/sched/fair.c | 14 ++++++++++++-- kernel/sched/sched.h | 3 ++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 9be36ffb5689..9ed5ab53872f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4555,7 +4555,7 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) struct rq *rq = rq_of(cfs_rq); struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; - long task_delta, dequeue = 1; + long task_delta, idle_task_delta, dequeue = 1; bool empty; se = cfs_rq->tg->se[cpu_of(rq_of(cfs_rq))]; @@ -4566,6 +4566,7 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) rcu_read_unlock(); task_delta = cfs_rq->h_nr_running; + idle_task_delta = cfs_rq->idle_h_nr_running; for_each_sched_entity(se) { struct cfs_rq *qcfs_rq = cfs_rq_of(se); /* throttled entity or throttle-on-deactivate */ @@ -4575,6 +4576,7 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) if (dequeue) dequeue_entity(qcfs_rq, se, DEQUEUE_SLEEP); qcfs_rq->h_nr_running -= task_delta; + qcfs_rq->idle_h_nr_running -= idle_task_delta; if (qcfs_rq->load.weight) dequeue = 0; @@ -4614,7 +4616,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; int enqueue = 1; - long task_delta; + long task_delta, idle_task_delta; se = cfs_rq->tg->se[cpu_of(rq)]; @@ -4634,6 +4636,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) return; task_delta = cfs_rq->h_nr_running; + idle_task_delta = cfs_rq->idle_h_nr_running; for_each_sched_entity(se) { if (se->on_rq) enqueue = 0; @@ -4642,6 +4645,7 @@ void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) if (enqueue) enqueue_entity(cfs_rq, se, ENQUEUE_WAKEUP); cfs_rq->h_nr_running += task_delta; + cfs_rq->idle_h_nr_running += idle_task_delta; if (cfs_rq_throttled(cfs_rq)) break; @@ -5255,6 +5259,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) { struct cfs_rq *cfs_rq; struct sched_entity *se = &p->se; + int idle_h_nr_running = task_has_idle_policy(p); /* * The code below (indirectly) updates schedutil which looks at @@ -5287,6 +5292,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) if (cfs_rq_throttled(cfs_rq)) break; cfs_rq->h_nr_running++; + cfs_rq->idle_h_nr_running += idle_h_nr_running; flags = ENQUEUE_WAKEUP; } @@ -5294,6 +5300,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); cfs_rq->h_nr_running++; + cfs_rq->idle_h_nr_running += idle_h_nr_running; if (cfs_rq_throttled(cfs_rq)) break; @@ -5355,6 +5362,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) struct cfs_rq *cfs_rq; struct sched_entity *se = &p->se; int task_sleep = flags & DEQUEUE_SLEEP; + int idle_h_nr_running = task_has_idle_policy(p); for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); @@ -5369,6 +5377,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) if (cfs_rq_throttled(cfs_rq)) break; cfs_rq->h_nr_running--; + cfs_rq->idle_h_nr_running -= idle_h_nr_running; /* Don't dequeue parent if it has other entities besides us */ if (cfs_rq->load.weight) { @@ -5388,6 +5397,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) for_each_sched_entity(se) { cfs_rq = cfs_rq_of(se); cfs_rq->h_nr_running--; + cfs_rq->idle_h_nr_running -= idle_h_nr_running; if (cfs_rq_throttled(cfs_rq)) break; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 802b1f3405f2..aaca0e743776 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -483,7 +483,8 @@ struct cfs_rq { struct load_weight load; unsigned long runnable_weight; unsigned int nr_running; - unsigned int h_nr_running; + unsigned int h_nr_running; /* SCHED_{NORMAL,BATCH,IDLE} */ + unsigned int idle_h_nr_running; /* SCHED_IDLE */ u64 exec_clock; u64 min_vruntime;