diff options
author | Tony Luck <tony.luck@intel.com> | 2005-10-20 13:41:44 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2005-10-20 13:41:44 -0400 |
commit | 9cec58dc138d6fcad9f447a19c8ff69f6540e667 (patch) | |
tree | 4fe1cca94fdba8b705c87615bee06d3346f687ce /kernel | |
parent | 17e5ad6c0ce5a970e2830d0de8bdd60a2f077d38 (diff) | |
parent | ac9b9c667c2e1194e22ebe0a441ae1c37aaa9b90 (diff) |
Update from upstream with manual merge of Yasunori Goto's
changes to swiotlb.c made in commit 281dd25cdc0d6903929b79183816d151ea626341
since this file has been moved from arch/ia64/lib/swiotlb.c to
lib/swiotlb.c
Signed-off-by: Tony Luck <tony.luck@intel.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 2 | ||||
-rw-r--r-- | kernel/cpuset.c | 13 | ||||
-rw-r--r-- | kernel/exit.c | 8 | ||||
-rw-r--r-- | kernel/fork.c | 5 | ||||
-rw-r--r-- | kernel/kfifo.c | 4 | ||||
-rw-r--r-- | kernel/params.c | 10 | ||||
-rw-r--r-- | kernel/posix-cpu-timers.c | 31 | ||||
-rw-r--r-- | kernel/power/Kconfig | 2 | ||||
-rw-r--r-- | kernel/power/disk.c | 6 | ||||
-rw-r--r-- | kernel/power/power.h | 7 | ||||
-rw-r--r-- | kernel/power/swsusp.c | 36 | ||||
-rw-r--r-- | kernel/printk.c | 7 | ||||
-rw-r--r-- | kernel/rcupdate.c | 13 | ||||
-rw-r--r-- | kernel/signal.c | 73 | ||||
-rw-r--r-- | kernel/sys.c | 55 | ||||
-rw-r--r-- | kernel/time.c | 1 |
16 files changed, 186 insertions, 87 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 83096b67510a..aefa73a8a586 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -560,7 +560,7 @@ static void audit_buffer_free(struct audit_buffer *ab) | |||
560 | } | 560 | } |
561 | 561 | ||
562 | static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx, | 562 | static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx, |
563 | unsigned int __nocast gfp_mask, int type) | 563 | gfp_t gfp_mask, int type) |
564 | { | 564 | { |
565 | unsigned long flags; | 565 | unsigned long flags; |
566 | struct audit_buffer *ab = NULL; | 566 | struct audit_buffer *ab = NULL; |
diff --git a/kernel/cpuset.c b/kernel/cpuset.c index 79866bc6b3a1..28176d083f7b 100644 --- a/kernel/cpuset.c +++ b/kernel/cpuset.c | |||
@@ -968,8 +968,6 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf, | |||
968 | char *page; | 968 | char *page; |
969 | ssize_t retval = 0; | 969 | ssize_t retval = 0; |
970 | char *s; | 970 | char *s; |
971 | char *start; | ||
972 | size_t n; | ||
973 | 971 | ||
974 | if (!(page = (char *)__get_free_page(GFP_KERNEL))) | 972 | if (!(page = (char *)__get_free_page(GFP_KERNEL))) |
975 | return -ENOMEM; | 973 | return -ENOMEM; |
@@ -999,14 +997,7 @@ static ssize_t cpuset_common_file_read(struct file *file, char __user *buf, | |||
999 | *s++ = '\n'; | 997 | *s++ = '\n'; |
1000 | *s = '\0'; | 998 | *s = '\0'; |
1001 | 999 | ||
1002 | /* Do nothing if *ppos is at the eof or beyond the eof. */ | 1000 | retval = simple_read_from_buffer(buf, nbytes, ppos, page, s - page); |
1003 | if (s - page <= *ppos) | ||
1004 | return 0; | ||
1005 | |||
1006 | start = page + *ppos; | ||
1007 | n = s - start; | ||
1008 | retval = n - copy_to_user(buf, start, min(n, nbytes)); | ||
1009 | *ppos += retval; | ||
1010 | out: | 1001 | out: |
1011 | free_page((unsigned long)page); | 1002 | free_page((unsigned long)page); |
1012 | return retval; | 1003 | return retval; |
@@ -1679,7 +1670,7 @@ static const struct cpuset *nearest_exclusive_ancestor(const struct cpuset *cs) | |||
1679 | * GFP_USER - only nodes in current tasks mems allowed ok. | 1670 | * GFP_USER - only nodes in current tasks mems allowed ok. |
1680 | **/ | 1671 | **/ |
1681 | 1672 | ||
1682 | int cpuset_zone_allowed(struct zone *z, unsigned int __nocast gfp_mask) | 1673 | int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask) |
1683 | { | 1674 | { |
1684 | int node; /* node that zone z is on */ | 1675 | int node; /* node that zone z is on */ |
1685 | const struct cpuset *cs; /* current cpuset ancestors */ | 1676 | const struct cpuset *cs; /* current cpuset ancestors */ |
diff --git a/kernel/exit.c b/kernel/exit.c index 6d2089a1bce7..43077732619b 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -371,6 +371,12 @@ static inline void close_files(struct files_struct * files) | |||
371 | struct fdtable *fdt; | 371 | struct fdtable *fdt; |
372 | 372 | ||
373 | j = 0; | 373 | j = 0; |
374 | |||
375 | /* | ||
376 | * It is safe to dereference the fd table without RCU or | ||
377 | * ->file_lock because this is the last reference to the | ||
378 | * files structure. | ||
379 | */ | ||
374 | fdt = files_fdtable(files); | 380 | fdt = files_fdtable(files); |
375 | for (;;) { | 381 | for (;;) { |
376 | unsigned long set; | 382 | unsigned long set; |
@@ -1197,7 +1203,7 @@ static int wait_task_stopped(task_t *p, int delayed_group_leader, int noreap, | |||
1197 | 1203 | ||
1198 | exit_code = p->exit_code; | 1204 | exit_code = p->exit_code; |
1199 | if (unlikely(!exit_code) || | 1205 | if (unlikely(!exit_code) || |
1200 | unlikely(p->state > TASK_STOPPED)) | 1206 | unlikely(p->state & TASK_TRACED)) |
1201 | goto bail_ref; | 1207 | goto bail_ref; |
1202 | return wait_noreap_copyout(p, pid, uid, | 1208 | return wait_noreap_copyout(p, pid, uid, |
1203 | why, (exit_code << 8) | 0x7f, | 1209 | why, (exit_code << 8) | 0x7f, |
diff --git a/kernel/fork.c b/kernel/fork.c index 8149f3602881..280bd44ac441 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -848,7 +848,7 @@ static inline void copy_flags(unsigned long clone_flags, struct task_struct *p) | |||
848 | { | 848 | { |
849 | unsigned long new_flags = p->flags; | 849 | unsigned long new_flags = p->flags; |
850 | 850 | ||
851 | new_flags &= ~PF_SUPERPRIV; | 851 | new_flags &= ~(PF_SUPERPRIV | PF_NOFREEZE); |
852 | new_flags |= PF_FORKNOEXEC; | 852 | new_flags |= PF_FORKNOEXEC; |
853 | if (!(clone_flags & CLONE_PTRACE)) | 853 | if (!(clone_flags & CLONE_PTRACE)) |
854 | p->ptrace = 0; | 854 | p->ptrace = 0; |
@@ -1062,7 +1062,8 @@ static task_t *copy_process(unsigned long clone_flags, | |||
1062 | * parent's CPU). This avoids alot of nasty races. | 1062 | * parent's CPU). This avoids alot of nasty races. |
1063 | */ | 1063 | */ |
1064 | p->cpus_allowed = current->cpus_allowed; | 1064 | p->cpus_allowed = current->cpus_allowed; |
1065 | if (unlikely(!cpu_isset(task_cpu(p), p->cpus_allowed))) | 1065 | if (unlikely(!cpu_isset(task_cpu(p), p->cpus_allowed) || |
1066 | !cpu_online(task_cpu(p)))) | ||
1066 | set_task_cpu(p, smp_processor_id()); | 1067 | set_task_cpu(p, smp_processor_id()); |
1067 | 1068 | ||
1068 | /* | 1069 | /* |
diff --git a/kernel/kfifo.c b/kernel/kfifo.c index 179baafcdd96..64ab045c3d9d 100644 --- a/kernel/kfifo.c +++ b/kernel/kfifo.c | |||
@@ -36,7 +36,7 @@ | |||
36 | * struct kfifo with kfree(). | 36 | * struct kfifo with kfree(). |
37 | */ | 37 | */ |
38 | struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, | 38 | struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, |
39 | unsigned int __nocast gfp_mask, spinlock_t *lock) | 39 | gfp_t gfp_mask, spinlock_t *lock) |
40 | { | 40 | { |
41 | struct kfifo *fifo; | 41 | struct kfifo *fifo; |
42 | 42 | ||
@@ -64,7 +64,7 @@ EXPORT_SYMBOL(kfifo_init); | |||
64 | * | 64 | * |
65 | * The size will be rounded-up to a power of 2. | 65 | * The size will be rounded-up to a power of 2. |
66 | */ | 66 | */ |
67 | struct kfifo *kfifo_alloc(unsigned int size, unsigned int __nocast gfp_mask, spinlock_t *lock) | 67 | struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, spinlock_t *lock) |
68 | { | 68 | { |
69 | unsigned char *buffer; | 69 | unsigned char *buffer; |
70 | struct kfifo *ret; | 70 | struct kfifo *ret; |
diff --git a/kernel/params.c b/kernel/params.c index fbf173215fd2..1a8614bac5d5 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -80,8 +80,6 @@ static char *next_arg(char *args, char **param, char **val) | |||
80 | int in_quote = 0, quoted = 0; | 80 | int in_quote = 0, quoted = 0; |
81 | char *next; | 81 | char *next; |
82 | 82 | ||
83 | /* Chew any extra spaces */ | ||
84 | while (*args == ' ') args++; | ||
85 | if (*args == '"') { | 83 | if (*args == '"') { |
86 | args++; | 84 | args++; |
87 | in_quote = 1; | 85 | in_quote = 1; |
@@ -121,6 +119,10 @@ static char *next_arg(char *args, char **param, char **val) | |||
121 | next = args + i + 1; | 119 | next = args + i + 1; |
122 | } else | 120 | } else |
123 | next = args + i; | 121 | next = args + i; |
122 | |||
123 | /* Chew up trailing spaces. */ | ||
124 | while (*next == ' ') | ||
125 | next++; | ||
124 | return next; | 126 | return next; |
125 | } | 127 | } |
126 | 128 | ||
@@ -135,6 +137,10 @@ int parse_args(const char *name, | |||
135 | 137 | ||
136 | DEBUGP("Parsing ARGS: %s\n", args); | 138 | DEBUGP("Parsing ARGS: %s\n", args); |
137 | 139 | ||
140 | /* Chew leading spaces */ | ||
141 | while (*args == ' ') | ||
142 | args++; | ||
143 | |||
138 | while (*args) { | 144 | while (*args) { |
139 | int ret; | 145 | int ret; |
140 | 146 | ||
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c index ad85d3f0dcc4..b3f3edc475de 100644 --- a/kernel/posix-cpu-timers.c +++ b/kernel/posix-cpu-timers.c | |||
@@ -387,25 +387,19 @@ int posix_cpu_timer_del(struct k_itimer *timer) | |||
387 | if (unlikely(p == NULL)) | 387 | if (unlikely(p == NULL)) |
388 | return 0; | 388 | return 0; |
389 | 389 | ||
390 | spin_lock(&p->sighand->siglock); | ||
390 | if (!list_empty(&timer->it.cpu.entry)) { | 391 | if (!list_empty(&timer->it.cpu.entry)) { |
391 | read_lock(&tasklist_lock); | 392 | /* |
392 | if (unlikely(p->signal == NULL)) { | 393 | * Take us off the task's timer list. We don't need to |
393 | /* | 394 | * take tasklist_lock and check for the task being reaped. |
394 | * We raced with the reaping of the task. | 395 | * If it was reaped, it already called posix_cpu_timers_exit |
395 | * The deletion should have cleared us off the list. | 396 | * and posix_cpu_timers_exit_group to clear all the timers |
396 | */ | 397 | * that pointed to it. |
397 | BUG_ON(!list_empty(&timer->it.cpu.entry)); | 398 | */ |
398 | } else { | 399 | list_del(&timer->it.cpu.entry); |
399 | /* | 400 | put_task_struct(p); |
400 | * Take us off the task's timer list. | ||
401 | */ | ||
402 | spin_lock(&p->sighand->siglock); | ||
403 | list_del(&timer->it.cpu.entry); | ||
404 | spin_unlock(&p->sighand->siglock); | ||
405 | } | ||
406 | read_unlock(&tasklist_lock); | ||
407 | } | 401 | } |
408 | put_task_struct(p); | 402 | spin_unlock(&p->sighand->siglock); |
409 | 403 | ||
410 | return 0; | 404 | return 0; |
411 | } | 405 | } |
@@ -424,6 +418,7 @@ static void cleanup_timers(struct list_head *head, | |||
424 | cputime_t ptime = cputime_add(utime, stime); | 418 | cputime_t ptime = cputime_add(utime, stime); |
425 | 419 | ||
426 | list_for_each_entry_safe(timer, next, head, entry) { | 420 | list_for_each_entry_safe(timer, next, head, entry) { |
421 | put_task_struct(timer->task); | ||
427 | timer->task = NULL; | 422 | timer->task = NULL; |
428 | list_del_init(&timer->entry); | 423 | list_del_init(&timer->entry); |
429 | if (cputime_lt(timer->expires.cpu, ptime)) { | 424 | if (cputime_lt(timer->expires.cpu, ptime)) { |
@@ -436,6 +431,7 @@ static void cleanup_timers(struct list_head *head, | |||
436 | 431 | ||
437 | ++head; | 432 | ++head; |
438 | list_for_each_entry_safe(timer, next, head, entry) { | 433 | list_for_each_entry_safe(timer, next, head, entry) { |
434 | put_task_struct(timer->task); | ||
439 | timer->task = NULL; | 435 | timer->task = NULL; |
440 | list_del_init(&timer->entry); | 436 | list_del_init(&timer->entry); |
441 | if (cputime_lt(timer->expires.cpu, utime)) { | 437 | if (cputime_lt(timer->expires.cpu, utime)) { |
@@ -448,6 +444,7 @@ static void cleanup_timers(struct list_head *head, | |||
448 | 444 | ||
449 | ++head; | 445 | ++head; |
450 | list_for_each_entry_safe(timer, next, head, entry) { | 446 | list_for_each_entry_safe(timer, next, head, entry) { |
447 | put_task_struct(timer->task); | ||
451 | timer->task = NULL; | 448 | timer->task = NULL; |
452 | list_del_init(&timer->entry); | 449 | list_del_init(&timer->entry); |
453 | if (timer->expires.sched < sched_time) { | 450 | if (timer->expires.sched < sched_time) { |
diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 396c7873e804..46a5e5acff97 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig | |||
@@ -29,7 +29,7 @@ config PM_DEBUG | |||
29 | 29 | ||
30 | config SOFTWARE_SUSPEND | 30 | config SOFTWARE_SUSPEND |
31 | bool "Software Suspend" | 31 | bool "Software Suspend" |
32 | depends on PM && SWAP && (X86 || ((FVR || PPC32) && !SMP)) | 32 | depends on PM && SWAP && (X86 && (!SMP || SUSPEND_SMP)) || ((FVR || PPC32) && !SMP) |
33 | ---help--- | 33 | ---help--- |
34 | Enable the possibility of suspending the machine. | 34 | Enable the possibility of suspending the machine. |
35 | It doesn't need APM. | 35 | It doesn't need APM. |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 2d8bf054d036..761956e813f5 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -17,12 +17,12 @@ | |||
17 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
18 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
19 | #include <linux/mount.h> | 19 | #include <linux/mount.h> |
20 | #include <linux/pm.h> | ||
20 | 21 | ||
21 | #include "power.h" | 22 | #include "power.h" |
22 | 23 | ||
23 | 24 | ||
24 | extern suspend_disk_method_t pm_disk_mode; | 25 | extern suspend_disk_method_t pm_disk_mode; |
25 | extern struct pm_ops * pm_ops; | ||
26 | 26 | ||
27 | extern int swsusp_suspend(void); | 27 | extern int swsusp_suspend(void); |
28 | extern int swsusp_write(void); | 28 | extern int swsusp_write(void); |
@@ -49,13 +49,11 @@ dev_t swsusp_resume_device; | |||
49 | 49 | ||
50 | static void power_down(suspend_disk_method_t mode) | 50 | static void power_down(suspend_disk_method_t mode) |
51 | { | 51 | { |
52 | unsigned long flags; | ||
53 | int error = 0; | 52 | int error = 0; |
54 | 53 | ||
55 | local_irq_save(flags); | ||
56 | switch(mode) { | 54 | switch(mode) { |
57 | case PM_DISK_PLATFORM: | 55 | case PM_DISK_PLATFORM: |
58 | device_shutdown(); | 56 | kernel_power_off_prepare(); |
59 | error = pm_ops->enter(PM_SUSPEND_DISK); | 57 | error = pm_ops->enter(PM_SUSPEND_DISK); |
60 | break; | 58 | break; |
61 | case PM_DISK_SHUTDOWN: | 59 | case PM_DISK_SHUTDOWN: |
diff --git a/kernel/power/power.h b/kernel/power/power.h index cd6a3493cc0d..6748de23e83c 100644 --- a/kernel/power/power.h +++ b/kernel/power/power.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #include <linux/suspend.h> | 1 | #include <linux/suspend.h> |
2 | #include <linux/utsname.h> | 2 | #include <linux/utsname.h> |
3 | 3 | ||
4 | /* With SUSPEND_CONSOLE defined, it suspend looks *really* cool, but | 4 | /* With SUSPEND_CONSOLE defined suspend looks *really* cool, but |
5 | we probably do not take enough locks for switching consoles, etc, | 5 | we probably do not take enough locks for switching consoles, etc, |
6 | so bad things might happen. | 6 | so bad things might happen. |
7 | */ | 7 | */ |
@@ -9,6 +9,9 @@ | |||
9 | #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) | 9 | #define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1) |
10 | #endif | 10 | #endif |
11 | 11 | ||
12 | #define MAX_PBES ((PAGE_SIZE - sizeof(struct new_utsname) \ | ||
13 | - 4 - 3*sizeof(unsigned long) - sizeof(int) \ | ||
14 | - sizeof(void *)) / sizeof(swp_entry_t)) | ||
12 | 15 | ||
13 | struct swsusp_info { | 16 | struct swsusp_info { |
14 | struct new_utsname uts; | 17 | struct new_utsname uts; |
@@ -18,7 +21,7 @@ struct swsusp_info { | |||
18 | unsigned long image_pages; | 21 | unsigned long image_pages; |
19 | unsigned long pagedir_pages; | 22 | unsigned long pagedir_pages; |
20 | suspend_pagedir_t * suspend_pagedir; | 23 | suspend_pagedir_t * suspend_pagedir; |
21 | swp_entry_t pagedir[768]; | 24 | swp_entry_t pagedir[MAX_PBES]; |
22 | } __attribute__((aligned(PAGE_SIZE))); | 25 | } __attribute__((aligned(PAGE_SIZE))); |
23 | 26 | ||
24 | 27 | ||
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index d967e875ee82..2d5c45676442 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
@@ -363,7 +363,7 @@ static void lock_swapdevices(void) | |||
363 | } | 363 | } |
364 | 364 | ||
365 | /** | 365 | /** |
366 | * write_swap_page - Write one page to a fresh swap location. | 366 | * write_page - Write one page to a fresh swap location. |
367 | * @addr: Address we're writing. | 367 | * @addr: Address we're writing. |
368 | * @loc: Place to store the entry we used. | 368 | * @loc: Place to store the entry we used. |
369 | * | 369 | * |
@@ -402,15 +402,14 @@ static int write_page(unsigned long addr, swp_entry_t * loc) | |||
402 | static void data_free(void) | 402 | static void data_free(void) |
403 | { | 403 | { |
404 | swp_entry_t entry; | 404 | swp_entry_t entry; |
405 | int i; | 405 | struct pbe * p; |
406 | 406 | ||
407 | for (i = 0; i < nr_copy_pages; i++) { | 407 | for_each_pbe(p, pagedir_nosave) { |
408 | entry = (pagedir_nosave + i)->swap_address; | 408 | entry = p->swap_address; |
409 | if (entry.val) | 409 | if (entry.val) |
410 | swap_free(entry); | 410 | swap_free(entry); |
411 | else | 411 | else |
412 | break; | 412 | break; |
413 | (pagedir_nosave + i)->swap_address = (swp_entry_t){0}; | ||
414 | } | 413 | } |
415 | } | 414 | } |
416 | 415 | ||
@@ -863,6 +862,9 @@ static int alloc_image_pages(void) | |||
863 | return 0; | 862 | return 0; |
864 | } | 863 | } |
865 | 864 | ||
865 | /* Free pages we allocated for suspend. Suspend pages are alocated | ||
866 | * before atomic copy, so we need to free them after resume. | ||
867 | */ | ||
866 | void swsusp_free(void) | 868 | void swsusp_free(void) |
867 | { | 869 | { |
868 | BUG_ON(PageNosave(virt_to_page(pagedir_save))); | 870 | BUG_ON(PageNosave(virt_to_page(pagedir_save))); |
@@ -918,6 +920,7 @@ static int swsusp_alloc(void) | |||
918 | 920 | ||
919 | pagedir_nosave = NULL; | 921 | pagedir_nosave = NULL; |
920 | nr_copy_pages = calc_nr(nr_copy_pages); | 922 | nr_copy_pages = calc_nr(nr_copy_pages); |
923 | nr_copy_pages_check = nr_copy_pages; | ||
921 | 924 | ||
922 | pr_debug("suspend: (pages needed: %d + %d free: %d)\n", | 925 | pr_debug("suspend: (pages needed: %d + %d free: %d)\n", |
923 | nr_copy_pages, PAGES_FOR_IO, nr_free_pages()); | 926 | nr_copy_pages, PAGES_FOR_IO, nr_free_pages()); |
@@ -928,6 +931,10 @@ static int swsusp_alloc(void) | |||
928 | if (!enough_swap()) | 931 | if (!enough_swap()) |
929 | return -ENOSPC; | 932 | return -ENOSPC; |
930 | 933 | ||
934 | if (MAX_PBES < nr_copy_pages / PBES_PER_PAGE + | ||
935 | !!(nr_copy_pages % PBES_PER_PAGE)) | ||
936 | return -ENOSPC; | ||
937 | |||
931 | if (!(pagedir_save = alloc_pagedir(nr_copy_pages))) { | 938 | if (!(pagedir_save = alloc_pagedir(nr_copy_pages))) { |
932 | printk(KERN_ERR "suspend: Allocating pagedir failed.\n"); | 939 | printk(KERN_ERR "suspend: Allocating pagedir failed.\n"); |
933 | return -ENOMEM; | 940 | return -ENOMEM; |
@@ -940,7 +947,6 @@ static int swsusp_alloc(void) | |||
940 | return error; | 947 | return error; |
941 | } | 948 | } |
942 | 949 | ||
943 | nr_copy_pages_check = nr_copy_pages; | ||
944 | return 0; | 950 | return 0; |
945 | } | 951 | } |
946 | 952 | ||
@@ -1089,7 +1095,7 @@ static inline void eat_page(void *page) | |||
1089 | *eaten_memory = c; | 1095 | *eaten_memory = c; |
1090 | } | 1096 | } |
1091 | 1097 | ||
1092 | static unsigned long get_usable_page(unsigned gfp_mask) | 1098 | unsigned long get_usable_page(unsigned gfp_mask) |
1093 | { | 1099 | { |
1094 | unsigned long m; | 1100 | unsigned long m; |
1095 | 1101 | ||
@@ -1103,7 +1109,7 @@ static unsigned long get_usable_page(unsigned gfp_mask) | |||
1103 | return m; | 1109 | return m; |
1104 | } | 1110 | } |
1105 | 1111 | ||
1106 | static void free_eaten_memory(void) | 1112 | void free_eaten_memory(void) |
1107 | { | 1113 | { |
1108 | unsigned long m; | 1114 | unsigned long m; |
1109 | void **c; | 1115 | void **c; |
@@ -1213,8 +1219,9 @@ static struct pbe * swsusp_pagedir_relocate(struct pbe *pblist) | |||
1213 | free_pagedir(pblist); | 1219 | free_pagedir(pblist); |
1214 | free_eaten_memory(); | 1220 | free_eaten_memory(); |
1215 | pblist = NULL; | 1221 | pblist = NULL; |
1216 | } | 1222 | /* Is this even worth handling? It should never ever happen, and we |
1217 | else | 1223 | have just lost user's state, anyway... */ |
1224 | } else | ||
1218 | printk("swsusp: Relocated %d pages\n", rel); | 1225 | printk("swsusp: Relocated %d pages\n", rel); |
1219 | 1226 | ||
1220 | return pblist; | 1227 | return pblist; |
@@ -1434,9 +1441,9 @@ static int read_pagedir(struct pbe *pblist) | |||
1434 | } | 1441 | } |
1435 | 1442 | ||
1436 | if (error) | 1443 | if (error) |
1437 | free_page((unsigned long)pblist); | 1444 | free_pagedir(pblist); |
1438 | 1445 | else | |
1439 | BUG_ON(i != swsusp_info.pagedir_pages); | 1446 | BUG_ON(i != swsusp_info.pagedir_pages); |
1440 | 1447 | ||
1441 | return error; | 1448 | return error; |
1442 | } | 1449 | } |
@@ -1474,11 +1481,12 @@ static int read_suspend_image(void) | |||
1474 | /* Allocate memory for the image and read the data from swap */ | 1481 | /* Allocate memory for the image and read the data from swap */ |
1475 | 1482 | ||
1476 | error = check_pagedir(pagedir_nosave); | 1483 | error = check_pagedir(pagedir_nosave); |
1477 | free_eaten_memory(); | 1484 | |
1478 | if (!error) | 1485 | if (!error) |
1479 | error = data_read(pagedir_nosave); | 1486 | error = data_read(pagedir_nosave); |
1480 | 1487 | ||
1481 | if (error) { /* We fail cleanly */ | 1488 | if (error) { /* We fail cleanly */ |
1489 | free_eaten_memory(); | ||
1482 | for_each_pbe (p, pagedir_nosave) | 1490 | for_each_pbe (p, pagedir_nosave) |
1483 | if (p->address) { | 1491 | if (p->address) { |
1484 | free_page(p->address); | 1492 | free_page(p->address); |
diff --git a/kernel/printk.c b/kernel/printk.c index a967605bc2e3..4b8f0f9230a4 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
@@ -488,6 +488,11 @@ static int __init printk_time_setup(char *str) | |||
488 | 488 | ||
489 | __setup("time", printk_time_setup); | 489 | __setup("time", printk_time_setup); |
490 | 490 | ||
491 | __attribute__((weak)) unsigned long long printk_clock(void) | ||
492 | { | ||
493 | return sched_clock(); | ||
494 | } | ||
495 | |||
491 | /* | 496 | /* |
492 | * This is printk. It can be called from any context. We want it to work. | 497 | * This is printk. It can be called from any context. We want it to work. |
493 | * | 498 | * |
@@ -565,7 +570,7 @@ asmlinkage int vprintk(const char *fmt, va_list args) | |||
565 | loglev_char = default_message_loglevel | 570 | loglev_char = default_message_loglevel |
566 | + '0'; | 571 | + '0'; |
567 | } | 572 | } |
568 | t = sched_clock(); | 573 | t = printk_clock(); |
569 | nanosec_rem = do_div(t, 1000000000); | 574 | nanosec_rem = do_div(t, 1000000000); |
570 | tlen = sprintf(tbuf, | 575 | tlen = sprintf(tbuf, |
571 | "<%c>[%5lu.%06lu] ", | 576 | "<%c>[%5lu.%06lu] ", |
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index bef3b6901b76..2559d4b8f23f 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -71,7 +71,7 @@ DEFINE_PER_CPU(struct rcu_data, rcu_bh_data) = { 0L }; | |||
71 | 71 | ||
72 | /* Fake initialization required by compiler */ | 72 | /* Fake initialization required by compiler */ |
73 | static DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL}; | 73 | static DEFINE_PER_CPU(struct tasklet_struct, rcu_tasklet) = {NULL}; |
74 | static int maxbatch = 10; | 74 | static int maxbatch = 10000; |
75 | 75 | ||
76 | #ifndef __HAVE_ARCH_CMPXCHG | 76 | #ifndef __HAVE_ARCH_CMPXCHG |
77 | /* | 77 | /* |
@@ -109,6 +109,10 @@ void fastcall call_rcu(struct rcu_head *head, | |||
109 | rdp = &__get_cpu_var(rcu_data); | 109 | rdp = &__get_cpu_var(rcu_data); |
110 | *rdp->nxttail = head; | 110 | *rdp->nxttail = head; |
111 | rdp->nxttail = &head->next; | 111 | rdp->nxttail = &head->next; |
112 | |||
113 | if (unlikely(++rdp->count > 10000)) | ||
114 | set_need_resched(); | ||
115 | |||
112 | local_irq_restore(flags); | 116 | local_irq_restore(flags); |
113 | } | 117 | } |
114 | 118 | ||
@@ -140,6 +144,12 @@ void fastcall call_rcu_bh(struct rcu_head *head, | |||
140 | rdp = &__get_cpu_var(rcu_bh_data); | 144 | rdp = &__get_cpu_var(rcu_bh_data); |
141 | *rdp->nxttail = head; | 145 | *rdp->nxttail = head; |
142 | rdp->nxttail = &head->next; | 146 | rdp->nxttail = &head->next; |
147 | rdp->count++; | ||
148 | /* | ||
149 | * Should we directly call rcu_do_batch() here ? | ||
150 | * if (unlikely(rdp->count > 10000)) | ||
151 | * rcu_do_batch(rdp); | ||
152 | */ | ||
143 | local_irq_restore(flags); | 153 | local_irq_restore(flags); |
144 | } | 154 | } |
145 | 155 | ||
@@ -157,6 +167,7 @@ static void rcu_do_batch(struct rcu_data *rdp) | |||
157 | next = rdp->donelist = list->next; | 167 | next = rdp->donelist = list->next; |
158 | list->func(list); | 168 | list->func(list); |
159 | list = next; | 169 | list = next; |
170 | rdp->count--; | ||
160 | if (++count >= maxbatch) | 171 | if (++count >= maxbatch) |
161 | break; | 172 | break; |
162 | } | 173 | } |
diff --git a/kernel/signal.c b/kernel/signal.c index b92c3c9f8b9a..50c992643771 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -262,7 +262,7 @@ next_signal(struct sigpending *pending, sigset_t *mask) | |||
262 | return sig; | 262 | return sig; |
263 | } | 263 | } |
264 | 264 | ||
265 | static struct sigqueue *__sigqueue_alloc(struct task_struct *t, unsigned int __nocast flags, | 265 | static struct sigqueue *__sigqueue_alloc(struct task_struct *t, gfp_t flags, |
266 | int override_rlimit) | 266 | int override_rlimit) |
267 | { | 267 | { |
268 | struct sigqueue *q = NULL; | 268 | struct sigqueue *q = NULL; |
@@ -578,7 +578,8 @@ int dequeue_signal(struct task_struct *tsk, sigset_t *mask, siginfo_t *info) | |||
578 | * is to alert stop-signal processing code when another | 578 | * is to alert stop-signal processing code when another |
579 | * processor has come along and cleared the flag. | 579 | * processor has come along and cleared the flag. |
580 | */ | 580 | */ |
581 | tsk->signal->flags |= SIGNAL_STOP_DEQUEUED; | 581 | if (!(tsk->signal->flags & SIGNAL_GROUP_EXIT)) |
582 | tsk->signal->flags |= SIGNAL_STOP_DEQUEUED; | ||
582 | } | 583 | } |
583 | if ( signr && | 584 | if ( signr && |
584 | ((info->si_code & __SI_MASK) == __SI_TIMER) && | 585 | ((info->si_code & __SI_MASK) == __SI_TIMER) && |
@@ -936,34 +937,31 @@ force_sig_specific(int sig, struct task_struct *t) | |||
936 | * as soon as they're available, so putting the signal on the shared queue | 937 | * as soon as they're available, so putting the signal on the shared queue |
937 | * will be equivalent to sending it to one such thread. | 938 | * will be equivalent to sending it to one such thread. |
938 | */ | 939 | */ |
939 | #define wants_signal(sig, p, mask) \ | 940 | static inline int wants_signal(int sig, struct task_struct *p) |
940 | (!sigismember(&(p)->blocked, sig) \ | 941 | { |
941 | && !((p)->state & mask) \ | 942 | if (sigismember(&p->blocked, sig)) |
942 | && !((p)->flags & PF_EXITING) \ | 943 | return 0; |
943 | && (task_curr(p) || !signal_pending(p))) | 944 | if (p->flags & PF_EXITING) |
944 | 945 | return 0; | |
946 | if (sig == SIGKILL) | ||
947 | return 1; | ||
948 | if (p->state & (TASK_STOPPED | TASK_TRACED)) | ||
949 | return 0; | ||
950 | return task_curr(p) || !signal_pending(p); | ||
951 | } | ||
945 | 952 | ||
946 | static void | 953 | static void |
947 | __group_complete_signal(int sig, struct task_struct *p) | 954 | __group_complete_signal(int sig, struct task_struct *p) |
948 | { | 955 | { |
949 | unsigned int mask; | ||
950 | struct task_struct *t; | 956 | struct task_struct *t; |
951 | 957 | ||
952 | /* | 958 | /* |
953 | * Don't bother traced and stopped tasks (but | ||
954 | * SIGKILL will punch through that). | ||
955 | */ | ||
956 | mask = TASK_STOPPED | TASK_TRACED; | ||
957 | if (sig == SIGKILL) | ||
958 | mask = 0; | ||
959 | |||
960 | /* | ||
961 | * Now find a thread we can wake up to take the signal off the queue. | 959 | * Now find a thread we can wake up to take the signal off the queue. |
962 | * | 960 | * |
963 | * If the main thread wants the signal, it gets first crack. | 961 | * If the main thread wants the signal, it gets first crack. |
964 | * Probably the least surprising to the average bear. | 962 | * Probably the least surprising to the average bear. |
965 | */ | 963 | */ |
966 | if (wants_signal(sig, p, mask)) | 964 | if (wants_signal(sig, p)) |
967 | t = p; | 965 | t = p; |
968 | else if (thread_group_empty(p)) | 966 | else if (thread_group_empty(p)) |
969 | /* | 967 | /* |
@@ -981,7 +979,7 @@ __group_complete_signal(int sig, struct task_struct *p) | |||
981 | t = p->signal->curr_target = p; | 979 | t = p->signal->curr_target = p; |
982 | BUG_ON(t->tgid != p->tgid); | 980 | BUG_ON(t->tgid != p->tgid); |
983 | 981 | ||
984 | while (!wants_signal(sig, t, mask)) { | 982 | while (!wants_signal(sig, t)) { |
985 | t = next_thread(t); | 983 | t = next_thread(t); |
986 | if (t == p->signal->curr_target) | 984 | if (t == p->signal->curr_target) |
987 | /* | 985 | /* |
@@ -1195,6 +1193,40 @@ kill_proc_info(int sig, struct siginfo *info, pid_t pid) | |||
1195 | return error; | 1193 | return error; |
1196 | } | 1194 | } |
1197 | 1195 | ||
1196 | /* like kill_proc_info(), but doesn't use uid/euid of "current" */ | ||
1197 | int kill_proc_info_as_uid(int sig, struct siginfo *info, pid_t pid, | ||
1198 | uid_t uid, uid_t euid) | ||
1199 | { | ||
1200 | int ret = -EINVAL; | ||
1201 | struct task_struct *p; | ||
1202 | |||
1203 | if (!valid_signal(sig)) | ||
1204 | return ret; | ||
1205 | |||
1206 | read_lock(&tasklist_lock); | ||
1207 | p = find_task_by_pid(pid); | ||
1208 | if (!p) { | ||
1209 | ret = -ESRCH; | ||
1210 | goto out_unlock; | ||
1211 | } | ||
1212 | if ((!info || ((unsigned long)info != 1 && | ||
1213 | (unsigned long)info != 2 && SI_FROMUSER(info))) | ||
1214 | && (euid != p->suid) && (euid != p->uid) | ||
1215 | && (uid != p->suid) && (uid != p->uid)) { | ||
1216 | ret = -EPERM; | ||
1217 | goto out_unlock; | ||
1218 | } | ||
1219 | if (sig && p->sighand) { | ||
1220 | unsigned long flags; | ||
1221 | spin_lock_irqsave(&p->sighand->siglock, flags); | ||
1222 | ret = __group_send_sig_info(sig, info, p); | ||
1223 | spin_unlock_irqrestore(&p->sighand->siglock, flags); | ||
1224 | } | ||
1225 | out_unlock: | ||
1226 | read_unlock(&tasklist_lock); | ||
1227 | return ret; | ||
1228 | } | ||
1229 | EXPORT_SYMBOL_GPL(kill_proc_info_as_uid); | ||
1198 | 1230 | ||
1199 | /* | 1231 | /* |
1200 | * kill_something_info() interprets pid in interesting ways just like kill(2). | 1232 | * kill_something_info() interprets pid in interesting ways just like kill(2). |
@@ -1766,7 +1798,8 @@ do_signal_stop(int signr) | |||
1766 | * stop is always done with the siglock held, | 1798 | * stop is always done with the siglock held, |
1767 | * so this check has no races. | 1799 | * so this check has no races. |
1768 | */ | 1800 | */ |
1769 | if (t->state < TASK_STOPPED) { | 1801 | if (!t->exit_state && |
1802 | !(t->state & (TASK_STOPPED|TASK_TRACED))) { | ||
1770 | stop_count++; | 1803 | stop_count++; |
1771 | signal_wake_up(t, 0); | 1804 | signal_wake_up(t, 0); |
1772 | } | 1805 | } |
diff --git a/kernel/sys.c b/kernel/sys.c index c80412be2302..2fa1ed18123c 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -361,17 +361,35 @@ out_unlock: | |||
361 | return retval; | 361 | return retval; |
362 | } | 362 | } |
363 | 363 | ||
364 | /** | ||
365 | * emergency_restart - reboot the system | ||
366 | * | ||
367 | * Without shutting down any hardware or taking any locks | ||
368 | * reboot the system. This is called when we know we are in | ||
369 | * trouble so this is our best effort to reboot. This is | ||
370 | * safe to call in interrupt context. | ||
371 | */ | ||
364 | void emergency_restart(void) | 372 | void emergency_restart(void) |
365 | { | 373 | { |
366 | machine_emergency_restart(); | 374 | machine_emergency_restart(); |
367 | } | 375 | } |
368 | EXPORT_SYMBOL_GPL(emergency_restart); | 376 | EXPORT_SYMBOL_GPL(emergency_restart); |
369 | 377 | ||
370 | void kernel_restart(char *cmd) | 378 | /** |
379 | * kernel_restart - reboot the system | ||
380 | * | ||
381 | * Shutdown everything and perform a clean reboot. | ||
382 | * This is not safe to call in interrupt context. | ||
383 | */ | ||
384 | void kernel_restart_prepare(char *cmd) | ||
371 | { | 385 | { |
372 | notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); | 386 | notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); |
373 | system_state = SYSTEM_RESTART; | 387 | system_state = SYSTEM_RESTART; |
374 | device_shutdown(); | 388 | device_shutdown(); |
389 | } | ||
390 | void kernel_restart(char *cmd) | ||
391 | { | ||
392 | kernel_restart_prepare(cmd); | ||
375 | if (!cmd) { | 393 | if (!cmd) { |
376 | printk(KERN_EMERG "Restarting system.\n"); | 394 | printk(KERN_EMERG "Restarting system.\n"); |
377 | } else { | 395 | } else { |
@@ -382,6 +400,12 @@ void kernel_restart(char *cmd) | |||
382 | } | 400 | } |
383 | EXPORT_SYMBOL_GPL(kernel_restart); | 401 | EXPORT_SYMBOL_GPL(kernel_restart); |
384 | 402 | ||
403 | /** | ||
404 | * kernel_kexec - reboot the system | ||
405 | * | ||
406 | * Move into place and start executing a preloaded standalone | ||
407 | * executable. If nothing was preloaded return an error. | ||
408 | */ | ||
385 | void kernel_kexec(void) | 409 | void kernel_kexec(void) |
386 | { | 410 | { |
387 | #ifdef CONFIG_KEXEC | 411 | #ifdef CONFIG_KEXEC |
@@ -390,9 +414,7 @@ void kernel_kexec(void) | |||
390 | if (!image) { | 414 | if (!image) { |
391 | return; | 415 | return; |
392 | } | 416 | } |
393 | notifier_call_chain(&reboot_notifier_list, SYS_RESTART, NULL); | 417 | kernel_restart_prepare(NULL); |
394 | system_state = SYSTEM_RESTART; | ||
395 | device_shutdown(); | ||
396 | printk(KERN_EMERG "Starting new kernel\n"); | 418 | printk(KERN_EMERG "Starting new kernel\n"); |
397 | machine_shutdown(); | 419 | machine_shutdown(); |
398 | machine_kexec(image); | 420 | machine_kexec(image); |
@@ -400,21 +422,39 @@ void kernel_kexec(void) | |||
400 | } | 422 | } |
401 | EXPORT_SYMBOL_GPL(kernel_kexec); | 423 | EXPORT_SYMBOL_GPL(kernel_kexec); |
402 | 424 | ||
403 | void kernel_halt(void) | 425 | /** |
426 | * kernel_halt - halt the system | ||
427 | * | ||
428 | * Shutdown everything and perform a clean system halt. | ||
429 | */ | ||
430 | void kernel_halt_prepare(void) | ||
404 | { | 431 | { |
405 | notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL); | 432 | notifier_call_chain(&reboot_notifier_list, SYS_HALT, NULL); |
406 | system_state = SYSTEM_HALT; | 433 | system_state = SYSTEM_HALT; |
407 | device_shutdown(); | 434 | device_shutdown(); |
435 | } | ||
436 | void kernel_halt(void) | ||
437 | { | ||
438 | kernel_halt_prepare(); | ||
408 | printk(KERN_EMERG "System halted.\n"); | 439 | printk(KERN_EMERG "System halted.\n"); |
409 | machine_halt(); | 440 | machine_halt(); |
410 | } | 441 | } |
411 | EXPORT_SYMBOL_GPL(kernel_halt); | 442 | EXPORT_SYMBOL_GPL(kernel_halt); |
412 | 443 | ||
413 | void kernel_power_off(void) | 444 | /** |
445 | * kernel_power_off - power_off the system | ||
446 | * | ||
447 | * Shutdown everything and perform a clean system power_off. | ||
448 | */ | ||
449 | void kernel_power_off_prepare(void) | ||
414 | { | 450 | { |
415 | notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL); | 451 | notifier_call_chain(&reboot_notifier_list, SYS_POWER_OFF, NULL); |
416 | system_state = SYSTEM_POWER_OFF; | 452 | system_state = SYSTEM_POWER_OFF; |
417 | device_shutdown(); | 453 | device_shutdown(); |
454 | } | ||
455 | void kernel_power_off(void) | ||
456 | { | ||
457 | kernel_power_off_prepare(); | ||
418 | printk(KERN_EMERG "Power down.\n"); | 458 | printk(KERN_EMERG "Power down.\n"); |
419 | machine_power_off(); | 459 | machine_power_off(); |
420 | } | 460 | } |
@@ -1728,8 +1768,7 @@ asmlinkage long sys_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
1728 | error = put_user(current->pdeath_signal, (int __user *)arg2); | 1768 | error = put_user(current->pdeath_signal, (int __user *)arg2); |
1729 | break; | 1769 | break; |
1730 | case PR_GET_DUMPABLE: | 1770 | case PR_GET_DUMPABLE: |
1731 | if (current->mm->dumpable) | 1771 | error = current->mm->dumpable; |
1732 | error = 1; | ||
1733 | break; | 1772 | break; |
1734 | case PR_SET_DUMPABLE: | 1773 | case PR_SET_DUMPABLE: |
1735 | if (arg2 < 0 || arg2 > 2) { | 1774 | if (arg2 < 0 || arg2 > 2) { |
diff --git a/kernel/time.c b/kernel/time.c index dd5ae1162a8f..40c2410ac99a 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -570,6 +570,7 @@ void getnstimeofday(struct timespec *tv) | |||
570 | tv->tv_sec = x.tv_sec; | 570 | tv->tv_sec = x.tv_sec; |
571 | tv->tv_nsec = x.tv_usec * NSEC_PER_USEC; | 571 | tv->tv_nsec = x.tv_usec * NSEC_PER_USEC; |
572 | } | 572 | } |
573 | EXPORT_SYMBOL_GPL(getnstimeofday); | ||
573 | #endif | 574 | #endif |
574 | 575 | ||
575 | #if (BITS_PER_LONG < 64) | 576 | #if (BITS_PER_LONG < 64) |