aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/proc/inode.c')
-rw-r--r--fs/proc/inode.c11
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
55static struct kmem_cache * proc_inode_cachep; 56static struct kmem_cache *proc_inode_cachep __ro_after_init;
56 57
57static struct inode *proc_alloc_inode(struct super_block *sb) 58static struct inode *proc_alloc_inode(struct super_block *sb)
58{ 59{
@@ -128,12 +129,12 @@ enum {BIAS = -1U<<31};
128 129
129static inline int use_pde(struct proc_dir_entry *pde) 130static 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
134static void unuse_pde(struct proc_dir_entry *pde) 135static 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;