diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/pid_namespace.c | 6 | ||||
-rw-r--r-- | kernel/time/timekeeping.c | 19 | ||||
-rw-r--r-- | kernel/workqueue.c | 37 |
3 files changed, 35 insertions, 27 deletions
diff --git a/kernel/pid_namespace.c b/kernel/pid_namespace.c index b3c7fd554250..6144bab8fd8e 100644 --- a/kernel/pid_namespace.c +++ b/kernel/pid_namespace.c | |||
@@ -232,15 +232,19 @@ static int pid_ns_ctl_handler(struct ctl_table *table, int write, | |||
232 | */ | 232 | */ |
233 | 233 | ||
234 | tmp.data = ¤t->nsproxy->pid_ns->last_pid; | 234 | tmp.data = ¤t->nsproxy->pid_ns->last_pid; |
235 | return proc_dointvec(&tmp, write, buffer, lenp, ppos); | 235 | return proc_dointvec_minmax(&tmp, write, buffer, lenp, ppos); |
236 | } | 236 | } |
237 | 237 | ||
238 | extern int pid_max; | ||
239 | static int zero = 0; | ||
238 | static struct ctl_table pid_ns_ctl_table[] = { | 240 | static struct ctl_table pid_ns_ctl_table[] = { |
239 | { | 241 | { |
240 | .procname = "ns_last_pid", | 242 | .procname = "ns_last_pid", |
241 | .maxlen = sizeof(int), | 243 | .maxlen = sizeof(int), |
242 | .mode = 0666, /* permissions are checked in the handler */ | 244 | .mode = 0666, /* permissions are checked in the handler */ |
243 | .proc_handler = pid_ns_ctl_handler, | 245 | .proc_handler = pid_ns_ctl_handler, |
246 | .extra1 = &zero, | ||
247 | .extra2 = &pid_max, | ||
244 | }, | 248 | }, |
245 | { } | 249 | { } |
246 | }; | 250 | }; |
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 34e5eac81424..d3b91e75cecd 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c | |||
@@ -303,10 +303,11 @@ void getnstimeofday(struct timespec *ts) | |||
303 | seq = read_seqbegin(&tk->lock); | 303 | seq = read_seqbegin(&tk->lock); |
304 | 304 | ||
305 | ts->tv_sec = tk->xtime_sec; | 305 | ts->tv_sec = tk->xtime_sec; |
306 | ts->tv_nsec = timekeeping_get_ns(tk); | 306 | nsecs = timekeeping_get_ns(tk); |
307 | 307 | ||
308 | } while (read_seqretry(&tk->lock, seq)); | 308 | } while (read_seqretry(&tk->lock, seq)); |
309 | 309 | ||
310 | ts->tv_nsec = 0; | ||
310 | timespec_add_ns(ts, nsecs); | 311 | timespec_add_ns(ts, nsecs); |
311 | } | 312 | } |
312 | EXPORT_SYMBOL(getnstimeofday); | 313 | EXPORT_SYMBOL(getnstimeofday); |
@@ -345,6 +346,7 @@ void ktime_get_ts(struct timespec *ts) | |||
345 | { | 346 | { |
346 | struct timekeeper *tk = &timekeeper; | 347 | struct timekeeper *tk = &timekeeper; |
347 | struct timespec tomono; | 348 | struct timespec tomono; |
349 | s64 nsec; | ||
348 | unsigned int seq; | 350 | unsigned int seq; |
349 | 351 | ||
350 | WARN_ON(timekeeping_suspended); | 352 | WARN_ON(timekeeping_suspended); |
@@ -352,13 +354,14 @@ void ktime_get_ts(struct timespec *ts) | |||
352 | do { | 354 | do { |
353 | seq = read_seqbegin(&tk->lock); | 355 | seq = read_seqbegin(&tk->lock); |
354 | ts->tv_sec = tk->xtime_sec; | 356 | ts->tv_sec = tk->xtime_sec; |
355 | ts->tv_nsec = timekeeping_get_ns(tk); | 357 | nsec = timekeeping_get_ns(tk); |
356 | tomono = tk->wall_to_monotonic; | 358 | tomono = tk->wall_to_monotonic; |
357 | 359 | ||
358 | } while (read_seqretry(&tk->lock, seq)); | 360 | } while (read_seqretry(&tk->lock, seq)); |
359 | 361 | ||
360 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec, | 362 | ts->tv_sec += tomono.tv_sec; |
361 | ts->tv_nsec + tomono.tv_nsec); | 363 | ts->tv_nsec = 0; |
364 | timespec_add_ns(ts, nsec + tomono.tv_nsec); | ||
362 | } | 365 | } |
363 | EXPORT_SYMBOL_GPL(ktime_get_ts); | 366 | EXPORT_SYMBOL_GPL(ktime_get_ts); |
364 | 367 | ||
@@ -1244,6 +1247,7 @@ void get_monotonic_boottime(struct timespec *ts) | |||
1244 | { | 1247 | { |
1245 | struct timekeeper *tk = &timekeeper; | 1248 | struct timekeeper *tk = &timekeeper; |
1246 | struct timespec tomono, sleep; | 1249 | struct timespec tomono, sleep; |
1250 | s64 nsec; | ||
1247 | unsigned int seq; | 1251 | unsigned int seq; |
1248 | 1252 | ||
1249 | WARN_ON(timekeeping_suspended); | 1253 | WARN_ON(timekeeping_suspended); |
@@ -1251,14 +1255,15 @@ void get_monotonic_boottime(struct timespec *ts) | |||
1251 | do { | 1255 | do { |
1252 | seq = read_seqbegin(&tk->lock); | 1256 | seq = read_seqbegin(&tk->lock); |
1253 | ts->tv_sec = tk->xtime_sec; | 1257 | ts->tv_sec = tk->xtime_sec; |
1254 | ts->tv_nsec = timekeeping_get_ns(tk); | 1258 | nsec = timekeeping_get_ns(tk); |
1255 | tomono = tk->wall_to_monotonic; | 1259 | tomono = tk->wall_to_monotonic; |
1256 | sleep = tk->total_sleep_time; | 1260 | sleep = tk->total_sleep_time; |
1257 | 1261 | ||
1258 | } while (read_seqretry(&tk->lock, seq)); | 1262 | } while (read_seqretry(&tk->lock, seq)); |
1259 | 1263 | ||
1260 | set_normalized_timespec(ts, ts->tv_sec + tomono.tv_sec + sleep.tv_sec, | 1264 | ts->tv_sec += tomono.tv_sec + sleep.tv_sec; |
1261 | ts->tv_nsec + tomono.tv_nsec + sleep.tv_nsec); | 1265 | ts->tv_nsec = 0; |
1266 | timespec_add_ns(ts, nsec + tomono.tv_nsec + sleep.tv_nsec); | ||
1262 | } | 1267 | } |
1263 | EXPORT_SYMBOL_GPL(get_monotonic_boottime); | 1268 | EXPORT_SYMBOL_GPL(get_monotonic_boottime); |
1264 | 1269 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 1e1373bcb3e3..3c5a79e2134c 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -1349,8 +1349,16 @@ static void busy_worker_rebind_fn(struct work_struct *work) | |||
1349 | struct worker *worker = container_of(work, struct worker, rebind_work); | 1349 | struct worker *worker = container_of(work, struct worker, rebind_work); |
1350 | struct global_cwq *gcwq = worker->pool->gcwq; | 1350 | struct global_cwq *gcwq = worker->pool->gcwq; |
1351 | 1351 | ||
1352 | if (worker_maybe_bind_and_lock(worker)) | 1352 | worker_maybe_bind_and_lock(worker); |
1353 | worker_clr_flags(worker, WORKER_REBIND); | 1353 | |
1354 | /* | ||
1355 | * %WORKER_REBIND must be cleared even if the above binding failed; | ||
1356 | * otherwise, we may confuse the next CPU_UP cycle or oops / get | ||
1357 | * stuck by calling idle_worker_rebind() prematurely. If CPU went | ||
1358 | * down again inbetween, %WORKER_UNBOUND would be set, so clearing | ||
1359 | * %WORKER_REBIND is always safe. | ||
1360 | */ | ||
1361 | worker_clr_flags(worker, WORKER_REBIND); | ||
1354 | 1362 | ||
1355 | spin_unlock_irq(&gcwq->lock); | 1363 | spin_unlock_irq(&gcwq->lock); |
1356 | } | 1364 | } |
@@ -3568,18 +3576,17 @@ static int __devinit workqueue_cpu_down_callback(struct notifier_block *nfb, | |||
3568 | #ifdef CONFIG_SMP | 3576 | #ifdef CONFIG_SMP |
3569 | 3577 | ||
3570 | struct work_for_cpu { | 3578 | struct work_for_cpu { |
3571 | struct completion completion; | 3579 | struct work_struct work; |
3572 | long (*fn)(void *); | 3580 | long (*fn)(void *); |
3573 | void *arg; | 3581 | void *arg; |
3574 | long ret; | 3582 | long ret; |
3575 | }; | 3583 | }; |
3576 | 3584 | ||
3577 | static int do_work_for_cpu(void *_wfc) | 3585 | static void work_for_cpu_fn(struct work_struct *work) |
3578 | { | 3586 | { |
3579 | struct work_for_cpu *wfc = _wfc; | 3587 | struct work_for_cpu *wfc = container_of(work, struct work_for_cpu, work); |
3588 | |||
3580 | wfc->ret = wfc->fn(wfc->arg); | 3589 | wfc->ret = wfc->fn(wfc->arg); |
3581 | complete(&wfc->completion); | ||
3582 | return 0; | ||
3583 | } | 3590 | } |
3584 | 3591 | ||
3585 | /** | 3592 | /** |
@@ -3594,19 +3601,11 @@ static int do_work_for_cpu(void *_wfc) | |||
3594 | */ | 3601 | */ |
3595 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) | 3602 | long work_on_cpu(unsigned int cpu, long (*fn)(void *), void *arg) |
3596 | { | 3603 | { |
3597 | struct task_struct *sub_thread; | 3604 | struct work_for_cpu wfc = { .fn = fn, .arg = arg }; |
3598 | struct work_for_cpu wfc = { | ||
3599 | .completion = COMPLETION_INITIALIZER_ONSTACK(wfc.completion), | ||
3600 | .fn = fn, | ||
3601 | .arg = arg, | ||
3602 | }; | ||
3603 | 3605 | ||
3604 | sub_thread = kthread_create(do_work_for_cpu, &wfc, "work_for_cpu"); | 3606 | INIT_WORK_ONSTACK(&wfc.work, work_for_cpu_fn); |
3605 | if (IS_ERR(sub_thread)) | 3607 | schedule_work_on(cpu, &wfc.work); |
3606 | return PTR_ERR(sub_thread); | 3608 | flush_work(&wfc.work); |
3607 | kthread_bind(sub_thread, cpu); | ||
3608 | wake_up_process(sub_thread); | ||
3609 | wait_for_completion(&wfc.completion); | ||
3610 | return wfc.ret; | 3609 | return wfc.ret; |
3611 | } | 3610 | } |
3612 | EXPORT_SYMBOL_GPL(work_on_cpu); | 3611 | EXPORT_SYMBOL_GPL(work_on_cpu); |