History

Merge branch 'access-creds'

The access() (and faccessat()) credentials change can cause an unnecessary load on the RCU machinery because every access() call ends up freeing the temporary access credential using RCU. This isn't really noticeable on small machines, but if you have hundreds of cores you can cause huge slowdowns due to RCU storms. It's easy to avoid: the temporary access crededntials aren't actually normally accessed using RCU at all, so we can avoid the whole issue by just marking them as such. * access-creds: access: avoid the RCU grace period for the temporary subjective credentials

Linus Torvalds committed 7 years ago

Commit a29a0a42 parents bed38c3 d7852fb3 files · +45 −3Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/cred.h+7−1
@@ -145,7 +145,11 @@ struct cred { · 144 unmodified lines
145 struct user_struct *user; /* real user ID subscription */145 struct user_struct *user; /* real user ID subscription */
146 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */146 struct user_namespace *user_ns; /* user_ns the caps and keyrings are relative to. */
147 struct group_info *group_info; /* supplementary groups for euid/fsgid */147 struct group_info *group_info; /* supplementary groups for euid/fsgid */
148 struct rcu_head rcu; /* RCU deletion hook */148 /* RCU deletion */
149 union {
150 int non_rcu; /* Can we skip RCU deletion? */
151 struct rcu_head rcu; /* RCU deletion hook */
152 };
149} __randomize_layout;153} __randomize_layout;
150 154
151extern void __put_cred(struct cred *);155extern void __put_cred(struct cred *);
@@ -246,6 +250,7 @@ static inline const struct cred *get_cred(const struct cred *cred) · 94 unmodified lines
246 if (!cred)250 if (!cred)
247 return cred;251 return cred;
248 validate_creds(cred);252 validate_creds(cred);
253 nonconst_cred->non_rcu = 0;
249 return get_new_cred(nonconst_cred);254 return get_new_cred(nonconst_cred);
250}255}
251 256
@@ -257,6 +262,7 @@ static inline const struct cred *get_cred_rcu(const struct cred *cred) · 5 unmodified lines
257 if (!atomic_inc_not_zero(&nonconst_cred->usage))262 if (!atomic_inc_not_zero(&nonconst_cred->usage))
258 return NULL;263 return NULL;
259 validate_creds(cred);264 validate_creds(cred);
265 nonconst_cred->non_rcu = 0;
260 return cred;266 return cred;
261}267}
262 268