All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Josh Don" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Josh Don <joshdon@google.com>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Jiang Biao <benbjiang@tencent.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: sched/core] sched: adjust sleeper credit for SCHED_IDLE entities
Date: Tue, 05 Oct 2021 14:12:12 -0000	[thread overview]
Message-ID: <163344313292.25758.13469550980550076038.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210820010403.946838-5-joshdon@google.com>

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     2cae3948edd488ebdef4deaf1d1043f92f47e665
Gitweb:        https://git.kernel.org/tip/2cae3948edd488ebdef4deaf1d1043f92f47e665
Author:        Josh Don <joshdon@google.com>
AuthorDate:    Thu, 19 Aug 2021 18:04:03 -07:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Tue, 05 Oct 2021 15:51:39 +02:00

sched: adjust sleeper credit for SCHED_IDLE entities

Give reduced sleeper credit to SCHED_IDLE entities. As a result, woken
SCHED_IDLE entities will take longer to preempt normal entities.

The benefit of this change is to make it less likely that a newly woken
SCHED_IDLE entity will preempt a short-running normal entity before it
blocks.

We still give a small sleeper credit to SCHED_IDLE entities, so that
idle<->idle competition retains some fairness.

Example: With HZ=1000, spawned four threads affined to one cpu, one of
which was set to SCHED_IDLE. Without this patch, wakeup latency for the
SCHED_IDLE thread was ~1-2ms, with the patch the wakeup latency was
~5ms.

Signed-off-by: Josh Don <joshdon@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Reviewed-by: Jiang Biao <benbjiang@tencent.com>
Link: https://lore.kernel.org/r/20210820010403.946838-5-joshdon@google.com
---
 kernel/sched/fair.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d835061..5457c80 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4230,7 +4230,12 @@ place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial)
 
 	/* sleeps up to a single latency don't count. */
 	if (!initial) {
-		unsigned long thresh = sysctl_sched_latency;
+		unsigned long thresh;
+
+		if (se_is_idle(se))
+			thresh = sysctl_sched_min_granularity;
+		else
+			thresh = sysctl_sched_latency;
 
 		/*
 		 * Halve their sleep time's effect, to allow

  parent reply	other threads:[~2021-10-05 14:13 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20  1:03 [PATCH v3 0/4] SCHED_IDLE extensions Josh Don
2021-08-20  1:04 ` [PATCH v3 2/4] sched: account number of SCHED_IDLE entities on each cfs_rq Josh Don
2021-08-24  7:57   ` Vincent Guittot
2021-09-09 11:18   ` [tip: sched/core] sched: Account " tip-bot2 for Josh Don
2021-10-05 14:12   ` tip-bot2 for Josh Don
2021-08-20  1:04 ` [PATCH v3 3/4] sched: reduce sched slice for SCHED_IDLE entities Josh Don
2021-08-23 10:08   ` Vincent Guittot
2021-08-23 17:40     ` Josh Don
2021-08-24  7:56       ` Vincent Guittot
2021-08-24 10:24   ` Jiang Biao
2021-08-24 17:04     ` Josh Don
2021-08-25  2:43       ` Jiang Biao
2021-09-09 11:18   ` [tip: sched/core] " tip-bot2 for Josh Don
2021-10-05 14:12   ` tip-bot2 for Josh Don
2021-08-20  1:04 ` [PATCH v3 4/4] sched: adjust sleeper credit " Josh Don
2021-08-23 10:09   ` Vincent Guittot
2021-08-24  8:16   ` Jiang Biao
2021-08-24 17:12     ` Josh Don
2021-09-09 11:18   ` [tip: sched/core] " tip-bot2 for Josh Don
2021-10-05 14:12   ` tip-bot2 for Josh Don [this message]
2021-09-06 12:47 ` [PATCH v3 1/4] sched: cgroup SCHED_IDLE support alexs
2021-09-06 12:47   ` alexs
2021-08-20  8:39     ` Tao Zhou
2021-08-23 17:29       ` Josh Don
2021-08-23 22:45         ` Tao Zhou
2021-09-02  1:22     ` Daniel Jordan
2021-09-03  1:21       ` Josh Don
2021-09-08 20:38         ` Daniel Jordan
2021-09-08 18:36     ` Josh Don

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=163344313292.25758.13469550980550076038.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=benbjiang@tencent.com \
    --cc=joshdon@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=vincent.guittot@linaro.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.