All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kirill Tkhai <kirill.tkhai@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Oleg Nesterov <oleg@redhat.com>, Kirill Tkhai <tkhai@yandex.ru>
Subject: [PATCH]sched: stop hrtick timer if running task is switching from fair scheduling class to another
Date: Fri, 23 Dec 2011 00:01:00 +0400	[thread overview]
Message-ID: <1324584060.4222.15.camel@hp> (raw)

[PATCH]sched: stop hrtick timer if running task is switching from fair
scheduling class to another

We have to stop hrtick timer to avoid excess interrupt. Not-fair tasks
are not interested in fair's hrtick. RT class uses its own fixed
timeslice (in case of RR), which doesn't depend on current value of hrtick
timer.

Kernel tree/version/git: next-20111216

This is resending, nobody answered me in previous time.

Signed-off-by: Kirill Tkhai <kirill.tkhai@gmail.com>
---

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 211cdc5..7733ba7 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -368,7 +368,7 @@ static struct rq *this_rq_lock(void)
  * rq->lock.
  */
 
-static void hrtick_clear(struct rq *rq)
+void hrtick_clear(struct rq *rq)
 {
 	if (hrtimer_active(&rq->hrtick_timer))
 		hrtimer_cancel(&rq->hrtick_timer);
@@ -480,10 +480,6 @@ static void init_rq_hrtick(struct rq *rq)
 	rq->hrtick_timer.function = hrtick;
 }
 #else	/* CONFIG_SCHED_HRTICK */
-static inline void hrtick_clear(struct rq *rq)
-{
-}
-
 static inline void init_rq_hrtick(struct rq *rq)
 {
 }
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a4d2b7a..b083a91 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -5271,6 +5271,13 @@ static void switched_from_fair(struct rq *rq,
struct task_struct *p)
 		place_entity(cfs_rq, se, 0);
 		se->vruntime -= cfs_rq->min_vruntime;
 	}
+
+	/*
+	 * Other scheduling classes are not interested in fair's hrtick timer.
+	 */
+	if (task_current(rq, p) && sched_feat(HRTICK))
+		hrtick_clear(rq);
+
 }
 
 /*
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index d8d3613..f3c177c 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -936,6 +936,8 @@ static inline int hrtick_enabled(struct rq *rq)
 	return hrtimer_is_hres_active(&rq->hrtick_timer);
 }
 
+void hrtick_clear(struct rq *rq);
+
 void hrtick_start(struct rq *rq, u64 delay);
 
 #else
@@ -945,6 +947,10 @@ static inline int hrtick_enabled(struct rq *rq)
 	return 0;
 }
 
+static inline void hrtick_clear(struct rq *rq)
+{
+}
+
 #endif /* CONFIG_SCHED_HRTICK */
 
 #ifdef CONFIG_SMP







             reply	other threads:[~2011-12-22 20:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22 20:01 Kirill Tkhai [this message]
2011-12-26 15:42 ` [PATCH]sched: stop hrtick timer if running task is switching from fair scheduling class to another Oleg Nesterov
2012-01-04 12:30   ` Peter Zijlstra
2011-12-26 16:59 ` SCHED_RR && time_slice Oleg Nesterov
2011-12-29 16:43   ` Kirill Tkhai
2011-12-29 17:12     ` Oleg Nesterov
  -- strict thread matches above, loose matches on Subject: below --
2011-12-17  0:09 [PATCH]sched: stop hrtick timer if running task is switching from fair scheduling class to another Kirill Tkhai

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=1324584060.4222.15.camel@hp \
    --to=kirill.tkhai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=tkhai@yandex.ru \
    /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.