diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 4 | ||||
| -rw-r--r-- | kernel/kprobes.c | 2 | ||||
| -rw-r--r-- | kernel/power/disk.c | 12 | ||||
| -rw-r--r-- | kernel/power/main.c | 16 | ||||
| -rw-r--r-- | kernel/power/process.c | 6 | ||||
| -rw-r--r-- | kernel/power/swsusp.c | 36 | ||||
| -rw-r--r-- | kernel/profile.c | 4 | ||||
| -rw-r--r-- | kernel/sched.c | 7 | ||||
| -rw-r--r-- | kernel/sys_ni.c | 3 | ||||
| -rw-r--r-- | kernel/sysctl.c | 14 | ||||
| -rw-r--r-- | kernel/user.c | 4 |
11 files changed, 74 insertions, 34 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index cdef6cea8900..b65187f0c74e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
| @@ -208,8 +208,10 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm) | |||
| 208 | struct file *file; | 208 | struct file *file; |
| 209 | 209 | ||
| 210 | if (mpnt->vm_flags & VM_DONTCOPY) { | 210 | if (mpnt->vm_flags & VM_DONTCOPY) { |
| 211 | long pages = vma_pages(mpnt); | ||
| 212 | mm->total_vm -= pages; | ||
| 211 | __vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file, | 213 | __vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file, |
| 212 | -vma_pages(mpnt)); | 214 | -pages); |
| 213 | continue; | 215 | continue; |
| 214 | } | 216 | } |
| 215 | charge = 0; | 217 | charge = 0; |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 90c0e82b650c..b0237122b24e 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
| @@ -574,7 +574,7 @@ static int __init init_kprobes(void) | |||
| 574 | INIT_HLIST_HEAD(&kretprobe_inst_table[i]); | 574 | INIT_HLIST_HEAD(&kretprobe_inst_table[i]); |
| 575 | } | 575 | } |
| 576 | 576 | ||
| 577 | err = arch_init(); | 577 | err = arch_init_kprobes(); |
| 578 | if (!err) | 578 | if (!err) |
| 579 | err = register_die_notifier(&kprobe_exceptions_nb); | 579 | err = register_die_notifier(&kprobe_exceptions_nb); |
| 580 | 580 | ||
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index fb8de63c2919..3ec789c6b537 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
| @@ -16,6 +16,8 @@ | |||
| 16 | #include <linux/device.h> | 16 | #include <linux/device.h> |
| 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> | ||
| 20 | |||
| 19 | #include "power.h" | 21 | #include "power.h" |
| 20 | 22 | ||
| 21 | 23 | ||
| @@ -234,6 +236,16 @@ static int software_resume(void) | |||
| 234 | { | 236 | { |
| 235 | int error; | 237 | int error; |
| 236 | 238 | ||
| 239 | if (!swsusp_resume_device) { | ||
| 240 | if (!strlen(resume_file)) | ||
| 241 | return -ENOENT; | ||
| 242 | swsusp_resume_device = name_to_dev_t(resume_file); | ||
| 243 | pr_debug("swsusp: Resume From Partition %s\n", resume_file); | ||
| 244 | } else { | ||
| 245 | pr_debug("swsusp: Resume From Partition %d:%d\n", | ||
| 246 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); | ||
| 247 | } | ||
| 248 | |||
| 237 | if (noresume) { | 249 | if (noresume) { |
| 238 | /** | 250 | /** |
| 239 | * FIXME: If noresume is specified, we need to find the partition | 251 | * FIXME: If noresume is specified, we need to find the partition |
diff --git a/kernel/power/main.c b/kernel/power/main.c index c94cb9e95090..71aa0fd22007 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -19,6 +19,9 @@ | |||
| 19 | 19 | ||
| 20 | #include "power.h" | 20 | #include "power.h" |
| 21 | 21 | ||
| 22 | /*This is just an arbitrary number */ | ||
| 23 | #define FREE_PAGE_NUMBER (100) | ||
| 24 | |||
| 22 | DECLARE_MUTEX(pm_sem); | 25 | DECLARE_MUTEX(pm_sem); |
| 23 | 26 | ||
| 24 | struct pm_ops * pm_ops = NULL; | 27 | struct pm_ops * pm_ops = NULL; |
| @@ -49,6 +52,7 @@ void pm_set_ops(struct pm_ops * ops) | |||
| 49 | static int suspend_prepare(suspend_state_t state) | 52 | static int suspend_prepare(suspend_state_t state) |
| 50 | { | 53 | { |
| 51 | int error = 0; | 54 | int error = 0; |
| 55 | unsigned int free_pages; | ||
| 52 | 56 | ||
| 53 | if (!pm_ops || !pm_ops->enter) | 57 | if (!pm_ops || !pm_ops->enter) |
| 54 | return -EPERM; | 58 | return -EPERM; |
| @@ -67,6 +71,16 @@ static int suspend_prepare(suspend_state_t state) | |||
| 67 | goto Thaw; | 71 | goto Thaw; |
| 68 | } | 72 | } |
| 69 | 73 | ||
| 74 | if ((free_pages = nr_free_pages()) < FREE_PAGE_NUMBER) { | ||
| 75 | pr_debug("PM: free some memory\n"); | ||
| 76 | shrink_all_memory(FREE_PAGE_NUMBER - free_pages); | ||
| 77 | if (nr_free_pages() < FREE_PAGE_NUMBER) { | ||
| 78 | error = -ENOMEM; | ||
| 79 | printk(KERN_ERR "PM: No enough memory\n"); | ||
| 80 | goto Thaw; | ||
| 81 | } | ||
| 82 | } | ||
| 83 | |||
| 70 | if (pm_ops->prepare) { | 84 | if (pm_ops->prepare) { |
| 71 | if ((error = pm_ops->prepare(state))) | 85 | if ((error = pm_ops->prepare(state))) |
| 72 | goto Thaw; | 86 | goto Thaw; |
| @@ -194,7 +208,7 @@ int software_suspend(void) | |||
| 194 | 208 | ||
| 195 | int pm_suspend(suspend_state_t state) | 209 | int pm_suspend(suspend_state_t state) |
| 196 | { | 210 | { |
| 197 | if (state > PM_SUSPEND_ON && state < PM_SUSPEND_MAX) | 211 | if (state > PM_SUSPEND_ON && state <= PM_SUSPEND_MAX) |
| 198 | return enter_state(state); | 212 | return enter_state(state); |
| 199 | return -EINVAL; | 213 | return -EINVAL; |
| 200 | } | 214 | } |
diff --git a/kernel/power/process.c b/kernel/power/process.c index 0a086640bcfc..3bd0d261818f 100644 --- a/kernel/power/process.c +++ b/kernel/power/process.c | |||
| @@ -59,6 +59,7 @@ int freeze_processes(void) | |||
| 59 | int todo; | 59 | int todo; |
| 60 | unsigned long start_time; | 60 | unsigned long start_time; |
| 61 | struct task_struct *g, *p; | 61 | struct task_struct *g, *p; |
| 62 | unsigned long flags; | ||
| 62 | 63 | ||
| 63 | printk( "Stopping tasks: " ); | 64 | printk( "Stopping tasks: " ); |
| 64 | start_time = jiffies; | 65 | start_time = jiffies; |
| @@ -66,12 +67,9 @@ int freeze_processes(void) | |||
| 66 | todo = 0; | 67 | todo = 0; |
| 67 | read_lock(&tasklist_lock); | 68 | read_lock(&tasklist_lock); |
| 68 | do_each_thread(g, p) { | 69 | do_each_thread(g, p) { |
| 69 | unsigned long flags; | ||
| 70 | if (!freezeable(p)) | 70 | if (!freezeable(p)) |
| 71 | continue; | 71 | continue; |
| 72 | if ((frozen(p)) || | 72 | if (frozen(p)) |
| 73 | (p->state == TASK_TRACED) || | ||
| 74 | (p->state == TASK_STOPPED)) | ||
| 75 | continue; | 73 | continue; |
| 76 | 74 | ||
| 77 | freeze(p); | 75 | freeze(p); |
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c index c285fc5a2320..f2bc71b9fe8b 100644 --- a/kernel/power/swsusp.c +++ b/kernel/power/swsusp.c | |||
| @@ -63,6 +63,7 @@ | |||
| 63 | #include <linux/console.h> | 63 | #include <linux/console.h> |
| 64 | #include <linux/highmem.h> | 64 | #include <linux/highmem.h> |
| 65 | #include <linux/bio.h> | 65 | #include <linux/bio.h> |
| 66 | #include <linux/mount.h> | ||
| 66 | 67 | ||
| 67 | #include <asm/uaccess.h> | 68 | #include <asm/uaccess.h> |
| 68 | #include <asm/mmu_context.h> | 69 | #include <asm/mmu_context.h> |
| @@ -869,13 +870,6 @@ extern asmlinkage int swsusp_arch_resume(void); | |||
| 869 | 870 | ||
| 870 | asmlinkage int swsusp_save(void) | 871 | asmlinkage int swsusp_save(void) |
| 871 | { | 872 | { |
| 872 | int error = 0; | ||
| 873 | |||
| 874 | if ((error = swsusp_swap_check())) { | ||
| 875 | printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try " | ||
| 876 | "swapon -a!\n"); | ||
| 877 | return error; | ||
| 878 | } | ||
| 879 | return suspend_prepare_image(); | 873 | return suspend_prepare_image(); |
| 880 | } | 874 | } |
| 881 | 875 | ||
| @@ -892,14 +886,20 @@ int swsusp_suspend(void) | |||
| 892 | * at resume time, and evil weirdness ensues. | 886 | * at resume time, and evil weirdness ensues. |
| 893 | */ | 887 | */ |
| 894 | if ((error = device_power_down(PMSG_FREEZE))) { | 888 | if ((error = device_power_down(PMSG_FREEZE))) { |
| 895 | printk(KERN_ERR "Some devices failed to power down, aborting suspend\n"); | ||
| 896 | local_irq_enable(); | 889 | local_irq_enable(); |
| 897 | swsusp_free(); | ||
| 898 | return error; | 890 | return error; |
| 899 | } | 891 | } |
| 892 | |||
| 893 | if ((error = swsusp_swap_check())) { | ||
| 894 | printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try " | ||
| 895 | "swapon -a!\n"); | ||
| 896 | local_irq_enable(); | ||
| 897 | return error; | ||
| 898 | } | ||
| 899 | |||
| 900 | save_processor_state(); | 900 | save_processor_state(); |
| 901 | if ((error = swsusp_arch_suspend())) | 901 | if ((error = swsusp_arch_suspend())) |
| 902 | swsusp_free(); | 902 | printk("Error %d suspending\n", error); |
| 903 | /* Restore control flow magically appears here */ | 903 | /* Restore control flow magically appears here */ |
| 904 | restore_processor_state(); | 904 | restore_processor_state(); |
| 905 | BUG_ON (nr_copy_pages_check != nr_copy_pages); | 905 | BUG_ON (nr_copy_pages_check != nr_copy_pages); |
| @@ -1166,9 +1166,9 @@ static int bio_write_page(pgoff_t page_off, void * page) | |||
| 1166 | static const char * sanity_check(void) | 1166 | static const char * sanity_check(void) |
| 1167 | { | 1167 | { |
| 1168 | dump_info(); | 1168 | dump_info(); |
| 1169 | if(swsusp_info.version_code != LINUX_VERSION_CODE) | 1169 | if (swsusp_info.version_code != LINUX_VERSION_CODE) |
| 1170 | return "kernel version"; | 1170 | return "kernel version"; |
| 1171 | if(swsusp_info.num_physpages != num_physpages) | 1171 | if (swsusp_info.num_physpages != num_physpages) |
| 1172 | return "memory size"; | 1172 | return "memory size"; |
| 1173 | if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname)) | 1173 | if (strcmp(swsusp_info.uts.sysname,system_utsname.sysname)) |
| 1174 | return "system type"; | 1174 | return "system type"; |
| @@ -1261,8 +1261,6 @@ static int data_read(struct pbe *pblist) | |||
| 1261 | return error; | 1261 | return error; |
| 1262 | } | 1262 | } |
| 1263 | 1263 | ||
| 1264 | extern dev_t name_to_dev_t(const char *line); | ||
| 1265 | |||
| 1266 | /** | 1264 | /** |
| 1267 | * read_pagedir - Read page backup list pages from swap | 1265 | * read_pagedir - Read page backup list pages from swap |
| 1268 | */ | 1266 | */ |
| @@ -1356,16 +1354,6 @@ int swsusp_check(void) | |||
| 1356 | { | 1354 | { |
| 1357 | int error; | 1355 | int error; |
| 1358 | 1356 | ||
| 1359 | if (!swsusp_resume_device) { | ||
| 1360 | if (!strlen(resume_file)) | ||
| 1361 | return -ENOENT; | ||
| 1362 | swsusp_resume_device = name_to_dev_t(resume_file); | ||
| 1363 | pr_debug("swsusp: Resume From Partition %s\n", resume_file); | ||
| 1364 | } else { | ||
| 1365 | pr_debug("swsusp: Resume From Partition %d:%d\n", | ||
| 1366 | MAJOR(swsusp_resume_device), MINOR(swsusp_resume_device)); | ||
| 1367 | } | ||
| 1368 | |||
| 1369 | resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); | 1357 | resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); |
| 1370 | if (!IS_ERR(resume_bdev)) { | 1358 | if (!IS_ERR(resume_bdev)) { |
| 1371 | set_blocksize(resume_bdev, PAGE_SIZE); | 1359 | set_blocksize(resume_bdev, PAGE_SIZE); |
diff --git a/kernel/profile.c b/kernel/profile.c index ad8cbb75ffa2..f89248e6d704 100644 --- a/kernel/profile.c +++ b/kernel/profile.c | |||
| @@ -35,11 +35,11 @@ struct profile_hit { | |||
| 35 | #define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ) | 35 | #define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ) |
| 36 | 36 | ||
| 37 | /* Oprofile timer tick hook */ | 37 | /* Oprofile timer tick hook */ |
| 38 | int (*timer_hook)(struct pt_regs *); | 38 | int (*timer_hook)(struct pt_regs *) __read_mostly; |
| 39 | 39 | ||
| 40 | static atomic_t *prof_buffer; | 40 | static atomic_t *prof_buffer; |
| 41 | static unsigned long prof_len, prof_shift; | 41 | static unsigned long prof_len, prof_shift; |
| 42 | static int prof_on; | 42 | static int prof_on __read_mostly; |
| 43 | static cpumask_t prof_cpu_mask = CPU_MASK_ALL; | 43 | static cpumask_t prof_cpu_mask = CPU_MASK_ALL; |
| 44 | #ifdef CONFIG_SMP | 44 | #ifdef CONFIG_SMP |
| 45 | static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits); | 45 | static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits); |
diff --git a/kernel/sched.c b/kernel/sched.c index 5f2182d42241..4107db0dc091 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
| @@ -3877,6 +3877,13 @@ asmlinkage long sys_sched_yield(void) | |||
| 3877 | 3877 | ||
| 3878 | static inline void __cond_resched(void) | 3878 | static inline void __cond_resched(void) |
| 3879 | { | 3879 | { |
| 3880 | /* | ||
| 3881 | * The BKS might be reacquired before we have dropped | ||
| 3882 | * PREEMPT_ACTIVE, which could trigger a second | ||
| 3883 | * cond_resched() call. | ||
| 3884 | */ | ||
| 3885 | if (unlikely(preempt_count())) | ||
| 3886 | return; | ||
| 3880 | do { | 3887 | do { |
| 3881 | add_preempt_count(PREEMPT_ACTIVE); | 3888 | add_preempt_count(PREEMPT_ACTIVE); |
| 3882 | schedule(); | 3889 | schedule(); |
diff --git a/kernel/sys_ni.c b/kernel/sys_ni.c index 29196ce9b40f..42b40ae5eada 100644 --- a/kernel/sys_ni.c +++ b/kernel/sys_ni.c | |||
| @@ -80,6 +80,9 @@ cond_syscall(sys_keyctl); | |||
| 80 | cond_syscall(compat_sys_keyctl); | 80 | cond_syscall(compat_sys_keyctl); |
| 81 | cond_syscall(compat_sys_socketcall); | 81 | cond_syscall(compat_sys_socketcall); |
| 82 | cond_syscall(sys_set_zone_reclaim); | 82 | cond_syscall(sys_set_zone_reclaim); |
| 83 | cond_syscall(sys_inotify_init); | ||
| 84 | cond_syscall(sys_inotify_add_watch); | ||
| 85 | cond_syscall(sys_inotify_rm_watch); | ||
| 83 | 86 | ||
| 84 | /* arch-specific weak syscall entries */ | 87 | /* arch-specific weak syscall entries */ |
| 85 | cond_syscall(sys_pciconfig_read); | 88 | cond_syscall(sys_pciconfig_read); |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 270ee7fadbd8..e60b9c36f1f0 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -146,6 +146,9 @@ extern ctl_table random_table[]; | |||
| 146 | #ifdef CONFIG_UNIX98_PTYS | 146 | #ifdef CONFIG_UNIX98_PTYS |
| 147 | extern ctl_table pty_table[]; | 147 | extern ctl_table pty_table[]; |
| 148 | #endif | 148 | #endif |
| 149 | #ifdef CONFIG_INOTIFY | ||
| 150 | extern ctl_table inotify_table[]; | ||
| 151 | #endif | ||
| 149 | 152 | ||
| 150 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT | 153 | #ifdef HAVE_ARCH_PICK_MMAP_LAYOUT |
| 151 | int sysctl_legacy_va_layout; | 154 | int sysctl_legacy_va_layout; |
| @@ -218,6 +221,7 @@ static ctl_table root_table[] = { | |||
| 218 | .mode = 0555, | 221 | .mode = 0555, |
| 219 | .child = dev_table, | 222 | .child = dev_table, |
| 220 | }, | 223 | }, |
| 224 | |||
| 221 | { .ctl_name = 0 } | 225 | { .ctl_name = 0 } |
| 222 | }; | 226 | }; |
| 223 | 227 | ||
| @@ -950,6 +954,14 @@ static ctl_table fs_table[] = { | |||
| 950 | .mode = 0644, | 954 | .mode = 0644, |
| 951 | .proc_handler = &proc_dointvec, | 955 | .proc_handler = &proc_dointvec, |
| 952 | }, | 956 | }, |
| 957 | #ifdef CONFIG_INOTIFY | ||
| 958 | { | ||
| 959 | .ctl_name = FS_INOTIFY, | ||
| 960 | .procname = "inotify", | ||
| 961 | .mode = 0555, | ||
| 962 | .child = inotify_table, | ||
| 963 | }, | ||
| 964 | #endif | ||
| 953 | #endif | 965 | #endif |
| 954 | { | 966 | { |
| 955 | .ctl_name = KERN_SETUID_DUMPABLE, | 967 | .ctl_name = KERN_SETUID_DUMPABLE, |
| @@ -968,7 +980,7 @@ static ctl_table debug_table[] = { | |||
| 968 | 980 | ||
| 969 | static ctl_table dev_table[] = { | 981 | static ctl_table dev_table[] = { |
| 970 | { .ctl_name = 0 } | 982 | { .ctl_name = 0 } |
| 971 | }; | 983 | }; |
| 972 | 984 | ||
| 973 | extern void init_irq_proc (void); | 985 | extern void init_irq_proc (void); |
| 974 | 986 | ||
diff --git a/kernel/user.c b/kernel/user.c index 734575d55769..89e562feb1b1 100644 --- a/kernel/user.c +++ b/kernel/user.c | |||
| @@ -120,6 +120,10 @@ struct user_struct * alloc_uid(uid_t uid) | |||
| 120 | atomic_set(&new->processes, 0); | 120 | atomic_set(&new->processes, 0); |
| 121 | atomic_set(&new->files, 0); | 121 | atomic_set(&new->files, 0); |
| 122 | atomic_set(&new->sigpending, 0); | 122 | atomic_set(&new->sigpending, 0); |
| 123 | #ifdef CONFIG_INOTIFY | ||
| 124 | atomic_set(&new->inotify_watches, 0); | ||
| 125 | atomic_set(&new->inotify_devs, 0); | ||
| 126 | #endif | ||
| 123 | 127 | ||
| 124 | new->mq_bytes = 0; | 128 | new->mq_bytes = 0; |
| 125 | new->locked_shm = 0; | 129 | new->locked_shm = 0; |
