aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-03-18 22:26:54 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-03-18 22:26:54 -0400
commit814a2bf957739f367cbebfa1b60237387b72d0ee (patch)
tree8d65c38d14beb8d6d2dc5b9d7f8dbe63c7cad31a /kernel
parent237045fc3c67d44088f767dca5a9fa30815eba62 (diff)
parentf9310b2f9a19b7f16c7b1c1558f8b649b9b933c1 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge second patch-bomb from Andrew Morton: - a couple of hotfixes - the rest of MM - a new timer slack control in procfs - a couple of procfs fixes - a few misc things - some printk tweaks - lib/ updates, notably to radix-tree. - add my and Nick Piggin's old userspace radix-tree test harness to tools/testing/radix-tree/. Matthew said it was a godsend during the radix-tree work he did. - a few code-size improvements, switching to __always_inline where gcc screwed up. - partially implement character sets in sscanf * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (118 commits) sscanf: implement basic character sets lib/bug.c: use common WARN helper param: convert some "on"/"off" users to strtobool lib: add "on"/"off" support to kstrtobool lib: update single-char callers of strtobool() lib: move strtobool() to kstrtobool() include/linux/unaligned: force inlining of byteswap operations include/uapi/linux/byteorder, swab: force inlining of some byteswap operations include/asm-generic/atomic-long.h: force inlining of some atomic_long operations usb: common: convert to use match_string() helper ide: hpt366: convert to use match_string() helper ata: hpt366: convert to use match_string() helper power: ab8500: convert to use match_string() helper power: charger_manager: convert to use match_string() helper drm/edid: convert to use match_string() helper pinctrl: convert to use match_string() helper device property: convert to use match_string() helper lib/string: introduce match_string() helper radix-tree tests: add test for radix_tree_iter_next radix-tree tests: add regression3 test ...
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c10
-rw-r--r--kernel/panic.c41
-rw-r--r--kernel/printk/printk.c140
-rw-r--r--kernel/sys.c5
-rw-r--r--kernel/sysctl.c10
-rw-r--r--kernel/time/hrtimer.c18
-rw-r--r--kernel/time/tick-sched.c10
-rw-r--r--kernel/time/timer.c4
-rw-r--r--kernel/watchdog.c9
9 files changed, 133 insertions, 114 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 2e391c754ae7..accb7221d547 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -164,12 +164,20 @@ static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
164 struct page *page = alloc_kmem_pages_node(node, THREADINFO_GFP, 164 struct page *page = alloc_kmem_pages_node(node, THREADINFO_GFP,
165 THREAD_SIZE_ORDER); 165 THREAD_SIZE_ORDER);
166 166
167 if (page)
168 memcg_kmem_update_page_stat(page, MEMCG_KERNEL_STACK,
169 1 << THREAD_SIZE_ORDER);
170
167 return page ? page_address(page) : NULL; 171 return page ? page_address(page) : NULL;
168} 172}
169 173
170static inline void free_thread_info(struct thread_info *ti) 174static inline void free_thread_info(struct thread_info *ti)
171{ 175{
172 free_kmem_pages((unsigned long)ti, THREAD_SIZE_ORDER); 176 struct page *page = virt_to_page(ti);
177
178 memcg_kmem_update_page_stat(page, MEMCG_KERNEL_STACK,
179 -(1 << THREAD_SIZE_ORDER));
180 __free_kmem_pages(page, THREAD_SIZE_ORDER);
173} 181}
174# else 182# else
175static struct kmem_cache *thread_info_cache; 183static struct kmem_cache *thread_info_cache;
diff --git a/kernel/panic.c b/kernel/panic.c
index d96469de72dc..fa400852bf6c 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/nmi.h> 25#include <linux/nmi.h>
26#include <linux/console.h> 26#include <linux/console.h>
27#include <linux/bug.h>
27 28
28#define PANIC_TIMER_STEP 100 29#define PANIC_TIMER_STEP 100
29#define PANIC_BLINK_SPD 18 30#define PANIC_BLINK_SPD 18
@@ -449,20 +450,25 @@ void oops_exit(void)
449 kmsg_dump(KMSG_DUMP_OOPS); 450 kmsg_dump(KMSG_DUMP_OOPS);
450} 451}
451 452
452#ifdef WANT_WARN_ON_SLOWPATH 453struct warn_args {
453struct slowpath_args {
454 const char *fmt; 454 const char *fmt;
455 va_list args; 455 va_list args;
456}; 456};
457 457
458static void warn_slowpath_common(const char *file, int line, void *caller, 458void __warn(const char *file, int line, void *caller, unsigned taint,
459 unsigned taint, struct slowpath_args *args) 459 struct pt_regs *regs, struct warn_args *args)
460{ 460{
461 disable_trace_on_warning(); 461 disable_trace_on_warning();
462 462
463 pr_warn("------------[ cut here ]------------\n"); 463 pr_warn("------------[ cut here ]------------\n");
464 pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS()\n", 464
465 raw_smp_processor_id(), current->pid, file, line, caller); 465 if (file)
466 pr_warn("WARNING: CPU: %d PID: %d at %s:%d %pS\n",
467 raw_smp_processor_id(), current->pid, file, line,
468 caller);
469 else
470 pr_warn("WARNING: CPU: %d PID: %d at %pS\n",
471 raw_smp_processor_id(), current->pid, caller);
466 472
467 if (args) 473 if (args)
468 vprintk(args->fmt, args->args); 474 vprintk(args->fmt, args->args);
@@ -479,20 +485,27 @@ static void warn_slowpath_common(const char *file, int line, void *caller,
479 } 485 }
480 486
481 print_modules(); 487 print_modules();
482 dump_stack(); 488
489 if (regs)
490 show_regs(regs);
491 else
492 dump_stack();
493
483 print_oops_end_marker(); 494 print_oops_end_marker();
495
484 /* Just a warning, don't kill lockdep. */ 496 /* Just a warning, don't kill lockdep. */
485 add_taint(taint, LOCKDEP_STILL_OK); 497 add_taint(taint, LOCKDEP_STILL_OK);
486} 498}
487 499
500#ifdef WANT_WARN_ON_SLOWPATH
488void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...) 501void warn_slowpath_fmt(const char *file, int line, const char *fmt, ...)
489{ 502{
490 struct slowpath_args args; 503 struct warn_args args;
491 504
492 args.fmt = fmt; 505 args.fmt = fmt;
493 va_start(args.args, fmt); 506 va_start(args.args, fmt);
494 warn_slowpath_common(file, line, __builtin_return_address(0), 507 __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL,
495 TAINT_WARN, &args); 508 &args);
496 va_end(args.args); 509 va_end(args.args);
497} 510}
498EXPORT_SYMBOL(warn_slowpath_fmt); 511EXPORT_SYMBOL(warn_slowpath_fmt);
@@ -500,20 +513,18 @@ EXPORT_SYMBOL(warn_slowpath_fmt);
500void warn_slowpath_fmt_taint(const char *file, int line, 513void warn_slowpath_fmt_taint(const char *file, int line,
501 unsigned taint, const char *fmt, ...) 514 unsigned taint, const char *fmt, ...)
502{ 515{
503 struct slowpath_args args; 516 struct warn_args args;
504 517
505 args.fmt = fmt; 518 args.fmt = fmt;
506 va_start(args.args, fmt); 519 va_start(args.args, fmt);
507 warn_slowpath_common(file, line, __builtin_return_address(0), 520 __warn(file, line, __builtin_return_address(0), taint, NULL, &args);
508 taint, &args);
509 va_end(args.args); 521 va_end(args.args);
510} 522}
511EXPORT_SYMBOL(warn_slowpath_fmt_taint); 523EXPORT_SYMBOL(warn_slowpath_fmt_taint);
512 524
513void warn_slowpath_null(const char *file, int line) 525void warn_slowpath_null(const char *file, int line)
514{ 526{
515 warn_slowpath_common(file, line, __builtin_return_address(0), 527 __warn(file, line, __builtin_return_address(0), TAINT_WARN, NULL, NULL);
516 TAINT_WARN, NULL);
517} 528}
518EXPORT_SYMBOL(warn_slowpath_null); 529EXPORT_SYMBOL(warn_slowpath_null);
519#endif 530#endif
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index c963ba534a78..bfbf284e4218 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -367,16 +367,20 @@ static int logbuf_has_space(u32 msg_size, bool empty)
367 367
368static int log_make_free_space(u32 msg_size) 368static int log_make_free_space(u32 msg_size)
369{ 369{
370 while (log_first_seq < log_next_seq) { 370 while (log_first_seq < log_next_seq &&
371 if (logbuf_has_space(msg_size, false)) 371 !logbuf_has_space(msg_size, false)) {
372 return 0;
373 /* drop old messages until we have enough contiguous space */ 372 /* drop old messages until we have enough contiguous space */
374 log_first_idx = log_next(log_first_idx); 373 log_first_idx = log_next(log_first_idx);
375 log_first_seq++; 374 log_first_seq++;
376 } 375 }
377 376
377 if (clear_seq < log_first_seq) {
378 clear_seq = log_first_seq;
379 clear_idx = log_first_idx;
380 }
381
378 /* sequence numbers are equal, so the log buffer is empty */ 382 /* sequence numbers are equal, so the log buffer is empty */
379 if (logbuf_has_space(msg_size, true)) 383 if (logbuf_has_space(msg_size, log_first_seq == log_next_seq))
380 return 0; 384 return 0;
381 385
382 return -ENOMEM; 386 return -ENOMEM;
@@ -854,6 +858,7 @@ void log_buf_kexec_setup(void)
854 VMCOREINFO_SYMBOL(log_buf); 858 VMCOREINFO_SYMBOL(log_buf);
855 VMCOREINFO_SYMBOL(log_buf_len); 859 VMCOREINFO_SYMBOL(log_buf_len);
856 VMCOREINFO_SYMBOL(log_first_idx); 860 VMCOREINFO_SYMBOL(log_first_idx);
861 VMCOREINFO_SYMBOL(clear_idx);
857 VMCOREINFO_SYMBOL(log_next_idx); 862 VMCOREINFO_SYMBOL(log_next_idx);
858 /* 863 /*
859 * Export struct printk_log size and field offsets. User space tools can 864 * Export struct printk_log size and field offsets. User space tools can
@@ -1216,12 +1221,6 @@ static int syslog_print_all(char __user *buf, int size, bool clear)
1216 u32 idx; 1221 u32 idx;
1217 enum log_flags prev; 1222 enum log_flags prev;
1218 1223
1219 if (clear_seq < log_first_seq) {
1220 /* messages are gone, move to first available one */
1221 clear_seq = log_first_seq;
1222 clear_idx = log_first_idx;
1223 }
1224
1225 /* 1224 /*
1226 * Find first record that fits, including all following records, 1225 * Find first record that fits, including all following records,
1227 * into the user-provided buffer for this dump. 1226 * into the user-provided buffer for this dump.
@@ -1483,58 +1482,6 @@ static void zap_locks(void)
1483 sema_init(&console_sem, 1); 1482 sema_init(&console_sem, 1);
1484} 1483}
1485 1484
1486/*
1487 * Check if we have any console that is capable of printing while cpu is
1488 * booting or shutting down. Requires console_sem.
1489 */
1490static int have_callable_console(void)
1491{
1492 struct console *con;
1493
1494 for_each_console(con)
1495 if (con->flags & CON_ANYTIME)
1496 return 1;
1497
1498 return 0;
1499}
1500
1501/*
1502 * Can we actually use the console at this time on this cpu?
1503 *
1504 * Console drivers may assume that per-cpu resources have been allocated. So
1505 * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't
1506 * call them until this CPU is officially up.
1507 */
1508static inline int can_use_console(unsigned int cpu)
1509{
1510 return cpu_online(cpu) || have_callable_console();
1511}
1512
1513/*
1514 * Try to get console ownership to actually show the kernel
1515 * messages from a 'printk'. Return true (and with the
1516 * console_lock held, and 'console_locked' set) if it
1517 * is successful, false otherwise.
1518 */
1519static int console_trylock_for_printk(void)
1520{
1521 unsigned int cpu = smp_processor_id();
1522
1523 if (!console_trylock())
1524 return 0;
1525 /*
1526 * If we can't use the console, we need to release the console
1527 * semaphore by hand to avoid flushing the buffer. We need to hold the
1528 * console semaphore in order to do this test safely.
1529 */
1530 if (!can_use_console(cpu)) {
1531 console_locked = 0;
1532 up_console_sem();
1533 return 0;
1534 }
1535 return 1;
1536}
1537
1538int printk_delay_msec __read_mostly; 1485int printk_delay_msec __read_mostly;
1539 1486
1540static inline void printk_delay(void) 1487static inline void printk_delay(void)
@@ -1681,7 +1628,6 @@ asmlinkage int vprintk_emit(int facility, int level,
1681 boot_delay_msec(level); 1628 boot_delay_msec(level);
1682 printk_delay(); 1629 printk_delay();
1683 1630
1684 /* This stops the holder of console_sem just where we want him */
1685 local_irq_save(flags); 1631 local_irq_save(flags);
1686 this_cpu = smp_processor_id(); 1632 this_cpu = smp_processor_id();
1687 1633
@@ -1705,6 +1651,7 @@ asmlinkage int vprintk_emit(int facility, int level,
1705 } 1651 }
1706 1652
1707 lockdep_off(); 1653 lockdep_off();
1654 /* This stops the holder of console_sem just where we want him */
1708 raw_spin_lock(&logbuf_lock); 1655 raw_spin_lock(&logbuf_lock);
1709 logbuf_cpu = this_cpu; 1656 logbuf_cpu = this_cpu;
1710 1657
@@ -1810,20 +1757,12 @@ asmlinkage int vprintk_emit(int facility, int level,
1810 if (!in_sched) { 1757 if (!in_sched) {
1811 lockdep_off(); 1758 lockdep_off();
1812 /* 1759 /*
1813 * Disable preemption to avoid being preempted while holding
1814 * console_sem which would prevent anyone from printing to
1815 * console
1816 */
1817 preempt_disable();
1818
1819 /*
1820 * Try to acquire and then immediately release the console 1760 * Try to acquire and then immediately release the console
1821 * semaphore. The release will print out buffers and wake up 1761 * semaphore. The release will print out buffers and wake up
1822 * /dev/kmsg and syslog() users. 1762 * /dev/kmsg and syslog() users.
1823 */ 1763 */
1824 if (console_trylock_for_printk()) 1764 if (console_trylock())
1825 console_unlock(); 1765 console_unlock();
1826 preempt_enable();
1827 lockdep_on(); 1766 lockdep_on();
1828 } 1767 }
1829 1768
@@ -2174,7 +2113,20 @@ int console_trylock(void)
2174 return 0; 2113 return 0;
2175 } 2114 }
2176 console_locked = 1; 2115 console_locked = 1;
2177 console_may_schedule = 0; 2116 /*
2117 * When PREEMPT_COUNT disabled we can't reliably detect if it's
2118 * safe to schedule (e.g. calling printk while holding a spin_lock),
2119 * because preempt_disable()/preempt_enable() are just barriers there
2120 * and preempt_count() is always 0.
2121 *
2122 * RCU read sections have a separate preemption counter when
2123 * PREEMPT_RCU enabled thus we must take extra care and check
2124 * rcu_preempt_depth(), otherwise RCU read sections modify
2125 * preempt_count().
2126 */
2127 console_may_schedule = !oops_in_progress &&
2128 preemptible() &&
2129 !rcu_preempt_depth();
2178 return 1; 2130 return 1;
2179} 2131}
2180EXPORT_SYMBOL(console_trylock); 2132EXPORT_SYMBOL(console_trylock);
@@ -2184,6 +2136,34 @@ int is_console_locked(void)
2184 return console_locked; 2136 return console_locked;
2185} 2137}
2186 2138
2139/*
2140 * Check if we have any console that is capable of printing while cpu is
2141 * booting or shutting down. Requires console_sem.
2142 */
2143static int have_callable_console(void)
2144{
2145 struct console *con;
2146
2147 for_each_console(con)
2148 if ((con->flags & CON_ENABLED) &&
2149 (con->flags & CON_ANYTIME))
2150 return 1;
2151
2152 return 0;
2153}
2154
2155/*
2156 * Can we actually use the console at this time on this cpu?
2157 *
2158 * Console drivers may assume that per-cpu resources have been allocated. So
2159 * unless they're explicitly marked as being able to cope (CON_ANYTIME) don't
2160 * call them until this CPU is officially up.
2161 */
2162static inline int can_use_console(void)
2163{
2164 return cpu_online(raw_smp_processor_id()) || have_callable_console();
2165}
2166
2187static void console_cont_flush(char *text, size_t size) 2167static void console_cont_flush(char *text, size_t size)
2188{ 2168{
2189 unsigned long flags; 2169 unsigned long flags;
@@ -2254,9 +2234,21 @@ void console_unlock(void)
2254 do_cond_resched = console_may_schedule; 2234 do_cond_resched = console_may_schedule;
2255 console_may_schedule = 0; 2235 console_may_schedule = 0;
2256 2236
2237again:
2238 /*
2239 * We released the console_sem lock, so we need to recheck if
2240 * cpu is online and (if not) is there at least one CON_ANYTIME
2241 * console.
2242 */
2243 if (!can_use_console()) {
2244 console_locked = 0;
2245 up_console_sem();
2246 return;
2247 }
2248
2257 /* flush buffered message fragment immediately to console */ 2249 /* flush buffered message fragment immediately to console */
2258 console_cont_flush(text, sizeof(text)); 2250 console_cont_flush(text, sizeof(text));
2259again: 2251
2260 for (;;) { 2252 for (;;) {
2261 struct printk_log *msg; 2253 struct printk_log *msg;
2262 size_t ext_len = 0; 2254 size_t ext_len = 0;
diff --git a/kernel/sys.c b/kernel/sys.c
index 78947de6f969..cf8ba545c7d3 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -2169,7 +2169,10 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
2169 error = perf_event_task_enable(); 2169 error = perf_event_task_enable();
2170 break; 2170 break;
2171 case PR_GET_TIMERSLACK: 2171 case PR_GET_TIMERSLACK:
2172 error = current->timer_slack_ns; 2172 if (current->timer_slack_ns > ULONG_MAX)
2173 error = ULONG_MAX;
2174 else
2175 error = current->timer_slack_ns;
2173 break; 2176 break;
2174 case PR_SET_TIMERSLACK: 2177 case PR_SET_TIMERSLACK:
2175 if (arg2 <= 0) 2178 if (arg2 <= 0)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index f5102fabef7f..725587f10667 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -126,6 +126,7 @@ static int __maybe_unused two = 2;
126static int __maybe_unused four = 4; 126static int __maybe_unused four = 4;
127static unsigned long one_ul = 1; 127static unsigned long one_ul = 1;
128static int one_hundred = 100; 128static int one_hundred = 100;
129static int one_thousand = 1000;
129#ifdef CONFIG_PRINTK 130#ifdef CONFIG_PRINTK
130static int ten_thousand = 10000; 131static int ten_thousand = 10000;
131#endif 132#endif
@@ -1404,6 +1405,15 @@ static struct ctl_table vm_table[] = {
1404 .extra1 = &zero, 1405 .extra1 = &zero,
1405 }, 1406 },
1406 { 1407 {
1408 .procname = "watermark_scale_factor",
1409 .data = &watermark_scale_factor,
1410 .maxlen = sizeof(watermark_scale_factor),
1411 .mode = 0644,
1412 .proc_handler = watermark_scale_factor_sysctl_handler,
1413 .extra1 = &one,
1414 .extra2 = &one_thousand,
1415 },
1416 {
1407 .procname = "percpu_pagelist_fraction", 1417 .procname = "percpu_pagelist_fraction",
1408 .data = &percpu_pagelist_fraction, 1418 .data = &percpu_pagelist_fraction,
1409 .maxlen = sizeof(percpu_pagelist_fraction), 1419 .maxlen = sizeof(percpu_pagelist_fraction),
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index fa909f9fd559..fa0b983290cf 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -515,7 +515,7 @@ static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
515/* 515/*
516 * High resolution timer enabled ? 516 * High resolution timer enabled ?
517 */ 517 */
518static int hrtimer_hres_enabled __read_mostly = 1; 518static bool hrtimer_hres_enabled __read_mostly = true;
519unsigned int hrtimer_resolution __read_mostly = LOW_RES_NSEC; 519unsigned int hrtimer_resolution __read_mostly = LOW_RES_NSEC;
520EXPORT_SYMBOL_GPL(hrtimer_resolution); 520EXPORT_SYMBOL_GPL(hrtimer_resolution);
521 521
@@ -524,13 +524,7 @@ EXPORT_SYMBOL_GPL(hrtimer_resolution);
524 */ 524 */
525static int __init setup_hrtimer_hres(char *str) 525static int __init setup_hrtimer_hres(char *str)
526{ 526{
527 if (!strcmp(str, "off")) 527 return (kstrtobool(str, &hrtimer_hres_enabled) == 0);
528 hrtimer_hres_enabled = 0;
529 else if (!strcmp(str, "on"))
530 hrtimer_hres_enabled = 1;
531 else
532 return 0;
533 return 1;
534} 528}
535 529
536__setup("highres=", setup_hrtimer_hres); 530__setup("highres=", setup_hrtimer_hres);
@@ -979,7 +973,7 @@ static inline ktime_t hrtimer_update_lowres(struct hrtimer *timer, ktime_t tim,
979 * relative (HRTIMER_MODE_REL) 973 * relative (HRTIMER_MODE_REL)
980 */ 974 */
981void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, 975void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
982 unsigned long delta_ns, const enum hrtimer_mode mode) 976 u64 delta_ns, const enum hrtimer_mode mode)
983{ 977{
984 struct hrtimer_clock_base *base, *new_base; 978 struct hrtimer_clock_base *base, *new_base;
985 unsigned long flags; 979 unsigned long flags;
@@ -1548,7 +1542,7 @@ long hrtimer_nanosleep(struct timespec *rqtp, struct timespec __user *rmtp,
1548 struct restart_block *restart; 1542 struct restart_block *restart;
1549 struct hrtimer_sleeper t; 1543 struct hrtimer_sleeper t;
1550 int ret = 0; 1544 int ret = 0;
1551 unsigned long slack; 1545 u64 slack;
1552 1546
1553 slack = current->timer_slack_ns; 1547 slack = current->timer_slack_ns;
1554 if (dl_task(current) || rt_task(current)) 1548 if (dl_task(current) || rt_task(current))
@@ -1724,7 +1718,7 @@ void __init hrtimers_init(void)
1724 * @clock: timer clock, CLOCK_MONOTONIC or CLOCK_REALTIME 1718 * @clock: timer clock, CLOCK_MONOTONIC or CLOCK_REALTIME
1725 */ 1719 */
1726int __sched 1720int __sched
1727schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta, 1721schedule_hrtimeout_range_clock(ktime_t *expires, u64 delta,
1728 const enum hrtimer_mode mode, int clock) 1722 const enum hrtimer_mode mode, int clock)
1729{ 1723{
1730 struct hrtimer_sleeper t; 1724 struct hrtimer_sleeper t;
@@ -1792,7 +1786,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, unsigned long delta,
1792 * 1786 *
1793 * Returns 0 when the timer has expired otherwise -EINTR 1787 * Returns 0 when the timer has expired otherwise -EINTR
1794 */ 1788 */
1795int __sched schedule_hrtimeout_range(ktime_t *expires, unsigned long delta, 1789int __sched schedule_hrtimeout_range(ktime_t *expires, u64 delta,
1796 const enum hrtimer_mode mode) 1790 const enum hrtimer_mode mode)
1797{ 1791{
1798 return schedule_hrtimeout_range_clock(expires, delta, mode, 1792 return schedule_hrtimeout_range_clock(expires, delta, mode,
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 969e6704c3c9..195fe7d2caad 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -486,20 +486,14 @@ void __init tick_nohz_init(void)
486/* 486/*
487 * NO HZ enabled ? 487 * NO HZ enabled ?
488 */ 488 */
489int tick_nohz_enabled __read_mostly = 1; 489bool tick_nohz_enabled __read_mostly = true;
490unsigned long tick_nohz_active __read_mostly; 490unsigned long tick_nohz_active __read_mostly;
491/* 491/*
492 * Enable / Disable tickless mode 492 * Enable / Disable tickless mode
493 */ 493 */
494static int __init setup_tick_nohz(char *str) 494static int __init setup_tick_nohz(char *str)
495{ 495{
496 if (!strcmp(str, "off")) 496 return (kstrtobool(str, &tick_nohz_enabled) == 0);
497 tick_nohz_enabled = 0;
498 else if (!strcmp(str, "on"))
499 tick_nohz_enabled = 1;
500 else
501 return 0;
502 return 1;
503} 497}
504 498
505__setup("nohz=", setup_tick_nohz); 499__setup("nohz=", setup_tick_nohz);
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index bbc5d1114583..d1798fa0c743 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -1698,10 +1698,10 @@ EXPORT_SYMBOL(msleep_interruptible);
1698static void __sched do_usleep_range(unsigned long min, unsigned long max) 1698static void __sched do_usleep_range(unsigned long min, unsigned long max)
1699{ 1699{
1700 ktime_t kmin; 1700 ktime_t kmin;
1701 unsigned long delta; 1701 u64 delta;
1702 1702
1703 kmin = ktime_set(0, min * NSEC_PER_USEC); 1703 kmin = ktime_set(0, min * NSEC_PER_USEC);
1704 delta = (max - min) * NSEC_PER_USEC; 1704 delta = (u64)(max - min) * NSEC_PER_USEC;
1705 schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL); 1705 schedule_hrtimeout_range(&kmin, delta, HRTIMER_MODE_REL);
1706} 1706}
1707 1707
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index b3ace6ebbba3..9acb29f280ec 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -923,6 +923,9 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
923 * both lockup detectors are disabled if proc_watchdog_update() 923 * both lockup detectors are disabled if proc_watchdog_update()
924 * returns an error. 924 * returns an error.
925 */ 925 */
926 if (old == new)
927 goto out;
928
926 err = proc_watchdog_update(); 929 err = proc_watchdog_update();
927 } 930 }
928out: 931out:
@@ -967,7 +970,7 @@ int proc_soft_watchdog(struct ctl_table *table, int write,
967int proc_watchdog_thresh(struct ctl_table *table, int write, 970int proc_watchdog_thresh(struct ctl_table *table, int write,
968 void __user *buffer, size_t *lenp, loff_t *ppos) 971 void __user *buffer, size_t *lenp, loff_t *ppos)
969{ 972{
970 int err, old; 973 int err, old, new;
971 974
972 get_online_cpus(); 975 get_online_cpus();
973 mutex_lock(&watchdog_proc_mutex); 976 mutex_lock(&watchdog_proc_mutex);
@@ -987,6 +990,10 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
987 /* 990 /*
988 * Update the sample period. Restore on failure. 991 * Update the sample period. Restore on failure.
989 */ 992 */
993 new = ACCESS_ONCE(watchdog_thresh);
994 if (old == new)
995 goto out;
996
990 set_sample_period(); 997 set_sample_period();
991 err = proc_watchdog_update(); 998 err = proc_watchdog_update();
992 if (err) { 999 if (err) {