aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-13 10:25:59 -0400
committerDavid Woodhouse <dwmw2@shinybook.infradead.org>2005-07-13 10:25:59 -0400
commit30beab1491f0b96b2f23d3fb68af01fd921a16d8 (patch)
treec580bdc0846269fbb10feeda901ecec1a48ee2ef /kernel
parent21af6c4f2aa5f63138871b4ddd77d7ebf2588c9d (diff)
parentc32511e2718618f0b53479eb36e07439aa363a74 (diff)
Merge with /shiny/git/linux-2.6/.git
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c4
-rw-r--r--kernel/kprobes.c2
-rw-r--r--kernel/power/disk.c12
-rw-r--r--kernel/power/main.c16
-rw-r--r--kernel/power/process.c6
-rw-r--r--kernel/power/swsusp.c36
-rw-r--r--kernel/profile.c4
-rw-r--r--kernel/sched.c7
-rw-r--r--kernel/sys_ni.c3
-rw-r--r--kernel/sysctl.c43
-rw-r--r--kernel/user.c4
11 files changed, 103 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
22DECLARE_MUTEX(pm_sem); 25DECLARE_MUTEX(pm_sem);
23 26
24struct pm_ops * pm_ops = NULL; 27struct pm_ops * pm_ops = NULL;
@@ -49,6 +52,7 @@ void pm_set_ops(struct pm_ops * ops)
49static int suspend_prepare(suspend_state_t state) 52static 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
195int pm_suspend(suspend_state_t state) 209int 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
870asmlinkage int swsusp_save(void) 871asmlinkage 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)
1166static const char * sanity_check(void) 1166static 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
1264extern 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 */
38int (*timer_hook)(struct pt_regs *); 38int (*timer_hook)(struct pt_regs *) __read_mostly;
39 39
40static atomic_t *prof_buffer; 40static atomic_t *prof_buffer;
41static unsigned long prof_len, prof_shift; 41static unsigned long prof_len, prof_shift;
42static int prof_on; 42static int prof_on __read_mostly;
43static cpumask_t prof_cpu_mask = CPU_MASK_ALL; 43static cpumask_t prof_cpu_mask = CPU_MASK_ALL;
44#ifdef CONFIG_SMP 44#ifdef CONFIG_SMP
45static DEFINE_PER_CPU(struct profile_hit *[2], cpu_profile_hits); 45static 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
3878static inline void __cond_resched(void) 3878static 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);
80cond_syscall(compat_sys_keyctl); 80cond_syscall(compat_sys_keyctl);
81cond_syscall(compat_sys_socketcall); 81cond_syscall(compat_sys_socketcall);
82cond_syscall(sys_set_zone_reclaim); 82cond_syscall(sys_set_zone_reclaim);
83cond_syscall(sys_inotify_init);
84cond_syscall(sys_inotify_add_watch);
85cond_syscall(sys_inotify_rm_watch);
83 86
84/* arch-specific weak syscall entries */ 87/* arch-specific weak syscall entries */
85cond_syscall(sys_pciconfig_read); 88cond_syscall(sys_pciconfig_read);
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 270ee7fadbd8..b240e2cb86fc 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -67,6 +67,12 @@ extern int printk_ratelimit_jiffies;
67extern int printk_ratelimit_burst; 67extern int printk_ratelimit_burst;
68extern int pid_max_min, pid_max_max; 68extern int pid_max_min, pid_max_max;
69 69
70#ifdef CONFIG_INOTIFY
71extern int inotify_max_user_devices;
72extern int inotify_max_user_watches;
73extern int inotify_max_queued_events;
74#endif
75
70#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86) 76#if defined(CONFIG_X86_LOCAL_APIC) && defined(CONFIG_X86)
71int unknown_nmi_panic; 77int unknown_nmi_panic;
72extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *, 78extern int proc_unknown_nmi_panic(ctl_table *, int, struct file *,
@@ -218,6 +224,7 @@ static ctl_table root_table[] = {
218 .mode = 0555, 224 .mode = 0555,
219 .child = dev_table, 225 .child = dev_table,
220 }, 226 },
227
221 { .ctl_name = 0 } 228 { .ctl_name = 0 }
222}; 229};
223 230
@@ -959,6 +966,40 @@ static ctl_table fs_table[] = {
959 .mode = 0644, 966 .mode = 0644,
960 .proc_handler = &proc_dointvec, 967 .proc_handler = &proc_dointvec,
961 }, 968 },
969#ifdef CONFIG_INOTIFY
970 {
971 .ctl_name = INOTIFY_MAX_USER_DEVICES,
972 .procname = "max_user_devices",
973 .data = &inotify_max_user_devices,
974 .maxlen = sizeof(int),
975 .mode = 0644,
976 .proc_handler = &proc_dointvec_minmax,
977 .strategy = &sysctl_intvec,
978 .extra1 = &zero,
979 },
980
981 {
982 .ctl_name = INOTIFY_MAX_USER_WATCHES,
983 .procname = "max_user_watches",
984 .data = &inotify_max_user_watches,
985 .maxlen = sizeof(int),
986 .mode = 0644,
987 .proc_handler = &proc_dointvec_minmax,
988 .strategy = &sysctl_intvec,
989 .extra1 = &zero,
990 },
991
992 {
993 .ctl_name = INOTIFY_MAX_QUEUED_EVENTS,
994 .procname = "max_queued_events",
995 .data = &inotify_max_queued_events,
996 .maxlen = sizeof(int),
997 .mode = 0644,
998 .proc_handler = &proc_dointvec_minmax,
999 .strategy = &sysctl_intvec,
1000 .extra1 = &zero
1001 },
1002#endif
962 { .ctl_name = 0 } 1003 { .ctl_name = 0 }
963}; 1004};
964 1005
@@ -968,7 +1009,7 @@ static ctl_table debug_table[] = {
968 1009
969static ctl_table dev_table[] = { 1010static ctl_table dev_table[] = {
970 { .ctl_name = 0 } 1011 { .ctl_name = 0 }
971}; 1012};
972 1013
973extern void init_irq_proc (void); 1014extern void init_irq_proc (void);
974 1015
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;