mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Cc: Ben Segall <bsegall@google.com>
Subject: [PATCH] sched: refill quota for current period when refilling timer activates
Date: Mon, 14 May 2018 13:58:23 +0300	[thread overview]
Message-ID: <152629550328.178124.4904326637886063654.stgit@buzz> (raw)

Period timer deactivates if task group has no activity during past period,
i.e. if were no throttle and runtime from global pool weren't consumed.
When timer activates back global pool contains unpredictable amount of
expired runtime allocated long ago. In some cases this works fine and
task could use it until next refill. But series short execution slices
could drain all that leftovers because each switch expires local poll.
In this case task group will be throttled until quota refill.

This patch refills quota right at the moment of timer's activation.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 kernel/sched/fair.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 79f574dba096..b8d73ed17ff6 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5165,6 +5165,8 @@ void start_cfs_bandwidth(struct cfs_bandwidth *cfs_b)
 
 	if (!cfs_b->period_active) {
 		cfs_b->period_active = 1;
+		/* refill quota for current period after inactivity */
+		__refill_cfs_bandwidth_runtime(cfs_b);
 		hrtimer_forward_now(&cfs_b->period_timer, cfs_b->period);
 		hrtimer_start_expires(&cfs_b->period_timer, HRTIMER_MODE_ABS_PINNED);
 	}

             reply	other threads:[~2018-05-14 11:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14 10:58 Konstantin Khlebnikov [this message]
2018-05-14 11:05 ` Konstantin Khlebnikov

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=152629550328.178124.4904326637886063654.stgit@buzz \
    --to=khlebnikov@yandex-team.ru \
    --cc=bsegall@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®