diff options
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 25 | ||||
-rw-r--r-- | fs/proc/generic.c | 2 | ||||
-rw-r--r-- | fs/proc/inode.c | 2 | ||||
-rw-r--r-- | fs/proc/proc_sysctl.c | 48 | ||||
-rw-r--r-- | fs/proc/stat.c | 41 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 5 | ||||
-rw-r--r-- | fs/proc/vmcore.c | 1 |
7 files changed, 95 insertions, 29 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 5eb02069e1b8..851ba3dcdc29 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1107,13 +1107,6 @@ static ssize_t oom_adjust_write(struct file *file, const char __user *buf, | |||
1107 | goto err_sighand; | 1107 | goto err_sighand; |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | if (oom_adjust != task->signal->oom_adj) { | ||
1111 | if (oom_adjust == OOM_DISABLE) | ||
1112 | atomic_inc(&task->mm->oom_disable_count); | ||
1113 | if (task->signal->oom_adj == OOM_DISABLE) | ||
1114 | atomic_dec(&task->mm->oom_disable_count); | ||
1115 | } | ||
1116 | |||
1117 | /* | 1110 | /* |
1118 | * Warn that /proc/pid/oom_adj is deprecated, see | 1111 | * Warn that /proc/pid/oom_adj is deprecated, see |
1119 | * Documentation/feature-removal-schedule.txt. | 1112 | * Documentation/feature-removal-schedule.txt. |
@@ -1215,12 +1208,6 @@ static ssize_t oom_score_adj_write(struct file *file, const char __user *buf, | |||
1215 | goto err_sighand; | 1208 | goto err_sighand; |
1216 | } | 1209 | } |
1217 | 1210 | ||
1218 | if (oom_score_adj != task->signal->oom_score_adj) { | ||
1219 | if (oom_score_adj == OOM_SCORE_ADJ_MIN) | ||
1220 | atomic_inc(&task->mm->oom_disable_count); | ||
1221 | if (task->signal->oom_score_adj == OOM_SCORE_ADJ_MIN) | ||
1222 | atomic_dec(&task->mm->oom_disable_count); | ||
1223 | } | ||
1224 | task->signal->oom_score_adj = oom_score_adj; | 1211 | task->signal->oom_score_adj = oom_score_adj; |
1225 | if (has_capability_noaudit(current, CAP_SYS_RESOURCE)) | 1212 | if (has_capability_noaudit(current, CAP_SYS_RESOURCE)) |
1226 | task->signal->oom_score_adj_min = oom_score_adj; | 1213 | task->signal->oom_score_adj_min = oom_score_adj; |
@@ -2261,7 +2248,7 @@ static struct dentry *proc_pident_instantiate(struct inode *dir, | |||
2261 | ei = PROC_I(inode); | 2248 | ei = PROC_I(inode); |
2262 | inode->i_mode = p->mode; | 2249 | inode->i_mode = p->mode; |
2263 | if (S_ISDIR(inode->i_mode)) | 2250 | if (S_ISDIR(inode->i_mode)) |
2264 | inode->i_nlink = 2; /* Use getattr to fix if necessary */ | 2251 | set_nlink(inode, 2); /* Use getattr to fix if necessary */ |
2265 | if (p->iop) | 2252 | if (p->iop) |
2266 | inode->i_op = p->iop; | 2253 | inode->i_op = p->iop; |
2267 | if (p->fop) | 2254 | if (p->fop) |
@@ -2655,7 +2642,7 @@ static struct dentry *proc_base_instantiate(struct inode *dir, | |||
2655 | 2642 | ||
2656 | inode->i_mode = p->mode; | 2643 | inode->i_mode = p->mode; |
2657 | if (S_ISDIR(inode->i_mode)) | 2644 | if (S_ISDIR(inode->i_mode)) |
2658 | inode->i_nlink = 2; | 2645 | set_nlink(inode, 2); |
2659 | if (S_ISLNK(inode->i_mode)) | 2646 | if (S_ISLNK(inode->i_mode)) |
2660 | inode->i_size = 64; | 2647 | inode->i_size = 64; |
2661 | if (p->iop) | 2648 | if (p->iop) |
@@ -2994,8 +2981,8 @@ static struct dentry *proc_pid_instantiate(struct inode *dir, | |||
2994 | inode->i_fop = &proc_tgid_base_operations; | 2981 | inode->i_fop = &proc_tgid_base_operations; |
2995 | inode->i_flags|=S_IMMUTABLE; | 2982 | inode->i_flags|=S_IMMUTABLE; |
2996 | 2983 | ||
2997 | inode->i_nlink = 2 + pid_entry_count_dirs(tgid_base_stuff, | 2984 | set_nlink(inode, 2 + pid_entry_count_dirs(tgid_base_stuff, |
2998 | ARRAY_SIZE(tgid_base_stuff)); | 2985 | ARRAY_SIZE(tgid_base_stuff))); |
2999 | 2986 | ||
3000 | d_set_d_op(dentry, &pid_dentry_operations); | 2987 | d_set_d_op(dentry, &pid_dentry_operations); |
3001 | 2988 | ||
@@ -3246,8 +3233,8 @@ static struct dentry *proc_task_instantiate(struct inode *dir, | |||
3246 | inode->i_fop = &proc_tid_base_operations; | 3233 | inode->i_fop = &proc_tid_base_operations; |
3247 | inode->i_flags|=S_IMMUTABLE; | 3234 | inode->i_flags|=S_IMMUTABLE; |
3248 | 3235 | ||
3249 | inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff, | 3236 | set_nlink(inode, 2 + pid_entry_count_dirs(tid_base_stuff, |
3250 | ARRAY_SIZE(tid_base_stuff)); | 3237 | ARRAY_SIZE(tid_base_stuff))); |
3251 | 3238 | ||
3252 | d_set_d_op(dentry, &pid_dentry_operations); | 3239 | d_set_d_op(dentry, &pid_dentry_operations); |
3253 | 3240 | ||
diff --git a/fs/proc/generic.c b/fs/proc/generic.c index 9d99131d0d65..10090d9c7ad5 100644 --- a/fs/proc/generic.c +++ b/fs/proc/generic.c | |||
@@ -283,7 +283,7 @@ static int proc_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
283 | struct inode *inode = dentry->d_inode; | 283 | struct inode *inode = dentry->d_inode; |
284 | struct proc_dir_entry *de = PROC_I(inode)->pde; | 284 | struct proc_dir_entry *de = PROC_I(inode)->pde; |
285 | if (de && de->nlink) | 285 | if (de && de->nlink) |
286 | inode->i_nlink = de->nlink; | 286 | set_nlink(inode, de->nlink); |
287 | 287 | ||
288 | generic_fillattr(inode, stat); | 288 | generic_fillattr(inode, stat); |
289 | return 0; | 289 | return 0; |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 7ed72d6c1c6f..7737c5468a40 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -445,7 +445,7 @@ struct inode *proc_get_inode(struct super_block *sb, struct proc_dir_entry *de) | |||
445 | if (de->size) | 445 | if (de->size) |
446 | inode->i_size = de->size; | 446 | inode->i_size = de->size; |
447 | if (de->nlink) | 447 | if (de->nlink) |
448 | inode->i_nlink = de->nlink; | 448 | set_nlink(inode, de->nlink); |
449 | if (de->proc_iops) | 449 | if (de->proc_iops) |
450 | inode->i_op = de->proc_iops; | 450 | inode->i_op = de->proc_iops; |
451 | if (de->proc_fops) { | 451 | if (de->proc_fops) { |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index 1a77dbef226f..a6b62173d4c3 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -3,6 +3,7 @@ | |||
3 | */ | 3 | */ |
4 | #include <linux/init.h> | 4 | #include <linux/init.h> |
5 | #include <linux/sysctl.h> | 5 | #include <linux/sysctl.h> |
6 | #include <linux/poll.h> | ||
6 | #include <linux/proc_fs.h> | 7 | #include <linux/proc_fs.h> |
7 | #include <linux/security.h> | 8 | #include <linux/security.h> |
8 | #include <linux/namei.h> | 9 | #include <linux/namei.h> |
@@ -14,6 +15,15 @@ static const struct inode_operations proc_sys_inode_operations; | |||
14 | static const struct file_operations proc_sys_dir_file_operations; | 15 | static const struct file_operations proc_sys_dir_file_operations; |
15 | static const struct inode_operations proc_sys_dir_operations; | 16 | static const struct inode_operations proc_sys_dir_operations; |
16 | 17 | ||
18 | void proc_sys_poll_notify(struct ctl_table_poll *poll) | ||
19 | { | ||
20 | if (!poll) | ||
21 | return; | ||
22 | |||
23 | atomic_inc(&poll->event); | ||
24 | wake_up_interruptible(&poll->wait); | ||
25 | } | ||
26 | |||
17 | static struct inode *proc_sys_make_inode(struct super_block *sb, | 27 | static struct inode *proc_sys_make_inode(struct super_block *sb, |
18 | struct ctl_table_header *head, struct ctl_table *table) | 28 | struct ctl_table_header *head, struct ctl_table *table) |
19 | { | 29 | { |
@@ -39,7 +49,7 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, | |||
39 | inode->i_fop = &proc_sys_file_operations; | 49 | inode->i_fop = &proc_sys_file_operations; |
40 | } else { | 50 | } else { |
41 | inode->i_mode |= S_IFDIR; | 51 | inode->i_mode |= S_IFDIR; |
42 | inode->i_nlink = 0; | 52 | clear_nlink(inode); |
43 | inode->i_op = &proc_sys_dir_operations; | 53 | inode->i_op = &proc_sys_dir_operations; |
44 | inode->i_fop = &proc_sys_dir_file_operations; | 54 | inode->i_fop = &proc_sys_dir_file_operations; |
45 | } | 55 | } |
@@ -176,6 +186,39 @@ static ssize_t proc_sys_write(struct file *filp, const char __user *buf, | |||
176 | return proc_sys_call_handler(filp, (void __user *)buf, count, ppos, 1); | 186 | return proc_sys_call_handler(filp, (void __user *)buf, count, ppos, 1); |
177 | } | 187 | } |
178 | 188 | ||
189 | static int proc_sys_open(struct inode *inode, struct file *filp) | ||
190 | { | ||
191 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; | ||
192 | |||
193 | if (table->poll) | ||
194 | filp->private_data = proc_sys_poll_event(table->poll); | ||
195 | |||
196 | return 0; | ||
197 | } | ||
198 | |||
199 | static unsigned int proc_sys_poll(struct file *filp, poll_table *wait) | ||
200 | { | ||
201 | struct inode *inode = filp->f_path.dentry->d_inode; | ||
202 | struct ctl_table *table = PROC_I(inode)->sysctl_entry; | ||
203 | unsigned long event = (unsigned long)filp->private_data; | ||
204 | unsigned int ret = DEFAULT_POLLMASK; | ||
205 | |||
206 | if (!table->proc_handler) | ||
207 | goto out; | ||
208 | |||
209 | if (!table->poll) | ||
210 | goto out; | ||
211 | |||
212 | poll_wait(filp, &table->poll->wait, wait); | ||
213 | |||
214 | if (event != atomic_read(&table->poll->event)) { | ||
215 | filp->private_data = proc_sys_poll_event(table->poll); | ||
216 | ret = POLLIN | POLLRDNORM | POLLERR | POLLPRI; | ||
217 | } | ||
218 | |||
219 | out: | ||
220 | return ret; | ||
221 | } | ||
179 | 222 | ||
180 | static int proc_sys_fill_cache(struct file *filp, void *dirent, | 223 | static int proc_sys_fill_cache(struct file *filp, void *dirent, |
181 | filldir_t filldir, | 224 | filldir_t filldir, |
@@ -364,12 +407,15 @@ static int proc_sys_getattr(struct vfsmount *mnt, struct dentry *dentry, struct | |||
364 | } | 407 | } |
365 | 408 | ||
366 | static const struct file_operations proc_sys_file_operations = { | 409 | static const struct file_operations proc_sys_file_operations = { |
410 | .open = proc_sys_open, | ||
411 | .poll = proc_sys_poll, | ||
367 | .read = proc_sys_read, | 412 | .read = proc_sys_read, |
368 | .write = proc_sys_write, | 413 | .write = proc_sys_write, |
369 | .llseek = default_llseek, | 414 | .llseek = default_llseek, |
370 | }; | 415 | }; |
371 | 416 | ||
372 | static const struct file_operations proc_sys_dir_file_operations = { | 417 | static const struct file_operations proc_sys_dir_file_operations = { |
418 | .read = generic_read_dir, | ||
373 | .readdir = proc_sys_readdir, | 419 | .readdir = proc_sys_readdir, |
374 | .llseek = generic_file_llseek, | 420 | .llseek = generic_file_llseek, |
375 | }; | 421 | }; |
diff --git a/fs/proc/stat.c b/fs/proc/stat.c index 9758b654a1bc..42b274da92c3 100644 --- a/fs/proc/stat.c +++ b/fs/proc/stat.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/time.h> | 10 | #include <linux/time.h> |
11 | #include <linux/irqnr.h> | 11 | #include <linux/irqnr.h> |
12 | #include <asm/cputime.h> | 12 | #include <asm/cputime.h> |
13 | #include <linux/tick.h> | ||
13 | 14 | ||
14 | #ifndef arch_irq_stat_cpu | 15 | #ifndef arch_irq_stat_cpu |
15 | #define arch_irq_stat_cpu(cpu) 0 | 16 | #define arch_irq_stat_cpu(cpu) 0 |
@@ -21,6 +22,35 @@ | |||
21 | #define arch_idle_time(cpu) 0 | 22 | #define arch_idle_time(cpu) 0 |
22 | #endif | 23 | #endif |
23 | 24 | ||
25 | static cputime64_t get_idle_time(int cpu) | ||
26 | { | ||
27 | u64 idle_time = get_cpu_idle_time_us(cpu, NULL); | ||
28 | cputime64_t idle; | ||
29 | |||
30 | if (idle_time == -1ULL) { | ||
31 | /* !NO_HZ so we can rely on cpustat.idle */ | ||
32 | idle = kstat_cpu(cpu).cpustat.idle; | ||
33 | idle = cputime64_add(idle, arch_idle_time(cpu)); | ||
34 | } else | ||
35 | idle = usecs_to_cputime(idle_time); | ||
36 | |||
37 | return idle; | ||
38 | } | ||
39 | |||
40 | static cputime64_t get_iowait_time(int cpu) | ||
41 | { | ||
42 | u64 iowait_time = get_cpu_iowait_time_us(cpu, NULL); | ||
43 | cputime64_t iowait; | ||
44 | |||
45 | if (iowait_time == -1ULL) | ||
46 | /* !NO_HZ so we can rely on cpustat.iowait */ | ||
47 | iowait = kstat_cpu(cpu).cpustat.iowait; | ||
48 | else | ||
49 | iowait = usecs_to_cputime(iowait_time); | ||
50 | |||
51 | return iowait; | ||
52 | } | ||
53 | |||
24 | static int show_stat(struct seq_file *p, void *v) | 54 | static int show_stat(struct seq_file *p, void *v) |
25 | { | 55 | { |
26 | int i, j; | 56 | int i, j; |
@@ -42,9 +72,8 @@ static int show_stat(struct seq_file *p, void *v) | |||
42 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); | 72 | user = cputime64_add(user, kstat_cpu(i).cpustat.user); |
43 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); | 73 | nice = cputime64_add(nice, kstat_cpu(i).cpustat.nice); |
44 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); | 74 | system = cputime64_add(system, kstat_cpu(i).cpustat.system); |
45 | idle = cputime64_add(idle, kstat_cpu(i).cpustat.idle); | 75 | idle = cputime64_add(idle, get_idle_time(i)); |
46 | idle = cputime64_add(idle, arch_idle_time(i)); | 76 | iowait = cputime64_add(iowait, get_iowait_time(i)); |
47 | iowait = cputime64_add(iowait, kstat_cpu(i).cpustat.iowait); | ||
48 | irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq); | 77 | irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq); |
49 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); | 78 | softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq); |
50 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); | 79 | steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal); |
@@ -76,14 +105,12 @@ static int show_stat(struct seq_file *p, void *v) | |||
76 | (unsigned long long)cputime64_to_clock_t(guest), | 105 | (unsigned long long)cputime64_to_clock_t(guest), |
77 | (unsigned long long)cputime64_to_clock_t(guest_nice)); | 106 | (unsigned long long)cputime64_to_clock_t(guest_nice)); |
78 | for_each_online_cpu(i) { | 107 | for_each_online_cpu(i) { |
79 | |||
80 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ | 108 | /* Copy values here to work around gcc-2.95.3, gcc-2.96 */ |
81 | user = kstat_cpu(i).cpustat.user; | 109 | user = kstat_cpu(i).cpustat.user; |
82 | nice = kstat_cpu(i).cpustat.nice; | 110 | nice = kstat_cpu(i).cpustat.nice; |
83 | system = kstat_cpu(i).cpustat.system; | 111 | system = kstat_cpu(i).cpustat.system; |
84 | idle = kstat_cpu(i).cpustat.idle; | 112 | idle = get_idle_time(i); |
85 | idle = cputime64_add(idle, arch_idle_time(i)); | 113 | iowait = get_iowait_time(i); |
86 | iowait = kstat_cpu(i).cpustat.iowait; | ||
87 | irq = kstat_cpu(i).cpustat.irq; | 114 | irq = kstat_cpu(i).cpustat.irq; |
88 | softirq = kstat_cpu(i).cpustat.softirq; | 115 | softirq = kstat_cpu(i).cpustat.softirq; |
89 | steal = kstat_cpu(i).cpustat.steal; | 116 | steal = kstat_cpu(i).cpustat.steal; |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 5afaa58a8630..e418c5abdb0e 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -44,6 +44,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) | |||
44 | "VmPeak:\t%8lu kB\n" | 44 | "VmPeak:\t%8lu kB\n" |
45 | "VmSize:\t%8lu kB\n" | 45 | "VmSize:\t%8lu kB\n" |
46 | "VmLck:\t%8lu kB\n" | 46 | "VmLck:\t%8lu kB\n" |
47 | "VmPin:\t%8lu kB\n" | ||
47 | "VmHWM:\t%8lu kB\n" | 48 | "VmHWM:\t%8lu kB\n" |
48 | "VmRSS:\t%8lu kB\n" | 49 | "VmRSS:\t%8lu kB\n" |
49 | "VmData:\t%8lu kB\n" | 50 | "VmData:\t%8lu kB\n" |
@@ -55,6 +56,7 @@ void task_mem(struct seq_file *m, struct mm_struct *mm) | |||
55 | hiwater_vm << (PAGE_SHIFT-10), | 56 | hiwater_vm << (PAGE_SHIFT-10), |
56 | (total_vm - mm->reserved_vm) << (PAGE_SHIFT-10), | 57 | (total_vm - mm->reserved_vm) << (PAGE_SHIFT-10), |
57 | mm->locked_vm << (PAGE_SHIFT-10), | 58 | mm->locked_vm << (PAGE_SHIFT-10), |
59 | mm->pinned_vm << (PAGE_SHIFT-10), | ||
58 | hiwater_rss << (PAGE_SHIFT-10), | 60 | hiwater_rss << (PAGE_SHIFT-10), |
59 | total_rss << (PAGE_SHIFT-10), | 61 | total_rss << (PAGE_SHIFT-10), |
60 | data << (PAGE_SHIFT-10), | 62 | data << (PAGE_SHIFT-10), |
@@ -1039,6 +1041,9 @@ static int show_numa_map(struct seq_file *m, void *v) | |||
1039 | seq_printf(m, " stack"); | 1041 | seq_printf(m, " stack"); |
1040 | } | 1042 | } |
1041 | 1043 | ||
1044 | if (is_vm_hugetlb_page(vma)) | ||
1045 | seq_printf(m, " huge"); | ||
1046 | |||
1042 | walk_page_range(vma->vm_start, vma->vm_end, &walk); | 1047 | walk_page_range(vma->vm_start, vma->vm_end, &walk); |
1043 | 1048 | ||
1044 | if (!md->pages) | 1049 | if (!md->pages) |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index cd99bf557650..b0f450a2bb7c 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/user.h> | 12 | #include <linux/user.h> |
13 | #include <linux/elf.h> | 13 | #include <linux/elf.h> |
14 | #include <linux/elfcore.h> | 14 | #include <linux/elfcore.h> |
15 | #include <linux/export.h> | ||
15 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
16 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
17 | #include <linux/bootmem.h> | 18 | #include <linux/bootmem.h> |