aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/sched.h2
-rw-r--r--kernel/user.c23
2 files changed, 17 insertions, 8 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 592e3a55f81..4ac7d51ad0e 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -530,10 +530,12 @@ struct user_struct {
530 530
531#ifdef CONFIG_FAIR_USER_SCHED 531#ifdef CONFIG_FAIR_USER_SCHED
532 struct task_group *tg; 532 struct task_group *tg;
533#ifdef CONFIG_SYSFS
533 struct kset kset; 534 struct kset kset;
534 struct subsys_attribute user_attr; 535 struct subsys_attribute user_attr;
535 struct work_struct work; 536 struct work_struct work;
536#endif 537#endif
538#endif
537}; 539};
538 540
539#ifdef CONFIG_FAIR_USER_SCHED 541#ifdef CONFIG_FAIR_USER_SCHED
diff --git a/kernel/user.c b/kernel/user.c
index f0e561e6d08..7e8215d87b4 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -87,9 +87,6 @@ static inline struct user_struct *uid_hash_find(uid_t uid,
87 87
88#ifdef CONFIG_FAIR_USER_SCHED 88#ifdef CONFIG_FAIR_USER_SCHED
89 89
90static struct kobject uids_kobject; /* represents /sys/kernel/uids directory */
91static DEFINE_MUTEX(uids_mutex);
92
93static void sched_destroy_user(struct user_struct *up) 90static void sched_destroy_user(struct user_struct *up)
94{ 91{
95 sched_destroy_group(up->tg); 92 sched_destroy_group(up->tg);
@@ -111,6 +108,19 @@ static void sched_switch_user(struct task_struct *p)
111 sched_move_task(p); 108 sched_move_task(p);
112} 109}
113 110
111#else /* CONFIG_FAIR_USER_SCHED */
112
113static void sched_destroy_user(struct user_struct *up) { }
114static int sched_create_user(struct user_struct *up) { return 0; }
115static void sched_switch_user(struct task_struct *p) { }
116
117#endif /* CONFIG_FAIR_USER_SCHED */
118
119#if defined(CONFIG_FAIR_USER_SCHED) && defined(CONFIG_SYSFS)
120
121static struct kobject uids_kobject; /* represents /sys/kernel/uids directory */
122static DEFINE_MUTEX(uids_mutex);
123
114static inline void uids_mutex_lock(void) 124static inline void uids_mutex_lock(void)
115{ 125{
116 mutex_lock(&uids_mutex); 126 mutex_lock(&uids_mutex);
@@ -257,11 +267,8 @@ static inline void free_user(struct user_struct *up, unsigned long flags)
257 schedule_work(&up->work); 267 schedule_work(&up->work);
258} 268}
259 269
260#else /* CONFIG_FAIR_USER_SCHED */ 270#else /* CONFIG_FAIR_USER_SCHED && CONFIG_SYSFS */
261 271
262static void sched_destroy_user(struct user_struct *up) { }
263static int sched_create_user(struct user_struct *up) { return 0; }
264static void sched_switch_user(struct task_struct *p) { }
265static inline int user_kobject_create(struct user_struct *up) { return 0; } 272static inline int user_kobject_create(struct user_struct *up) { return 0; }
266static inline void uids_mutex_lock(void) { } 273static inline void uids_mutex_lock(void) { }
267static inline void uids_mutex_unlock(void) { } 274static inline void uids_mutex_unlock(void) { }
@@ -280,7 +287,7 @@ static inline void free_user(struct user_struct *up, unsigned long flags)
280 kmem_cache_free(uid_cachep, up); 287 kmem_cache_free(uid_cachep, up);
281} 288}
282 289
283#endif /* CONFIG_FAIR_USER_SCHED */ 290#endif
284 291
285/* 292/*
286 * Locate the user_struct for the passed UID. If found, take a ref on it. The 293 * Locate the user_struct for the passed UID. If found, take a ref on it. The