diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 13:31:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-20 13:31:44 -0400 |
commit | 2ba68940c893c8f0bfc8573c041254251bb6aeab (patch) | |
tree | fa83ebb01d32abd98123fa28f9f6f0b3eaeee25d /kernel/printk.c | |
parent | 9c2b957db1772ebf942ae7a9346b14eba6c8ca66 (diff) | |
parent | 600e145882802d6ccbfe2c4aea243d97caeb91a9 (diff) |
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull scheduler changes for v3.4 from Ingo Molnar
* 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (27 commits)
printk: Make it compile with !CONFIG_PRINTK
sched/x86: Fix overflow in cyc2ns_offset
sched: Fix nohz load accounting -- again!
sched: Update yield() docs
printk/sched: Introduce special printk_sched() for those awkward moments
sched/nohz: Correctly initialize 'next_balance' in 'nohz' idle balancer
sched: Cleanup cpu_active madness
sched: Fix load-balance wreckage
sched: Clean up parameter passing of proc_sched_autogroup_set_nice()
sched: Ditch per cgroup task lists for load-balancing
sched: Rename load-balancing fields
sched: Move load-balancing arguments into helper struct
sched/rt: Do not submit new work when PI-blocked
sched/rt: Prevent idle task boosting
sched/wait: Add __wake_up_all_locked() API
sched/rt: Document scheduler related skip-resched-check sites
sched/rt: Use schedule_preempt_disabled()
sched/rt: Add schedule_preempt_disabled()
sched/rt: Do not throttle when PI boosting
sched/rt: Keep period timer ticking when rt throttling is active
...
Diffstat (limited to 'kernel/printk.c')
-rw-r--r-- | kernel/printk.c | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 0b3ea2cbd5fb..b663c2c95d39 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -1216,13 +1216,27 @@ int is_console_locked(void) | |||
1216 | return console_locked; | 1216 | return console_locked; |
1217 | } | 1217 | } |
1218 | 1218 | ||
1219 | /* | ||
1220 | * Delayed printk facility, for scheduler-internal messages: | ||
1221 | */ | ||
1222 | #define PRINTK_BUF_SIZE 512 | ||
1223 | |||
1224 | #define PRINTK_PENDING_WAKEUP 0x01 | ||
1225 | #define PRINTK_PENDING_SCHED 0x02 | ||
1226 | |||
1219 | static DEFINE_PER_CPU(int, printk_pending); | 1227 | static DEFINE_PER_CPU(int, printk_pending); |
1228 | static DEFINE_PER_CPU(char [PRINTK_BUF_SIZE], printk_sched_buf); | ||
1220 | 1229 | ||
1221 | void printk_tick(void) | 1230 | void printk_tick(void) |
1222 | { | 1231 | { |
1223 | if (__this_cpu_read(printk_pending)) { | 1232 | if (__this_cpu_read(printk_pending)) { |
1224 | __this_cpu_write(printk_pending, 0); | 1233 | int pending = __this_cpu_xchg(printk_pending, 0); |
1225 | wake_up_interruptible(&log_wait); | 1234 | if (pending & PRINTK_PENDING_SCHED) { |
1235 | char *buf = __get_cpu_var(printk_sched_buf); | ||
1236 | printk(KERN_WARNING "[sched_delayed] %s", buf); | ||
1237 | } | ||
1238 | if (pending & PRINTK_PENDING_WAKEUP) | ||
1239 | wake_up_interruptible(&log_wait); | ||
1226 | } | 1240 | } |
1227 | } | 1241 | } |
1228 | 1242 | ||
@@ -1236,7 +1250,7 @@ int printk_needs_cpu(int cpu) | |||
1236 | void wake_up_klogd(void) | 1250 | void wake_up_klogd(void) |
1237 | { | 1251 | { |
1238 | if (waitqueue_active(&log_wait)) | 1252 | if (waitqueue_active(&log_wait)) |
1239 | this_cpu_write(printk_pending, 1); | 1253 | this_cpu_or(printk_pending, PRINTK_PENDING_WAKEUP); |
1240 | } | 1254 | } |
1241 | 1255 | ||
1242 | /** | 1256 | /** |
@@ -1629,6 +1643,26 @@ late_initcall(printk_late_init); | |||
1629 | 1643 | ||
1630 | #if defined CONFIG_PRINTK | 1644 | #if defined CONFIG_PRINTK |
1631 | 1645 | ||
1646 | int printk_sched(const char *fmt, ...) | ||
1647 | { | ||
1648 | unsigned long flags; | ||
1649 | va_list args; | ||
1650 | char *buf; | ||
1651 | int r; | ||
1652 | |||
1653 | local_irq_save(flags); | ||
1654 | buf = __get_cpu_var(printk_sched_buf); | ||
1655 | |||
1656 | va_start(args, fmt); | ||
1657 | r = vsnprintf(buf, PRINTK_BUF_SIZE, fmt, args); | ||
1658 | va_end(args); | ||
1659 | |||
1660 | __this_cpu_or(printk_pending, PRINTK_PENDING_SCHED); | ||
1661 | local_irq_restore(flags); | ||
1662 | |||
1663 | return r; | ||
1664 | } | ||
1665 | |||
1632 | /* | 1666 | /* |
1633 | * printk rate limiting, lifted from the networking subsystem. | 1667 | * printk rate limiting, lifted from the networking subsystem. |
1634 | * | 1668 | * |