From: Peter Zijlstra <peterz@infradead.org> To: tglx@linutronix.de Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, diego.viola@gmail.com, len.brown@intel.com, rjw@rjwysocki.net, rui.zhang@intel.com Subject: [PATCH v2 7/7] clocksource: Remove kthread Date: Mon, 30 Apr 2018 12:00:15 +0200 [thread overview] Message-ID: <20180430100344.713862818@infradead.org> (raw) In-Reply-To: <20180430100008.503783478@infradead.org> [-- Attachment #1: peterz-tsc-early-fix-8.patch --] [-- Type: text/plain, Size: 3631 bytes --] The clocksource watchdog uses a work to spawn a kthread to run the watchdog. That is about as silly as it sounds, run the watchdog directly from the work. Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> --- kernel/time/clocksource.c | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -129,31 +129,19 @@ static void inline clocksource_watchdog_ spin_unlock_irqrestore(&watchdog_lock, *flags); } -static int clocksource_watchdog_kthread(void *data); -static void __clocksource_change_rating(struct clocksource *cs, int rating); - /* * Interval: 0.5sec Threshold: 0.0625s */ #define WATCHDOG_INTERVAL (HZ >> 1) #define WATCHDOG_THRESHOLD (NSEC_PER_SEC >> 4) -static void clocksource_watchdog_work(struct work_struct *work) -{ - /* - * If kthread_run fails the next watchdog scan over the - * watchdog_list will find the unstable clock again. - */ - kthread_run(clocksource_watchdog_kthread, NULL, "kwatchdog"); -} - static void __clocksource_unstable(struct clocksource *cs) { cs->flags &= ~(CLOCK_SOURCE_VALID_FOR_HRES | CLOCK_SOURCE_WATCHDOG); cs->flags |= CLOCK_SOURCE_UNSTABLE; /* - * If the clocksource is registered clocksource_watchdog_kthread() will + * If the clocksource is registered clocksource_watchdog_work() will * re-rate and re-select. */ if (list_empty(&cs->list)) { @@ -164,7 +152,7 @@ static void __clocksource_unstable(struc if (cs->mark_unstable) cs->mark_unstable(cs); - /* kick clocksource_watchdog_kthread() */ + /* kick clocksource_watchdog_work() */ if (finished_booting) schedule_work(&watchdog_work); } @@ -174,7 +162,7 @@ static void __clocksource_unstable(struc * @cs: clocksource to be marked unstable * * This function is called by the x86 TSC code to mark clocksources as unstable; - * it defers demotion and re-selection to a kthread. + * it defers demotion and re-selection to a work. */ void clocksource_mark_unstable(struct clocksource *cs) { @@ -399,7 +387,9 @@ static void clocksource_dequeue_watchdog } } -static int __clocksource_watchdog_kthread(void) +static void __clocksource_change_rating(struct clocksource *cs, int rating); + +static int __clocksource_watchdog_work(void) { struct clocksource *cs, *tmp; unsigned long flags; @@ -424,13 +414,12 @@ static int __clocksource_watchdog_kthrea return select; } -static int clocksource_watchdog_kthread(void *data) +static void clocksource_watchdog_work(struct work_struct *work) { mutex_lock(&clocksource_mutex); - if (__clocksource_watchdog_kthread()) + if (__clocksource_watchdog_work()) clocksource_select(); mutex_unlock(&clocksource_mutex); - return 0; } static bool clocksource_is_watchdog(struct clocksource *cs) @@ -449,7 +438,7 @@ static void clocksource_enqueue_watchdog static void clocksource_select_watchdog(bool fallback) { } static inline void clocksource_dequeue_watchdog(struct clocksource *cs) { } static inline void clocksource_resume_watchdog(void) { } -static inline int __clocksource_watchdog_kthread(void) { return 0; } +static inline int __clocksource_watchdog_work(void) { return 0; } static bool clocksource_is_watchdog(struct clocksource *cs) { return false; } void clocksource_mark_unstable(struct clocksource *cs) { } @@ -680,7 +669,7 @@ static int __init clocksource_done_booti /* * Run the watchdog first to eliminate unstable clock sources */ - __clocksource_watchdog_kthread(); + __clocksource_watchdog_work(); clocksource_select(); mutex_unlock(&clocksource_mutex); return 0;
next prev parent reply other threads:[~2018-04-30 10:04 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-04-30 10:00 [PATCH v2 0/7] Various tsc/clocksource fixes Peter Zijlstra 2018-04-30 10:00 ` [PATCH v2 1/7] x86,tsc: Always unregister clocksource_tsc_early Peter Zijlstra 2018-05-02 14:12 ` [tip:timers/urgent] x86/tsc: " tip-bot for Peter Zijlstra 2018-04-30 10:00 ` [PATCH v2 2/7] clocksource: Allow clocksource_mark_unstable() on unregisered clocksources Peter Zijlstra 2018-05-02 13:35 ` Thomas Gleixner 2018-05-02 13:53 ` Peter Zijlstra 2018-05-02 14:13 ` [tip:timers/urgent] clocksource: Allow clocksource_mark_unstable() on unregistered clocksources tip-bot for Peter Zijlstra 2018-04-30 10:00 ` [PATCH v2 3/7] clocksource: Initialize cs->wd_list Peter Zijlstra 2018-05-02 13:37 ` Thomas Gleixner 2018-05-02 13:55 ` Peter Zijlstra 2018-05-02 14:13 ` [tip:timers/urgent] " tip-bot for Peter Zijlstra 2018-04-30 10:00 ` [PATCH v2 4/7] x86,tsc: Fix mark_tsc_unstable() Peter Zijlstra 2018-05-02 14:14 ` [tip:timers/urgent] x86/tsc: " tip-bot for Peter Zijlstra 2018-04-30 10:00 ` [PATCH v2 5/7] clocksource: Consistent de-rate when marking unstable Peter Zijlstra 2018-05-02 14:14 ` [tip:timers/urgent] " tip-bot for Peter Zijlstra 2018-04-30 10:00 ` [PATCH v2 6/7] clocksource: Rework stale comment Peter Zijlstra 2018-05-02 14:15 ` [tip:timers/urgent] " tip-bot for Peter Zijlstra 2018-04-30 10:00 ` Peter Zijlstra [this message] 2018-05-02 14:42 ` [tip:timers/core] clocksource: Remove kthread tip-bot for Peter Zijlstra 2018-05-01 9:12 ` [PATCH v2 0/7] Various tsc/clocksource fixes Rafael J. Wysocki
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=20180430100344.713862818@infradead.org \ --to=peterz@infradead.org \ --cc=diego.viola@gmail.com \ --cc=len.brown@intel.com \ --cc=linux-kernel@vger.kernel.org \ --cc=rjw@rjwysocki.net \ --cc=rui.zhang@intel.com \ --cc=tglx@linutronix.de \ --subject='Re: [PATCH v2 7/7] clocksource: Remove kthread' \ /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
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.