Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1722405
| From | Yang Zhang <yang.zhang.wz@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [RFC PATCH v2 7/7] sched/idle: update poll time when wakeup from idle |
| Date | 2017-08-29 13:50 +0200 |
| Message-ID | <ujNbR-25K-41@gated-at.bofh.it> (permalink) |
| References | <ujNbP-25K-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
In ttwu_do_wakeup, it will update avg_idle when wakeup from idle. Here
we just reuse this logic to update the poll time. It may be a little
late to update the poll in ttwu_do_wakeup, but the test result shows no
obvious performance gap compare with updating poll in irq handler.
one problem is that idle_stamp only used when using CFS scheduler. But
it is ok since it is the default policy for scheduler and only consider
it should enough.
Signed-off-by: Yang Zhang <yang.zhang.wz@gmail.com>
Signed-off-by: Quan Xu <quan.xu0@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
---
include/linux/sched/idle.h | 4 ++++
kernel/sched/core.c | 4 ++++
kernel/sched/idle.c | 7 +++++++
3 files changed, 15 insertions(+)
diff --git a/include/linux/sched/idle.h b/include/linux/sched/idle.h
index 5ca63eb..6e0554d 100644
--- a/include/linux/sched/idle.h
+++ b/include/linux/sched/idle.h
@@ -12,6 +12,10 @@ enum cpu_idle_type {
extern void wake_up_if_idle(int cpu);
+#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT)
+extern void update_poll_duration(unsigned long idle_duration);
+#endif
+
/*
* Idle thread specific functions to determine the need_resched
* polling state.
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0869b20..25be9a3 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1678,6 +1678,10 @@ static void ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags,
if (rq->avg_idle > max)
rq->avg_idle = max;
+#if defined(CONFIG_PARAVIRT)
+ update_poll_duration(rq->avg_idle);
+#endif
+
rq->idle_stamp = 0;
}
#endif
diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c
index b374744..7eb8559 100644
--- a/kernel/sched/idle.c
+++ b/kernel/sched/idle.c
@@ -101,6 +101,13 @@ void __cpuidle default_idle_call(void)
}
}
+#if defined(CONFIG_SMP) && defined(CONFIG_PARAVIRT)
+void update_poll_duration(unsigned long idle_duration)
+{
+ paravirt_idle_update_poll_duration(idle_duration);
+}
+#endif
+
static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
int next_state)
{
--
1.8.3.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH v2 0/7] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-08-29 13:50 +0200
[RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path Yang Zhang <yang.zhang.wz@gmail.com> - 2017-08-29 13:50 +0200
Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path Peter Zijlstra <peterz@infradead.org> - 2017-08-29 14:50 +0200
Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path Quan Xu <quan.xu0@gmail.com> - 2017-09-01 08:00 +0200
Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path Borislav Petkov <bp@alien8.de> - 2017-08-29 16:40 +0200
Re: [RFC PATCH v2 3/7] sched/idle: Add poll before enter real idle path Quan Xu <quan.xu0@gmail.com> - 2017-09-01 09:00 +0200
[RFC PATCH v2 1/7] x86/paravirt: Add pv_idle_ops to paravirt ops Yang Zhang <yang.zhang.wz@gmail.com> - 2017-08-29 13:50 +0200
Re: [RFC PATCH v2 1/7] x86/paravirt: Add pv_idle_ops to paravirt ops Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> - 2017-08-29 16:10 +0200
Re: [RFC PATCH v2 1/7] x86/paravirt: Add pv_idle_ops to paravirt ops Juergen Gross <jgross@suse.com> - 2017-08-30 09:40 +0200
Re: [RFC PATCH v2 1/7] x86/paravirt: Add pv_idle_ops to paravirt ops Yang Zhang <yang.zhang.wz@gmail.com> - 2017-09-01 09:00 +0200
[RFC PATCH v2 5/7] Documentation: Add three sysctls for smart idle poll Yang Zhang <yang.zhang.wz@gmail.com> - 2017-08-29 13:50 +0200
Re: [RFC PATCH v2 5/7] Documentation: Add three sysctls for smart idle poll "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-08-29 19:30 +0200
[RFC PATCH v2 2/7] KVM guest: register kvm_idle_poll for pv_idle_ops Yang Zhang <yang.zhang.wz@gmail.com> - 2017-08-29 13:50 +0200
[RFC PATCH v2 4/7] x86/paravirt: Add update in x86/paravirt pv_idle_ops Yang Zhang <yang.zhang.wz@gmail.com> - 2017-08-29 13:50 +0200
[RFC PATCH v2 7/7] sched/idle: update poll time when wakeup from idle Yang Zhang <yang.zhang.wz@gmail.com> - 2017-08-29 13:50 +0200
Re: [RFC PATCH v2 7/7] sched/idle: update poll time when wakeup from idle Peter Zijlstra <peterz@infradead.org> - 2017-08-29 14:50 +0200
Re: [RFC PATCH v2 7/7] sched/idle: update poll time when wakeup from idle Yang Zhang <yang.zhang.wz@gmail.com> - 2017-09-01 09:40 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Alexander Graf <agraf@suse.de> - 2017-08-29 14:00 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-09-01 08:30 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Andi Kleen <andi@firstfloor.org> - 2017-08-29 15:10 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Wanpeng Li <kernellwp@gmail.com> - 2017-08-29 16:10 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> - 2017-08-29 16:30 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-29 16:40 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-09-01 08:40 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Wanpeng Li <kernellwp@gmail.com> - 2017-09-01 09:00 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-09-01 08:50 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Wanpeng Li <kernellwp@gmail.com> - 2017-09-01 09:00 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support Yang Zhang <yang.zhang.wz@gmail.com> - 2017-09-01 10:00 +0200
Re: [RFC PATCH v2 0/7] x86/idle: add halt poll support "Michael S. Tsirkin" <mst@redhat.com> - 2017-08-29 17:00 +0200
csiph-web