aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cpu.c2
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/perf_event.c40
-rw-r--r--kernel/posix-timers.c11
-rw-r--r--kernel/sched.c17
-rw-r--r--kernel/timer.c10
7 files changed, 52 insertions, 34 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 3097382eb44a..8b92539b4754 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -394,7 +394,7 @@ static cpumask_var_t frozen_cpus;
394 394
395int disable_nonboot_cpus(void) 395int disable_nonboot_cpus(void)
396{ 396{
397 int cpu, first_cpu, error; 397 int cpu, first_cpu, error = 0;
398 398
399 cpu_maps_update_begin(); 399 cpu_maps_update_begin();
400 first_cpu = cpumask_first(cpu_online_mask); 400 first_cpu = cpumask_first(cpu_online_mask);
diff --git a/kernel/fork.c b/kernel/fork.c
index bf9fef6d1bfe..b6cce14ba047 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1086,10 +1086,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1086 } 1086 }
1087 mpol_fix_fork_child_flag(p); 1087 mpol_fix_fork_child_flag(p);
1088#endif 1088#endif
1089#ifdef CONFIG_CPUSETS
1090 p->cpuset_mem_spread_rotor = node_random(p->mems_allowed);
1091 p->cpuset_slab_spread_rotor = node_random(p->mems_allowed);
1092#endif
1093#ifdef CONFIG_TRACE_IRQFLAGS 1089#ifdef CONFIG_TRACE_IRQFLAGS
1094 p->irq_events = 0; 1090 p->irq_events = 0;
1095#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW 1091#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index b9b134b35088..5c69e996bd0f 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -89,7 +89,7 @@ static void hrtimer_get_softirq_time(struct hrtimer_cpu_base *base)
89 89
90 do { 90 do {
91 seq = read_seqbegin(&xtime_lock); 91 seq = read_seqbegin(&xtime_lock);
92 xts = current_kernel_time(); 92 xts = __current_kernel_time();
93 tom = wall_to_monotonic; 93 tom = wall_to_monotonic;
94 } while (read_seqretry(&xtime_lock, seq)); 94 } while (read_seqretry(&xtime_lock, seq));
95 95
diff --git a/kernel/perf_event.c b/kernel/perf_event.c
index e099650cd249..bd7ce8ca5bb9 100644
--- a/kernel/perf_event.c
+++ b/kernel/perf_event.c
@@ -4999,8 +4999,8 @@ SYSCALL_DEFINE5(perf_event_open,
4999 struct perf_event_context *ctx; 4999 struct perf_event_context *ctx;
5000 struct file *event_file = NULL; 5000 struct file *event_file = NULL;
5001 struct file *group_file = NULL; 5001 struct file *group_file = NULL;
5002 int event_fd;
5002 int fput_needed = 0; 5003 int fput_needed = 0;
5003 int fput_needed2 = 0;
5004 int err; 5004 int err;
5005 5005
5006 /* for future expandability... */ 5006 /* for future expandability... */
@@ -5021,12 +5021,18 @@ SYSCALL_DEFINE5(perf_event_open,
5021 return -EINVAL; 5021 return -EINVAL;
5022 } 5022 }
5023 5023
5024 event_fd = get_unused_fd_flags(O_RDWR);
5025 if (event_fd < 0)
5026 return event_fd;
5027
5024 /* 5028 /*
5025 * Get the target context (task or percpu): 5029 * Get the target context (task or percpu):
5026 */ 5030 */
5027 ctx = find_get_context(pid, cpu); 5031 ctx = find_get_context(pid, cpu);
5028 if (IS_ERR(ctx)) 5032 if (IS_ERR(ctx)) {
5029 return PTR_ERR(ctx); 5033 err = PTR_ERR(ctx);
5034 goto err_fd;
5035 }
5030 5036
5031 /* 5037 /*
5032 * Look up the group leader (we will attach this event to it): 5038 * Look up the group leader (we will attach this event to it):
@@ -5066,13 +5072,11 @@ SYSCALL_DEFINE5(perf_event_open,
5066 if (IS_ERR(event)) 5072 if (IS_ERR(event))
5067 goto err_put_context; 5073 goto err_put_context;
5068 5074
5069 err = anon_inode_getfd("[perf_event]", &perf_fops, event, O_RDWR); 5075 event_file = anon_inode_getfile("[perf_event]", &perf_fops, event, O_RDWR);
5070 if (err < 0) 5076 if (IS_ERR(event_file)) {
5071 goto err_free_put_context; 5077 err = PTR_ERR(event_file);
5072
5073 event_file = fget_light(err, &fput_needed2);
5074 if (!event_file)
5075 goto err_free_put_context; 5078 goto err_free_put_context;
5079 }
5076 5080
5077 if (flags & PERF_FLAG_FD_OUTPUT) { 5081 if (flags & PERF_FLAG_FD_OUTPUT) {
5078 err = perf_event_set_output(event, group_fd); 5082 err = perf_event_set_output(event, group_fd);
@@ -5093,19 +5097,19 @@ SYSCALL_DEFINE5(perf_event_open,
5093 list_add_tail(&event->owner_entry, &current->perf_event_list); 5097 list_add_tail(&event->owner_entry, &current->perf_event_list);
5094 mutex_unlock(&current->perf_event_mutex); 5098 mutex_unlock(&current->perf_event_mutex);
5095 5099
5096err_fput_free_put_context: 5100 fput_light(group_file, fput_needed);
5097 fput_light(event_file, fput_needed2); 5101 fd_install(event_fd, event_file);
5102 return event_fd;
5098 5103
5104err_fput_free_put_context:
5105 fput(event_file);
5099err_free_put_context: 5106err_free_put_context:
5100 if (err < 0) 5107 free_event(event);
5101 free_event(event);
5102
5103err_put_context: 5108err_put_context:
5104 if (err < 0)
5105 put_ctx(ctx);
5106
5107 fput_light(group_file, fput_needed); 5109 fput_light(group_file, fput_needed);
5108 5110 put_ctx(ctx);
5111err_fd:
5112 put_unused_fd(event_fd);
5109 return err; 5113 return err;
5110} 5114}
5111 5115
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 00d1fda58ab6..ad723420acc3 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -559,14 +559,7 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
559 new_timer->it_id = (timer_t) new_timer_id; 559 new_timer->it_id = (timer_t) new_timer_id;
560 new_timer->it_clock = which_clock; 560 new_timer->it_clock = which_clock;
561 new_timer->it_overrun = -1; 561 new_timer->it_overrun = -1;
562 error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));
563 if (error)
564 goto out;
565 562
566 /*
567 * return the timer_id now. The next step is hard to
568 * back out if there is an error.
569 */
570 if (copy_to_user(created_timer_id, 563 if (copy_to_user(created_timer_id,
571 &new_timer_id, sizeof (new_timer_id))) { 564 &new_timer_id, sizeof (new_timer_id))) {
572 error = -EFAULT; 565 error = -EFAULT;
@@ -597,6 +590,10 @@ SYSCALL_DEFINE3(timer_create, const clockid_t, which_clock,
597 new_timer->sigq->info.si_tid = new_timer->it_id; 590 new_timer->sigq->info.si_tid = new_timer->it_id;
598 new_timer->sigq->info.si_code = SI_TIMER; 591 new_timer->sigq->info.si_code = SI_TIMER;
599 592
593 error = CLOCK_DISPATCH(which_clock, timer_create, (new_timer));
594 if (error)
595 goto out;
596
600 spin_lock_irq(&current->sighand->siglock); 597 spin_lock_irq(&current->sighand->siglock);
601 new_timer->it_signal = current->signal; 598 new_timer->it_signal = current->signal;
602 list_add(&new_timer->list, &current->signal->posix_timers); 599 list_add(&new_timer->list, &current->signal->posix_timers);
diff --git a/kernel/sched.c b/kernel/sched.c
index 15b93f617fd7..d48408142503 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -4054,6 +4054,23 @@ int __sched wait_for_completion_killable(struct completion *x)
4054EXPORT_SYMBOL(wait_for_completion_killable); 4054EXPORT_SYMBOL(wait_for_completion_killable);
4055 4055
4056/** 4056/**
4057 * wait_for_completion_killable_timeout: - waits for completion of a task (w/(to,killable))
4058 * @x: holds the state of this particular completion
4059 * @timeout: timeout value in jiffies
4060 *
4061 * This waits for either a completion of a specific task to be
4062 * signaled or for a specified timeout to expire. It can be
4063 * interrupted by a kill signal. The timeout is in jiffies.
4064 */
4065unsigned long __sched
4066wait_for_completion_killable_timeout(struct completion *x,
4067 unsigned long timeout)
4068{
4069 return wait_for_common(x, timeout, TASK_KILLABLE);
4070}
4071EXPORT_SYMBOL(wait_for_completion_killable_timeout);
4072
4073/**
4057 * try_wait_for_completion - try to decrement a completion without blocking 4074 * try_wait_for_completion - try to decrement a completion without blocking
4058 * @x: completion structure 4075 * @x: completion structure
4059 * 4076 *
diff --git a/kernel/timer.c b/kernel/timer.c
index e3b8c697bde4..2454172a80d3 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -752,11 +752,15 @@ unsigned long apply_slack(struct timer_list *timer, unsigned long expires)
752 752
753 expires_limit = expires; 753 expires_limit = expires;
754 754
755 if (timer->slack > -1) 755 if (timer->slack >= 0) {
756 expires_limit = expires + timer->slack; 756 expires_limit = expires + timer->slack;
757 else if (time_after(expires, jiffies)) /* auto slack: use 0.4% */ 757 } else {
758 expires_limit = expires + (expires - jiffies)/256; 758 unsigned long now = jiffies;
759 759
760 /* No slack, if already expired else auto slack 0.4% */
761 if (time_after(expires, now))
762 expires_limit = expires + (expires - now)/256;
763 }
760 mask = expires ^ expires_limit; 764 mask = expires ^ expires_limit;
761 if (mask == 0) 765 if (mask == 0)
762 return expires; 766 return expires;