diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-07 01:15:42 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-07 01:15:42 -0500 |
commit | a2e5790d841658485d642196dbb0927303d6c22f (patch) | |
tree | b3d28c9bcb7da6880806146fd22a88a7ee7f733e /fs/proc/inode.c | |
parent | ab2d92ad881da11331280aedf612d82e61cb6d41 (diff) | |
parent | 60c3e026d73ccabb075fb70ba02f8512ab40cf2c (diff) |
Merge branch 'akpm' (patches from Andrew)
Merge misc updates from Andrew Morton:
- kasan updates
- procfs
- lib/bitmap updates
- other lib/ updates
- checkpatch tweaks
- rapidio
- ubsan
- pipe fixes and cleanups
- lots of other misc bits
* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (114 commits)
Documentation/sysctl/user.txt: fix typo
MAINTAINERS: update ARM/QUALCOMM SUPPORT patterns
MAINTAINERS: update various PALM patterns
MAINTAINERS: update "ARM/OXNAS platform support" patterns
MAINTAINERS: update Cortina/Gemini patterns
MAINTAINERS: remove ARM/CLKDEV SUPPORT file pattern
MAINTAINERS: remove ANDROID ION pattern
mm: docs: add blank lines to silence sphinx "Unexpected indentation" errors
mm: docs: fix parameter names mismatch
mm: docs: fixup punctuation
pipe: read buffer limits atomically
pipe: simplify round_pipe_size()
pipe: reject F_SETPIPE_SZ with size over UINT_MAX
pipe: fix off-by-one error when checking buffer limits
pipe: actually allow root to exceed the pipe buffer limits
pipe, sysctl: remove pipe_proc_fn()
pipe, sysctl: drop 'min' parameter from pipe-max-size converter
kasan: rework Kconfig settings
crash_dump: is_kdump_kernel can be boolean
kernel/mutex: mutex_is_locked can be boolean
...
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r-- | fs/proc/inode.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 8dacaabb9f37..6e8724958116 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Copyright (C) 1991, 1992 Linus Torvalds | 5 | * Copyright (C) 1991, 1992 Linus Torvalds |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <linux/cache.h> | ||
8 | #include <linux/time.h> | 9 | #include <linux/time.h> |
9 | #include <linux/proc_fs.h> | 10 | #include <linux/proc_fs.h> |
10 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
@@ -52,7 +53,7 @@ static void proc_evict_inode(struct inode *inode) | |||
52 | } | 53 | } |
53 | } | 54 | } |
54 | 55 | ||
55 | static struct kmem_cache * proc_inode_cachep; | 56 | static struct kmem_cache *proc_inode_cachep __ro_after_init; |
56 | 57 | ||
57 | static struct inode *proc_alloc_inode(struct super_block *sb) | 58 | static struct inode *proc_alloc_inode(struct super_block *sb) |
58 | { | 59 | { |
@@ -128,12 +129,12 @@ enum {BIAS = -1U<<31}; | |||
128 | 129 | ||
129 | static inline int use_pde(struct proc_dir_entry *pde) | 130 | static inline int use_pde(struct proc_dir_entry *pde) |
130 | { | 131 | { |
131 | return atomic_inc_unless_negative(&pde->in_use); | 132 | return likely(atomic_inc_unless_negative(&pde->in_use)); |
132 | } | 133 | } |
133 | 134 | ||
134 | static void unuse_pde(struct proc_dir_entry *pde) | 135 | static void unuse_pde(struct proc_dir_entry *pde) |
135 | { | 136 | { |
136 | if (atomic_dec_return(&pde->in_use) == BIAS) | 137 | if (unlikely(atomic_dec_return(&pde->in_use) == BIAS)) |
137 | complete(pde->pde_unload_completion); | 138 | complete(pde->pde_unload_completion); |
138 | } | 139 | } |
139 | 140 | ||
@@ -166,7 +167,7 @@ static void close_pdeo(struct proc_dir_entry *pde, struct pde_opener *pdeo) | |||
166 | spin_lock(&pde->pde_unload_lock); | 167 | spin_lock(&pde->pde_unload_lock); |
167 | /* After ->release. */ | 168 | /* After ->release. */ |
168 | list_del(&pdeo->lh); | 169 | list_del(&pdeo->lh); |
169 | if (pdeo->c) | 170 | if (unlikely(pdeo->c)) |
170 | complete(pdeo->c); | 171 | complete(pdeo->c); |
171 | kfree(pdeo); | 172 | kfree(pdeo); |
172 | } | 173 | } |
@@ -420,7 +421,7 @@ static const char *proc_get_link(struct dentry *dentry, | |||
420 | struct delayed_call *done) | 421 | struct delayed_call *done) |
421 | { | 422 | { |
422 | struct proc_dir_entry *pde = PDE(inode); | 423 | struct proc_dir_entry *pde = PDE(inode); |
423 | if (unlikely(!use_pde(pde))) | 424 | if (!use_pde(pde)) |
424 | return ERR_PTR(-EINVAL); | 425 | return ERR_PTR(-EINVAL); |
425 | set_delayed_call(done, proc_put_link, pde); | 426 | set_delayed_call(done, proc_put_link, pde); |
426 | return pde->data; | 427 | return pde->data; |