aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-25 22:26:14 -0500
committerLachlan McIlroy <lachlan@redback.melbourne.sgi.com>2008-02-25 22:26:14 -0500
commit91e229bbad6524aabaac8717b2f559283670c37a (patch)
tree84a55e4ac2dcf23add97bd9fde3e9cb232c12b30 /kernel
parent6e5e93424dc66542c548dfaa3bfebe30d46d50dd (diff)
parentbfa274e2436fc7ef72ef51c878083647f1cfd429 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus
Diffstat (limited to 'kernel')
-rw-r--r--kernel/auditsc.c5
-rw-r--r--kernel/cgroup.c153
-rw-r--r--kernel/futex.c50
-rw-r--r--kernel/futex_compat.c9
-rw-r--r--kernel/irq/chip.c20
-rw-r--r--kernel/irq/spurious.c3
-rw-r--r--kernel/marker.c4
-rw-r--r--kernel/module.c7
-rw-r--r--kernel/power/disk.c4
-rw-r--r--kernel/power/snapshot.c42
-rw-r--r--kernel/sched.c5
-rw-r--r--kernel/time/timer_list.c4
12 files changed, 200 insertions, 106 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index ac6d9b23b018..2087d6de67ea 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1000,9 +1000,10 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1000 * for strings that are too long, we should not have created 1000 * for strings that are too long, we should not have created
1001 * any. 1001 * any.
1002 */ 1002 */
1003 if (unlikely((len = -1) || len > MAX_ARG_STRLEN - 1)) { 1003 if (unlikely((len == -1) || len > MAX_ARG_STRLEN - 1)) {
1004 WARN_ON(1); 1004 WARN_ON(1);
1005 send_sig(SIGKILL, current, 0); 1005 send_sig(SIGKILL, current, 0);
1006 return -1;
1006 } 1007 }
1007 1008
1008 /* walk the whole argument looking for non-ascii chars */ 1009 /* walk the whole argument looking for non-ascii chars */
@@ -1020,6 +1021,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1020 if (ret) { 1021 if (ret) {
1021 WARN_ON(1); 1022 WARN_ON(1);
1022 send_sig(SIGKILL, current, 0); 1023 send_sig(SIGKILL, current, 0);
1024 return -1;
1023 } 1025 }
1024 buf[to_send] = '\0'; 1026 buf[to_send] = '\0';
1025 has_cntl = audit_string_contains_control(buf, to_send); 1027 has_cntl = audit_string_contains_control(buf, to_send);
@@ -1083,6 +1085,7 @@ static int audit_log_single_execve_arg(struct audit_context *context,
1083 if (ret) { 1085 if (ret) {
1084 WARN_ON(1); 1086 WARN_ON(1);
1085 send_sig(SIGKILL, current, 0); 1087 send_sig(SIGKILL, current, 0);
1088 return -1;
1086 } 1089 }
1087 buf[to_send] = '\0'; 1090 buf[to_send] = '\0';
1088 1091
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4766bb65e4d9..d8abe996e009 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -113,9 +113,9 @@ static int root_count;
113#define dummytop (&rootnode.top_cgroup) 113#define dummytop (&rootnode.top_cgroup)
114 114
115/* This flag indicates whether tasks in the fork and exit paths should 115/* This flag indicates whether tasks in the fork and exit paths should
116 * take callback_mutex and check for fork/exit handlers to call. This 116 * check for fork/exit handlers to call. This avoids us having to do
117 * avoids us having to do extra work in the fork/exit path if none of the 117 * extra work in the fork/exit path if none of the subsystems need to
118 * subsystems need to be called. 118 * be called.
119 */ 119 */
120static int need_forkexit_callback; 120static int need_forkexit_callback;
121 121
@@ -307,7 +307,6 @@ static inline void put_css_set_taskexit(struct css_set *cg)
307 * template: location in which to build the desired set of subsystem 307 * template: location in which to build the desired set of subsystem
308 * state objects for the new cgroup group 308 * state objects for the new cgroup group
309 */ 309 */
310
311static struct css_set *find_existing_css_set( 310static struct css_set *find_existing_css_set(
312 struct css_set *oldcg, 311 struct css_set *oldcg,
313 struct cgroup *cgrp, 312 struct cgroup *cgrp,
@@ -320,7 +319,7 @@ static struct css_set *find_existing_css_set(
320 /* Built the set of subsystem state objects that we want to 319 /* Built the set of subsystem state objects that we want to
321 * see in the new css_set */ 320 * see in the new css_set */
322 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 321 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
323 if (root->subsys_bits & (1ull << i)) { 322 if (root->subsys_bits & (1UL << i)) {
324 /* Subsystem is in this hierarchy. So we want 323 /* Subsystem is in this hierarchy. So we want
325 * the subsystem state from the new 324 * the subsystem state from the new
326 * cgroup */ 325 * cgroup */
@@ -354,7 +353,6 @@ static struct css_set *find_existing_css_set(
354 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on 353 * and chains them on tmp through their cgrp_link_list fields. Returns 0 on
355 * success or a negative error 354 * success or a negative error
356 */ 355 */
357
358static int allocate_cg_links(int count, struct list_head *tmp) 356static int allocate_cg_links(int count, struct list_head *tmp)
359{ 357{
360 struct cg_cgroup_link *link; 358 struct cg_cgroup_link *link;
@@ -396,7 +394,6 @@ static void free_cg_links(struct list_head *tmp)
396 * substituted into the appropriate hierarchy. Must be called with 394 * substituted into the appropriate hierarchy. Must be called with
397 * cgroup_mutex held 395 * cgroup_mutex held
398 */ 396 */
399
400static struct css_set *find_css_set( 397static struct css_set *find_css_set(
401 struct css_set *oldcg, struct cgroup *cgrp) 398 struct css_set *oldcg, struct cgroup *cgrp)
402{ 399{
@@ -473,7 +470,6 @@ static struct css_set *find_css_set(
473 /* Link this cgroup group into the list */ 470 /* Link this cgroup group into the list */
474 list_add(&res->list, &init_css_set.list); 471 list_add(&res->list, &init_css_set.list);
475 css_set_count++; 472 css_set_count++;
476 INIT_LIST_HEAD(&res->tasks);
477 write_unlock(&css_set_lock); 473 write_unlock(&css_set_lock);
478 474
479 return res; 475 return res;
@@ -507,8 +503,8 @@ static struct css_set *find_css_set(
507 * critical pieces of code here. The exception occurs on cgroup_exit(), 503 * critical pieces of code here. The exception occurs on cgroup_exit(),
508 * when a task in a notify_on_release cgroup exits. Then cgroup_mutex 504 * when a task in a notify_on_release cgroup exits. Then cgroup_mutex
509 * is taken, and if the cgroup count is zero, a usermode call made 505 * is taken, and if the cgroup count is zero, a usermode call made
510 * to /sbin/cgroup_release_agent with the name of the cgroup (path 506 * to the release agent with the name of the cgroup (path relative to
511 * relative to the root of cgroup file system) as the argument. 507 * the root of cgroup file system) as the argument.
512 * 508 *
513 * A cgroup can only be deleted if both its 'count' of using tasks 509 * A cgroup can only be deleted if both its 'count' of using tasks
514 * is zero, and its list of 'children' cgroups is empty. Since all 510 * is zero, and its list of 'children' cgroups is empty. Since all
@@ -521,7 +517,7 @@ static struct css_set *find_css_set(
521 * 517 *
522 * The need for this exception arises from the action of 518 * The need for this exception arises from the action of
523 * cgroup_attach_task(), which overwrites one tasks cgroup pointer with 519 * cgroup_attach_task(), which overwrites one tasks cgroup pointer with
524 * another. It does so using cgroup_mutexe, however there are 520 * another. It does so using cgroup_mutex, however there are
525 * several performance critical places that need to reference 521 * several performance critical places that need to reference
526 * task->cgroup without the expense of grabbing a system global 522 * task->cgroup without the expense of grabbing a system global
527 * mutex. Therefore except as noted below, when dereferencing or, as 523 * mutex. Therefore except as noted below, when dereferencing or, as
@@ -537,7 +533,6 @@ static struct css_set *find_css_set(
537 * cgroup_lock - lock out any changes to cgroup structures 533 * cgroup_lock - lock out any changes to cgroup structures
538 * 534 *
539 */ 535 */
540
541void cgroup_lock(void) 536void cgroup_lock(void)
542{ 537{
543 mutex_lock(&cgroup_mutex); 538 mutex_lock(&cgroup_mutex);
@@ -548,7 +543,6 @@ void cgroup_lock(void)
548 * 543 *
549 * Undo the lock taken in a previous cgroup_lock() call. 544 * Undo the lock taken in a previous cgroup_lock() call.
550 */ 545 */
551
552void cgroup_unlock(void) 546void cgroup_unlock(void)
553{ 547{
554 mutex_unlock(&cgroup_mutex); 548 mutex_unlock(&cgroup_mutex);
@@ -590,7 +584,6 @@ static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb)
590 * Call subsys's pre_destroy handler. 584 * Call subsys's pre_destroy handler.
591 * This is called before css refcnt check. 585 * This is called before css refcnt check.
592 */ 586 */
593
594static void cgroup_call_pre_destroy(struct cgroup *cgrp) 587static void cgroup_call_pre_destroy(struct cgroup *cgrp)
595{ 588{
596 struct cgroup_subsys *ss; 589 struct cgroup_subsys *ss;
@@ -600,7 +593,6 @@ static void cgroup_call_pre_destroy(struct cgroup *cgrp)
600 return; 593 return;
601} 594}
602 595
603
604static void cgroup_diput(struct dentry *dentry, struct inode *inode) 596static void cgroup_diput(struct dentry *dentry, struct inode *inode)
605{ 597{
606 /* is dentry a directory ? if so, kfree() associated cgroup */ 598 /* is dentry a directory ? if so, kfree() associated cgroup */
@@ -696,7 +688,7 @@ static int rebind_subsystems(struct cgroupfs_root *root,
696 added_bits = final_bits & ~root->actual_subsys_bits; 688 added_bits = final_bits & ~root->actual_subsys_bits;
697 /* Check that any added subsystems are currently free */ 689 /* Check that any added subsystems are currently free */
698 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) { 690 for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
699 unsigned long long bit = 1ull << i; 691 unsigned long bit = 1UL << i;
700 struct cgroup_subsys *ss = subsys[i]; 692 struct cgroup_subsys *ss = subsys[i];
701 if (!(bit & added_bits)) 693 if (!(bit & added_bits))
702 continue; 694 continue;
@@ -927,7 +919,6 @@ static int cgroup_get_rootdir(struct super_block *sb)
927 if (!inode) 919 if (!inode)
928 return -ENOMEM; 920 return -ENOMEM;
929 921
930 inode->i_op = &simple_dir_inode_operations;
931 inode->i_fop = &simple_dir_operations; 922 inode->i_fop = &simple_dir_operations;
932 inode->i_op = &cgroup_dir_inode_operations; 923 inode->i_op = &cgroup_dir_inode_operations;
933 /* directories start off with i_nlink == 2 (for "." entry) */ 924 /* directories start off with i_nlink == 2 (for "." entry) */
@@ -961,8 +952,11 @@ static int cgroup_get_sb(struct file_system_type *fs_type,
961 } 952 }
962 953
963 root = kzalloc(sizeof(*root), GFP_KERNEL); 954 root = kzalloc(sizeof(*root), GFP_KERNEL);
964 if (!root) 955 if (!root) {
956 if (opts.release_agent)
957 kfree(opts.release_agent);
965 return -ENOMEM; 958 return -ENOMEM;
959 }
966 960
967 init_cgroup_root(root); 961 init_cgroup_root(root);
968 root->subsys_bits = opts.subsys_bits; 962 root->subsys_bits = opts.subsys_bits;
@@ -1129,8 +1123,13 @@ static inline struct cftype *__d_cft(struct dentry *dentry)
1129 return dentry->d_fsdata; 1123 return dentry->d_fsdata;
1130} 1124}
1131 1125
1132/* 1126/**
1133 * Called with cgroup_mutex held. Writes path of cgroup into buf. 1127 * cgroup_path - generate the path of a cgroup
1128 * @cgrp: the cgroup in question
1129 * @buf: the buffer to write the path into
1130 * @buflen: the length of the buffer
1131 *
1132 * Called with cgroup_mutex held. Writes path of cgroup into buf.
1134 * Returns 0 on success, -errno on error. 1133 * Returns 0 on success, -errno on error.
1135 */ 1134 */
1136int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen) 1135int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
@@ -1188,11 +1187,13 @@ static void get_first_subsys(const struct cgroup *cgrp,
1188 *subsys_id = test_ss->subsys_id; 1187 *subsys_id = test_ss->subsys_id;
1189} 1188}
1190 1189
1191/* 1190/**
1192 * Attach task 'tsk' to cgroup 'cgrp' 1191 * cgroup_attach_task - attach task 'tsk' to cgroup 'cgrp'
1192 * @cgrp: the cgroup the task is attaching to
1193 * @tsk: the task to be attached
1193 * 1194 *
1194 * Call holding cgroup_mutex. May take task_lock of 1195 * Call holding cgroup_mutex. May take task_lock of
1195 * the task 'pid' during call. 1196 * the task 'tsk' during call.
1196 */ 1197 */
1197int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk) 1198int cgroup_attach_task(struct cgroup *cgrp, struct task_struct *tsk)
1198{ 1199{
@@ -1293,7 +1294,6 @@ static int attach_task_by_pid(struct cgroup *cgrp, char *pidbuf)
1293} 1294}
1294 1295
1295/* The various types of files and directories in a cgroup file system */ 1296/* The various types of files and directories in a cgroup file system */
1296
1297enum cgroup_filetype { 1297enum cgroup_filetype {
1298 FILE_ROOT, 1298 FILE_ROOT,
1299 FILE_DIR, 1299 FILE_DIR,
@@ -1584,12 +1584,11 @@ static int cgroup_create_file(struct dentry *dentry, int mode,
1584} 1584}
1585 1585
1586/* 1586/*
1587 * cgroup_create_dir - create a directory for an object. 1587 * cgroup_create_dir - create a directory for an object.
1588 * cgrp: the cgroup we create the directory for. 1588 * @cgrp: the cgroup we create the directory for. It must have a valid
1589 * It must have a valid ->parent field 1589 * ->parent field. And we are going to fill its ->dentry field.
1590 * And we are going to fill its ->dentry field. 1590 * @dentry: dentry of the new cgroup
1591 * dentry: dentry of the new cgroup 1591 * @mode: mode to set on new directory.
1592 * mode: mode to set on new directory.
1593 */ 1592 */
1594static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry, 1593static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry,
1595 int mode) 1594 int mode)
@@ -1651,8 +1650,12 @@ int cgroup_add_files(struct cgroup *cgrp,
1651 return 0; 1650 return 0;
1652} 1651}
1653 1652
1654/* Count the number of tasks in a cgroup. */ 1653/**
1655 1654 * cgroup_task_count - count the number of tasks in a cgroup.
1655 * @cgrp: the cgroup in question
1656 *
1657 * Return the number of tasks in the cgroup.
1658 */
1656int cgroup_task_count(const struct cgroup *cgrp) 1659int cgroup_task_count(const struct cgroup *cgrp)
1657{ 1660{
1658 int count = 0; 1661 int count = 0;
@@ -1962,12 +1965,13 @@ static int pid_array_load(pid_t *pidarray, int npids, struct cgroup *cgrp)
1962} 1965}
1963 1966
1964/** 1967/**
1965 * Build and fill cgroupstats so that taskstats can export it to user 1968 * cgroupstats_build - build and fill cgroupstats
1966 * space.
1967 *
1968 * @stats: cgroupstats to fill information into 1969 * @stats: cgroupstats to fill information into
1969 * @dentry: A dentry entry belonging to the cgroup for which stats have 1970 * @dentry: A dentry entry belonging to the cgroup for which stats have
1970 * been requested. 1971 * been requested.
1972 *
1973 * Build and fill cgroupstats so that taskstats can export it to user
1974 * space.
1971 */ 1975 */
1972int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry) 1976int cgroupstats_build(struct cgroupstats *stats, struct dentry *dentry)
1973{ 1977{
@@ -2199,14 +2203,13 @@ static void init_cgroup_css(struct cgroup_subsys_state *css,
2199} 2203}
2200 2204
2201/* 2205/*
2202 * cgroup_create - create a cgroup 2206 * cgroup_create - create a cgroup
2203 * parent: cgroup that will be parent of the new cgroup. 2207 * @parent: cgroup that will be parent of the new cgroup
2204 * name: name of the new cgroup. Will be strcpy'ed. 2208 * @dentry: dentry of the new cgroup
2205 * mode: mode to set on new inode 2209 * @mode: mode to set on new inode
2206 * 2210 *
2207 * Must be called with the mutex on the parent inode held 2211 * Must be called with the mutex on the parent inode held
2208 */ 2212 */
2209
2210static long cgroup_create(struct cgroup *parent, struct dentry *dentry, 2213static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
2211 int mode) 2214 int mode)
2212{ 2215{
@@ -2349,13 +2352,12 @@ static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
2349 parent = cgrp->parent; 2352 parent = cgrp->parent;
2350 root = cgrp->root; 2353 root = cgrp->root;
2351 sb = root->sb; 2354 sb = root->sb;
2355
2352 /* 2356 /*
2353 * Call pre_destroy handlers of subsys 2357 * Call pre_destroy handlers of subsys. Notify subsystems
2358 * that rmdir() request comes.
2354 */ 2359 */
2355 cgroup_call_pre_destroy(cgrp); 2360 cgroup_call_pre_destroy(cgrp);
2356 /*
2357 * Notify subsyses that rmdir() request comes.
2358 */
2359 2361
2360 if (cgroup_has_css_refs(cgrp)) { 2362 if (cgroup_has_css_refs(cgrp)) {
2361 mutex_unlock(&cgroup_mutex); 2363 mutex_unlock(&cgroup_mutex);
@@ -2431,8 +2433,10 @@ static void cgroup_init_subsys(struct cgroup_subsys *ss)
2431} 2433}
2432 2434
2433/** 2435/**
2434 * cgroup_init_early - initialize cgroups at system boot, and 2436 * cgroup_init_early - cgroup initialization at system boot
2435 * initialize any subsystems that request early init. 2437 *
2438 * Initialize cgroups at system boot, and initialize any
2439 * subsystems that request early init.
2436 */ 2440 */
2437int __init cgroup_init_early(void) 2441int __init cgroup_init_early(void)
2438{ 2442{
@@ -2474,8 +2478,10 @@ int __init cgroup_init_early(void)
2474} 2478}
2475 2479
2476/** 2480/**
2477 * cgroup_init - register cgroup filesystem and /proc file, and 2481 * cgroup_init - cgroup initialization
2478 * initialize any subsystems that didn't request early init. 2482 *
2483 * Register cgroup filesystem and /proc file, and initialize
2484 * any subsystems that didn't request early init.
2479 */ 2485 */
2480int __init cgroup_init(void) 2486int __init cgroup_init(void)
2481{ 2487{
@@ -2618,7 +2624,7 @@ static struct file_operations proc_cgroupstats_operations = {
2618 2624
2619/** 2625/**
2620 * cgroup_fork - attach newly forked task to its parents cgroup. 2626 * cgroup_fork - attach newly forked task to its parents cgroup.
2621 * @tsk: pointer to task_struct of forking parent process. 2627 * @child: pointer to task_struct of forking parent process.
2622 * 2628 *
2623 * Description: A task inherits its parent's cgroup at fork(). 2629 * Description: A task inherits its parent's cgroup at fork().
2624 * 2630 *
@@ -2642,9 +2648,12 @@ void cgroup_fork(struct task_struct *child)
2642} 2648}
2643 2649
2644/** 2650/**
2645 * cgroup_fork_callbacks - called on a new task very soon before 2651 * cgroup_fork_callbacks - run fork callbacks
2646 * adding it to the tasklist. No need to take any locks since no-one 2652 * @child: the new task
2647 * can be operating on this task 2653 *
2654 * Called on a new task very soon before adding it to the
2655 * tasklist. No need to take any locks since no-one can
2656 * be operating on this task.
2648 */ 2657 */
2649void cgroup_fork_callbacks(struct task_struct *child) 2658void cgroup_fork_callbacks(struct task_struct *child)
2650{ 2659{
@@ -2659,11 +2668,14 @@ void cgroup_fork_callbacks(struct task_struct *child)
2659} 2668}
2660 2669
2661/** 2670/**
2662 * cgroup_post_fork - called on a new task after adding it to the 2671 * cgroup_post_fork - called on a new task after adding it to the task list
2663 * task list. Adds the task to the list running through its css_set 2672 * @child: the task in question
2664 * if necessary. Has to be after the task is visible on the task list 2673 *
2665 * in case we race with the first call to cgroup_iter_start() - to 2674 * Adds the task to the list running through its css_set if necessary.
2666 * guarantee that the new task ends up on its list. */ 2675 * Has to be after the task is visible on the task list in case we race
2676 * with the first call to cgroup_iter_start() - to guarantee that the
2677 * new task ends up on its list.
2678 */
2667void cgroup_post_fork(struct task_struct *child) 2679void cgroup_post_fork(struct task_struct *child)
2668{ 2680{
2669 if (use_task_css_set_links) { 2681 if (use_task_css_set_links) {
@@ -2676,6 +2688,7 @@ void cgroup_post_fork(struct task_struct *child)
2676/** 2688/**
2677 * cgroup_exit - detach cgroup from exiting task 2689 * cgroup_exit - detach cgroup from exiting task
2678 * @tsk: pointer to task_struct of exiting process 2690 * @tsk: pointer to task_struct of exiting process
2691 * @run_callback: run exit callbacks?
2679 * 2692 *
2680 * Description: Detach cgroup from @tsk and release it. 2693 * Description: Detach cgroup from @tsk and release it.
2681 * 2694 *
@@ -2706,7 +2719,6 @@ void cgroup_post_fork(struct task_struct *child)
2706 * top_cgroup isn't going away, and either task has PF_EXITING set, 2719 * top_cgroup isn't going away, and either task has PF_EXITING set,
2707 * which wards off any cgroup_attach_task() attempts, or task is a failed 2720 * which wards off any cgroup_attach_task() attempts, or task is a failed
2708 * fork, never visible to cgroup_attach_task. 2721 * fork, never visible to cgroup_attach_task.
2709 *
2710 */ 2722 */
2711void cgroup_exit(struct task_struct *tsk, int run_callbacks) 2723void cgroup_exit(struct task_struct *tsk, int run_callbacks)
2712{ 2724{
@@ -2743,9 +2755,13 @@ void cgroup_exit(struct task_struct *tsk, int run_callbacks)
2743} 2755}
2744 2756
2745/** 2757/**
2746 * cgroup_clone - duplicate the current cgroup in the hierarchy 2758 * cgroup_clone - clone the cgroup the given subsystem is attached to
2747 * that the given subsystem is attached to, and move this task into 2759 * @tsk: the task to be moved
2748 * the new child 2760 * @subsys: the given subsystem
2761 *
2762 * Duplicate the current cgroup in the hierarchy that the given
2763 * subsystem is attached to, and move this task into the new
2764 * child.
2749 */ 2765 */
2750int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys) 2766int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2751{ 2767{
@@ -2858,9 +2874,12 @@ int cgroup_clone(struct task_struct *tsk, struct cgroup_subsys *subsys)
2858 return ret; 2874 return ret;
2859} 2875}
2860 2876
2861/* 2877/**
2862 * See if "cgrp" is a descendant of the current task's cgroup in 2878 * cgroup_is_descendant - see if @cgrp is a descendant of current task's cgrp
2863 * the appropriate hierarchy 2879 * @cgrp: the cgroup in question
2880 *
2881 * See if @cgrp is a descendant of the current task's cgroup in
2882 * the appropriate hierarchy.
2864 * 2883 *
2865 * If we are sending in dummytop, then presumably we are creating 2884 * If we are sending in dummytop, then presumably we are creating
2866 * the top cgroup in the subsystem. 2885 * the top cgroup in the subsystem.
@@ -2939,9 +2958,7 @@ void __css_put(struct cgroup_subsys_state *css)
2939 * release agent task. We don't bother to wait because the caller of 2958 * release agent task. We don't bother to wait because the caller of
2940 * this routine has no use for the exit status of the release agent 2959 * this routine has no use for the exit status of the release agent
2941 * task, so no sense holding our caller up for that. 2960 * task, so no sense holding our caller up for that.
2942 *
2943 */ 2961 */
2944
2945static void cgroup_release_agent(struct work_struct *work) 2962static void cgroup_release_agent(struct work_struct *work)
2946{ 2963{
2947 BUG_ON(work != &release_agent_work); 2964 BUG_ON(work != &release_agent_work);
diff --git a/kernel/futex.c b/kernel/futex.c
index 221f2128a437..06968cd79200 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -60,6 +60,8 @@
60 60
61#include "rtmutex_common.h" 61#include "rtmutex_common.h"
62 62
63int __read_mostly futex_cmpxchg_enabled;
64
63#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8) 65#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)
64 66
65/* 67/*
@@ -469,6 +471,8 @@ void exit_pi_state_list(struct task_struct *curr)
469 struct futex_hash_bucket *hb; 471 struct futex_hash_bucket *hb;
470 union futex_key key; 472 union futex_key key;
471 473
474 if (!futex_cmpxchg_enabled)
475 return;
472 /* 476 /*
473 * We are a ZOMBIE and nobody can enqueue itself on 477 * We are a ZOMBIE and nobody can enqueue itself on
474 * pi_state_list anymore, but we have to be careful 478 * pi_state_list anymore, but we have to be careful
@@ -1870,6 +1874,8 @@ asmlinkage long
1870sys_set_robust_list(struct robust_list_head __user *head, 1874sys_set_robust_list(struct robust_list_head __user *head,
1871 size_t len) 1875 size_t len)
1872{ 1876{
1877 if (!futex_cmpxchg_enabled)
1878 return -ENOSYS;
1873 /* 1879 /*
1874 * The kernel knows only one size for now: 1880 * The kernel knows only one size for now:
1875 */ 1881 */
@@ -1894,6 +1900,9 @@ sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
1894 struct robust_list_head __user *head; 1900 struct robust_list_head __user *head;
1895 unsigned long ret; 1901 unsigned long ret;
1896 1902
1903 if (!futex_cmpxchg_enabled)
1904 return -ENOSYS;
1905
1897 if (!pid) 1906 if (!pid)
1898 head = current->robust_list; 1907 head = current->robust_list;
1899 else { 1908 else {
@@ -1997,6 +2006,9 @@ void exit_robust_list(struct task_struct *curr)
1997 unsigned long futex_offset; 2006 unsigned long futex_offset;
1998 int rc; 2007 int rc;
1999 2008
2009 if (!futex_cmpxchg_enabled)
2010 return;
2011
2000 /* 2012 /*
2001 * Fetch the list head (which was registered earlier, via 2013 * Fetch the list head (which was registered earlier, via
2002 * sys_set_robust_list()): 2014 * sys_set_robust_list()):
@@ -2051,7 +2063,7 @@ void exit_robust_list(struct task_struct *curr)
2051long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout, 2063long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2052 u32 __user *uaddr2, u32 val2, u32 val3) 2064 u32 __user *uaddr2, u32 val2, u32 val3)
2053{ 2065{
2054 int ret; 2066 int ret = -ENOSYS;
2055 int cmd = op & FUTEX_CMD_MASK; 2067 int cmd = op & FUTEX_CMD_MASK;
2056 struct rw_semaphore *fshared = NULL; 2068 struct rw_semaphore *fshared = NULL;
2057 2069
@@ -2083,13 +2095,16 @@ long do_futex(u32 __user *uaddr, int op, u32 val, ktime_t *timeout,
2083 ret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3); 2095 ret = futex_wake_op(uaddr, fshared, uaddr2, val, val2, val3);
2084 break; 2096 break;
2085 case FUTEX_LOCK_PI: 2097 case FUTEX_LOCK_PI:
2086 ret = futex_lock_pi(uaddr, fshared, val, timeout, 0); 2098 if (futex_cmpxchg_enabled)
2099 ret = futex_lock_pi(uaddr, fshared, val, timeout, 0);
2087 break; 2100 break;
2088 case FUTEX_UNLOCK_PI: 2101 case FUTEX_UNLOCK_PI:
2089 ret = futex_unlock_pi(uaddr, fshared); 2102 if (futex_cmpxchg_enabled)
2103 ret = futex_unlock_pi(uaddr, fshared);
2090 break; 2104 break;
2091 case FUTEX_TRYLOCK_PI: 2105 case FUTEX_TRYLOCK_PI:
2092 ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1); 2106 if (futex_cmpxchg_enabled)
2107 ret = futex_lock_pi(uaddr, fshared, 0, timeout, 1);
2093 break; 2108 break;
2094 default: 2109 default:
2095 ret = -ENOSYS; 2110 ret = -ENOSYS;
@@ -2145,8 +2160,29 @@ static struct file_system_type futex_fs_type = {
2145 2160
2146static int __init init(void) 2161static int __init init(void)
2147{ 2162{
2148 int i = register_filesystem(&futex_fs_type); 2163 u32 curval;
2164 int i;
2165
2166 /*
2167 * This will fail and we want it. Some arch implementations do
2168 * runtime detection of the futex_atomic_cmpxchg_inatomic()
2169 * functionality. We want to know that before we call in any
2170 * of the complex code paths. Also we want to prevent
2171 * registration of robust lists in that case. NULL is
2172 * guaranteed to fault and we get -EFAULT on functional
2173 * implementation, the non functional ones will return
2174 * -ENOSYS.
2175 */
2176 curval = cmpxchg_futex_value_locked(NULL, 0, 0);
2177 if (curval == -EFAULT)
2178 futex_cmpxchg_enabled = 1;
2149 2179
2180 for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2181 plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2182 spin_lock_init(&futex_queues[i].lock);
2183 }
2184
2185 i = register_filesystem(&futex_fs_type);
2150 if (i) 2186 if (i)
2151 return i; 2187 return i;
2152 2188
@@ -2156,10 +2192,6 @@ static int __init init(void)
2156 return PTR_ERR(futex_mnt); 2192 return PTR_ERR(futex_mnt);
2157 } 2193 }
2158 2194
2159 for (i = 0; i < ARRAY_SIZE(futex_queues); i++) {
2160 plist_head_init(&futex_queues[i].chain, &futex_queues[i].lock);
2161 spin_lock_init(&futex_queues[i].lock);
2162 }
2163 return 0; 2195 return 0;
2164} 2196}
2165__initcall(init); 2197__initcall(init);
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index 7d5e4b016f39..ff90f049f8f6 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -54,6 +54,9 @@ void compat_exit_robust_list(struct task_struct *curr)
54 compat_long_t futex_offset; 54 compat_long_t futex_offset;
55 int rc; 55 int rc;
56 56
57 if (!futex_cmpxchg_enabled)
58 return;
59
57 /* 60 /*
58 * Fetch the list head (which was registered earlier, via 61 * Fetch the list head (which was registered earlier, via
59 * sys_set_robust_list()): 62 * sys_set_robust_list()):
@@ -115,6 +118,9 @@ asmlinkage long
115compat_sys_set_robust_list(struct compat_robust_list_head __user *head, 118compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
116 compat_size_t len) 119 compat_size_t len)
117{ 120{
121 if (!futex_cmpxchg_enabled)
122 return -ENOSYS;
123
118 if (unlikely(len != sizeof(*head))) 124 if (unlikely(len != sizeof(*head)))
119 return -EINVAL; 125 return -EINVAL;
120 126
@@ -130,6 +136,9 @@ compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
130 struct compat_robust_list_head __user *head; 136 struct compat_robust_list_head __user *head;
131 unsigned long ret; 137 unsigned long ret;
132 138
139 if (!futex_cmpxchg_enabled)
140 return -ENOSYS;
141
133 if (!pid) 142 if (!pid)
134 head = current->compat_robust_list; 143 head = current->compat_robust_list;
135 else { 144 else {
diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index cc54c6276356..fdb3fbe2b0c4 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -246,6 +246,17 @@ static unsigned int default_startup(unsigned int irq)
246} 246}
247 247
248/* 248/*
249 * default shutdown function
250 */
251static void default_shutdown(unsigned int irq)
252{
253 struct irq_desc *desc = irq_desc + irq;
254
255 desc->chip->mask(irq);
256 desc->status |= IRQ_MASKED;
257}
258
259/*
249 * Fixup enable/disable function pointers 260 * Fixup enable/disable function pointers
250 */ 261 */
251void irq_chip_set_defaults(struct irq_chip *chip) 262void irq_chip_set_defaults(struct irq_chip *chip)
@@ -256,8 +267,15 @@ void irq_chip_set_defaults(struct irq_chip *chip)
256 chip->disable = default_disable; 267 chip->disable = default_disable;
257 if (!chip->startup) 268 if (!chip->startup)
258 chip->startup = default_startup; 269 chip->startup = default_startup;
270 /*
271 * We use chip->disable, when the user provided its own. When
272 * we have default_disable set for chip->disable, then we need
273 * to use default_shutdown, otherwise the irq line is not
274 * disabled on free_irq():
275 */
259 if (!chip->shutdown) 276 if (!chip->shutdown)
260 chip->shutdown = chip->disable; 277 chip->shutdown = chip->disable != default_disable ?
278 chip->disable : default_shutdown;
261 if (!chip->name) 279 if (!chip->name)
262 chip->name = chip->typename; 280 chip->name = chip->typename;
263 if (!chip->end) 281 if (!chip->end)
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c
index a6b2bc831dd0..088dabbf2d6a 100644
--- a/kernel/irq/spurious.c
+++ b/kernel/irq/spurious.c
@@ -6,6 +6,7 @@
6 * This file contains spurious interrupt handling. 6 * This file contains spurious interrupt handling.
7 */ 7 */
8 8
9#include <linux/jiffies.h>
9#include <linux/irq.h> 10#include <linux/irq.h>
10#include <linux/module.h> 11#include <linux/module.h>
11#include <linux/kallsyms.h> 12#include <linux/kallsyms.h>
@@ -179,7 +180,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc,
179 * otherwise the couter becomes a doomsday timer for otherwise 180 * otherwise the couter becomes a doomsday timer for otherwise
180 * working systems 181 * working systems
181 */ 182 */
182 if (jiffies - desc->last_unhandled > HZ/10) 183 if (time_after(jiffies, desc->last_unhandled + HZ/10))
183 desc->irqs_unhandled = 1; 184 desc->irqs_unhandled = 1;
184 else 185 else
185 desc->irqs_unhandled++; 186 desc->irqs_unhandled++;
diff --git a/kernel/marker.c b/kernel/marker.c
index c4c2cd8b61f5..50effc01d9a2 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -61,8 +61,8 @@ struct marker_entry {
61 int refcount; /* Number of times armed. 0 if disarmed. */ 61 int refcount; /* Number of times armed. 0 if disarmed. */
62 struct rcu_head rcu; 62 struct rcu_head rcu;
63 void *oldptr; 63 void *oldptr;
64 char rcu_pending:1; 64 unsigned char rcu_pending:1;
65 char ptype:1; 65 unsigned char ptype:1;
66 char name[0]; /* Contains name'\0'format'\0' */ 66 char name[0]; /* Contains name'\0'format'\0' */
67}; 67};
68 68
diff --git a/kernel/module.c b/kernel/module.c
index 92595bad3812..901cd6ac2f11 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -987,12 +987,11 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
987 return ret; 987 return ret;
988} 988}
989 989
990
991/* 990/*
992 * /sys/module/foo/sections stuff 991 * /sys/module/foo/sections stuff
993 * J. Corbet <corbet@lwn.net> 992 * J. Corbet <corbet@lwn.net>
994 */ 993 */
995#ifdef CONFIG_KALLSYMS 994#if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS)
996static ssize_t module_sect_show(struct module_attribute *mattr, 995static ssize_t module_sect_show(struct module_attribute *mattr,
997 struct module *mod, char *buf) 996 struct module *mod, char *buf)
998{ 997{
@@ -1188,7 +1187,7 @@ static inline void add_notes_attrs(struct module *mod, unsigned int nsect,
1188static inline void remove_notes_attrs(struct module *mod) 1187static inline void remove_notes_attrs(struct module *mod)
1189{ 1188{
1190} 1189}
1191#endif /* CONFIG_KALLSYMS */ 1190#endif
1192 1191
1193#ifdef CONFIG_SYSFS 1192#ifdef CONFIG_SYSFS
1194int module_add_modinfo_attrs(struct module *mod) 1193int module_add_modinfo_attrs(struct module *mod)
@@ -1231,9 +1230,7 @@ void module_remove_modinfo_attrs(struct module *mod)
1231 } 1230 }
1232 kfree(mod->modinfo_attrs); 1231 kfree(mod->modinfo_attrs);
1233} 1232}
1234#endif
1235 1233
1236#ifdef CONFIG_SYSFS
1237int mod_sysfs_init(struct module *mod) 1234int mod_sysfs_init(struct module *mod)
1238{ 1235{
1239 int err; 1236 int err;
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index 859a8e59773a..14a656cdc652 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -391,7 +391,7 @@ int hibernation_platform_enter(void)
391 goto Close; 391 goto Close;
392 392
393 suspend_console(); 393 suspend_console();
394 error = device_suspend(PMSG_SUSPEND); 394 error = device_suspend(PMSG_HIBERNATE);
395 if (error) 395 if (error)
396 goto Resume_console; 396 goto Resume_console;
397 397
@@ -404,7 +404,7 @@ int hibernation_platform_enter(void)
404 goto Finish; 404 goto Finish;
405 405
406 local_irq_disable(); 406 local_irq_disable();
407 error = device_power_down(PMSG_SUSPEND); 407 error = device_power_down(PMSG_HIBERNATE);
408 if (!error) { 408 if (!error) {
409 hibernation_ops->enter(); 409 hibernation_ops->enter();
410 /* We should never get here */ 410 /* We should never get here */
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 95250d7c8d91..72a020cabb4c 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -875,8 +875,8 @@ static inline void *saveable_highmem_page(unsigned long pfn) { return NULL; }
875#endif /* CONFIG_HIGHMEM */ 875#endif /* CONFIG_HIGHMEM */
876 876
877/** 877/**
878 * saveable - Determine whether a non-highmem page should be included in 878 * saveable_page - Determine whether a non-highmem page should be included
879 * the suspend image. 879 * in the suspend image.
880 * 880 *
881 * We should save the page if it isn't Nosave, and is not in the range 881 * We should save the page if it isn't Nosave, and is not in the range
882 * of pages statically defined as 'unsaveable', and it isn't a part of 882 * of pages statically defined as 'unsaveable', and it isn't a part of
@@ -897,7 +897,8 @@ static struct page *saveable_page(unsigned long pfn)
897 if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page)) 897 if (swsusp_page_is_forbidden(page) || swsusp_page_is_free(page))
898 return NULL; 898 return NULL;
899 899
900 if (PageReserved(page) && pfn_is_nosave(pfn)) 900 if (PageReserved(page)
901 && (!kernel_page_present(page) || pfn_is_nosave(pfn)))
901 return NULL; 902 return NULL;
902 903
903 return page; 904 return page;
@@ -938,6 +939,25 @@ static inline void do_copy_page(long *dst, long *src)
938 *dst++ = *src++; 939 *dst++ = *src++;
939} 940}
940 941
942
943/**
944 * safe_copy_page - check if the page we are going to copy is marked as
945 * present in the kernel page tables (this always is the case if
946 * CONFIG_DEBUG_PAGEALLOC is not set and in that case
947 * kernel_page_present() always returns 'true').
948 */
949static void safe_copy_page(void *dst, struct page *s_page)
950{
951 if (kernel_page_present(s_page)) {
952 do_copy_page(dst, page_address(s_page));
953 } else {
954 kernel_map_pages(s_page, 1, 1);
955 do_copy_page(dst, page_address(s_page));
956 kernel_map_pages(s_page, 1, 0);
957 }
958}
959
960
941#ifdef CONFIG_HIGHMEM 961#ifdef CONFIG_HIGHMEM
942static inline struct page * 962static inline struct page *
943page_is_saveable(struct zone *zone, unsigned long pfn) 963page_is_saveable(struct zone *zone, unsigned long pfn)
@@ -946,8 +966,7 @@ page_is_saveable(struct zone *zone, unsigned long pfn)
946 saveable_highmem_page(pfn) : saveable_page(pfn); 966 saveable_highmem_page(pfn) : saveable_page(pfn);
947} 967}
948 968
949static inline void 969static void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
950copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
951{ 970{
952 struct page *s_page, *d_page; 971 struct page *s_page, *d_page;
953 void *src, *dst; 972 void *src, *dst;
@@ -961,29 +980,26 @@ copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
961 kunmap_atomic(src, KM_USER0); 980 kunmap_atomic(src, KM_USER0);
962 kunmap_atomic(dst, KM_USER1); 981 kunmap_atomic(dst, KM_USER1);
963 } else { 982 } else {
964 src = page_address(s_page);
965 if (PageHighMem(d_page)) { 983 if (PageHighMem(d_page)) {
966 /* Page pointed to by src may contain some kernel 984 /* Page pointed to by src may contain some kernel
967 * data modified by kmap_atomic() 985 * data modified by kmap_atomic()
968 */ 986 */
969 do_copy_page(buffer, src); 987 safe_copy_page(buffer, s_page);
970 dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0); 988 dst = kmap_atomic(pfn_to_page(dst_pfn), KM_USER0);
971 memcpy(dst, buffer, PAGE_SIZE); 989 memcpy(dst, buffer, PAGE_SIZE);
972 kunmap_atomic(dst, KM_USER0); 990 kunmap_atomic(dst, KM_USER0);
973 } else { 991 } else {
974 dst = page_address(d_page); 992 safe_copy_page(page_address(d_page), s_page);
975 do_copy_page(dst, src);
976 } 993 }
977 } 994 }
978} 995}
979#else 996#else
980#define page_is_saveable(zone, pfn) saveable_page(pfn) 997#define page_is_saveable(zone, pfn) saveable_page(pfn)
981 998
982static inline void 999static inline void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
983copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
984{ 1000{
985 do_copy_page(page_address(pfn_to_page(dst_pfn)), 1001 safe_copy_page(page_address(pfn_to_page(dst_pfn)),
986 page_address(pfn_to_page(src_pfn))); 1002 pfn_to_page(src_pfn));
987} 1003}
988#endif /* CONFIG_HIGHMEM */ 1004#endif /* CONFIG_HIGHMEM */
989 1005
diff --git a/kernel/sched.c b/kernel/sched.c
index f28f19e65b59..b387a8de26a5 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1831,6 +1831,7 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
1831 long old_state; 1831 long old_state;
1832 struct rq *rq; 1832 struct rq *rq;
1833 1833
1834 smp_wmb();
1834 rq = task_rq_lock(p, &flags); 1835 rq = task_rq_lock(p, &flags);
1835 old_state = p->state; 1836 old_state = p->state;
1836 if (!(old_state & state)) 1837 if (!(old_state & state))
@@ -3766,7 +3767,7 @@ void scheduler_tick(void)
3766 3767
3767#if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT) 3768#if defined(CONFIG_PREEMPT) && defined(CONFIG_DEBUG_PREEMPT)
3768 3769
3769void add_preempt_count(int val) 3770void __kprobes add_preempt_count(int val)
3770{ 3771{
3771 /* 3772 /*
3772 * Underflow? 3773 * Underflow?
@@ -3782,7 +3783,7 @@ void add_preempt_count(int val)
3782} 3783}
3783EXPORT_SYMBOL(add_preempt_count); 3784EXPORT_SYMBOL(add_preempt_count);
3784 3785
3785void sub_preempt_count(int val) 3786void __kprobes sub_preempt_count(int val)
3786{ 3787{
3787 /* 3788 /*
3788 * Underflow? 3789 * Underflow?
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index d3d94c1a0fd2..67fe8fc21fb1 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -65,9 +65,9 @@ print_timer(struct seq_file *m, struct hrtimer *timer, int idx, u64 now)
65 SEQ_printf(m, ", %s/%d", tmp, timer->start_pid); 65 SEQ_printf(m, ", %s/%d", tmp, timer->start_pid);
66#endif 66#endif
67 SEQ_printf(m, "\n"); 67 SEQ_printf(m, "\n");
68 SEQ_printf(m, " # expires at %Lu nsecs [in %Lu nsecs]\n", 68 SEQ_printf(m, " # expires at %Lu nsecs [in %Ld nsecs]\n",
69 (unsigned long long)ktime_to_ns(timer->expires), 69 (unsigned long long)ktime_to_ns(timer->expires),
70 (unsigned long long)(ktime_to_ns(timer->expires) - now)); 70 (long long)(ktime_to_ns(timer->expires) - now));
71} 71}
72 72
73static void 73static void