diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 4 | ||||
-rw-r--r-- | kernel/auditfilter.c | 26 | ||||
-rw-r--r-- | kernel/auditsc.c | 117 | ||||
-rw-r--r-- | kernel/delayacct.c | 8 | ||||
-rw-r--r-- | kernel/hrtimer.c | 4 | ||||
-rw-r--r-- | kernel/irq/manage.c | 28 | ||||
-rw-r--r-- | kernel/kprobes.c | 1 | ||||
-rw-r--r-- | kernel/rcupdate.c | 4 | ||||
-rw-r--r-- | kernel/rtmutex.c | 2 | ||||
-rw-r--r-- | kernel/sched.c | 22 | ||||
-rw-r--r-- | kernel/signal.c | 25 | ||||
-rw-r--r-- | kernel/softirq.c | 22 | ||||
-rw-r--r-- | kernel/softlockup.c | 4 | ||||
-rw-r--r-- | kernel/taskstats.c | 32 | ||||
-rw-r--r-- | kernel/timer.c | 8 | ||||
-rw-r--r-- | kernel/workqueue.c | 58 |
16 files changed, 267 insertions, 98 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index d417ca1db79b..0a36091ed712 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -690,9 +690,7 @@ static const struct inotify_operations audit_inotify_ops = { | |||
690 | /* Initialize audit support at boot time. */ | 690 | /* Initialize audit support at boot time. */ |
691 | static int __init audit_init(void) | 691 | static int __init audit_init(void) |
692 | { | 692 | { |
693 | #ifdef CONFIG_AUDITSYSCALL | ||
694 | int i; | 693 | int i; |
695 | #endif | ||
696 | 694 | ||
697 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", | 695 | printk(KERN_INFO "audit: initializing netlink socket (%s)\n", |
698 | audit_default ? "enabled" : "disabled"); | 696 | audit_default ? "enabled" : "disabled"); |
@@ -717,10 +715,10 @@ static int __init audit_init(void) | |||
717 | audit_ih = inotify_init(&audit_inotify_ops); | 715 | audit_ih = inotify_init(&audit_inotify_ops); |
718 | if (IS_ERR(audit_ih)) | 716 | if (IS_ERR(audit_ih)) |
719 | audit_panic("cannot initialize inotify handle"); | 717 | audit_panic("cannot initialize inotify handle"); |
718 | #endif | ||
720 | 719 | ||
721 | for (i = 0; i < AUDIT_INODE_BUCKETS; i++) | 720 | for (i = 0; i < AUDIT_INODE_BUCKETS; i++) |
722 | INIT_LIST_HEAD(&audit_inode_hash[i]); | 721 | INIT_LIST_HEAD(&audit_inode_hash[i]); |
723 | #endif | ||
724 | 722 | ||
725 | return 0; | 723 | return 0; |
726 | } | 724 | } |
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c index 5b4e16276ca0..6a9a5c5a4e7d 100644 --- a/kernel/auditfilter.c +++ b/kernel/auditfilter.c | |||
@@ -442,6 +442,7 @@ static struct audit_entry *audit_rule_to_entry(struct audit_rule *rule) | |||
442 | case AUDIT_EQUAL: | 442 | case AUDIT_EQUAL: |
443 | break; | 443 | break; |
444 | default: | 444 | default: |
445 | err = -EINVAL; | ||
445 | goto exit_free; | 446 | goto exit_free; |
446 | } | 447 | } |
447 | } | 448 | } |
@@ -579,6 +580,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data, | |||
579 | case AUDIT_EQUAL: | 580 | case AUDIT_EQUAL: |
580 | break; | 581 | break; |
581 | default: | 582 | default: |
583 | err = -EINVAL; | ||
582 | goto exit_free; | 584 | goto exit_free; |
583 | } | 585 | } |
584 | } | 586 | } |
@@ -1134,6 +1136,14 @@ static inline int audit_add_rule(struct audit_entry *entry, | |||
1134 | struct audit_watch *watch = entry->rule.watch; | 1136 | struct audit_watch *watch = entry->rule.watch; |
1135 | struct nameidata *ndp, *ndw; | 1137 | struct nameidata *ndp, *ndw; |
1136 | int h, err, putnd_needed = 0; | 1138 | int h, err, putnd_needed = 0; |
1139 | #ifdef CONFIG_AUDITSYSCALL | ||
1140 | int dont_count = 0; | ||
1141 | |||
1142 | /* If either of these, don't count towards total */ | ||
1143 | if (entry->rule.listnr == AUDIT_FILTER_USER || | ||
1144 | entry->rule.listnr == AUDIT_FILTER_TYPE) | ||
1145 | dont_count = 1; | ||
1146 | #endif | ||
1137 | 1147 | ||
1138 | if (inode_f) { | 1148 | if (inode_f) { |
1139 | h = audit_hash_ino(inode_f->val); | 1149 | h = audit_hash_ino(inode_f->val); |
@@ -1174,6 +1184,10 @@ static inline int audit_add_rule(struct audit_entry *entry, | |||
1174 | } else { | 1184 | } else { |
1175 | list_add_tail_rcu(&entry->list, list); | 1185 | list_add_tail_rcu(&entry->list, list); |
1176 | } | 1186 | } |
1187 | #ifdef CONFIG_AUDITSYSCALL | ||
1188 | if (!dont_count) | ||
1189 | audit_n_rules++; | ||
1190 | #endif | ||
1177 | mutex_unlock(&audit_filter_mutex); | 1191 | mutex_unlock(&audit_filter_mutex); |
1178 | 1192 | ||
1179 | if (putnd_needed) | 1193 | if (putnd_needed) |
@@ -1198,6 +1212,14 @@ static inline int audit_del_rule(struct audit_entry *entry, | |||
1198 | struct audit_watch *watch, *tmp_watch = entry->rule.watch; | 1212 | struct audit_watch *watch, *tmp_watch = entry->rule.watch; |
1199 | LIST_HEAD(inotify_list); | 1213 | LIST_HEAD(inotify_list); |
1200 | int h, ret = 0; | 1214 | int h, ret = 0; |
1215 | #ifdef CONFIG_AUDITSYSCALL | ||
1216 | int dont_count = 0; | ||
1217 | |||
1218 | /* If either of these, don't count towards total */ | ||
1219 | if (entry->rule.listnr == AUDIT_FILTER_USER || | ||
1220 | entry->rule.listnr == AUDIT_FILTER_TYPE) | ||
1221 | dont_count = 1; | ||
1222 | #endif | ||
1201 | 1223 | ||
1202 | if (inode_f) { | 1224 | if (inode_f) { |
1203 | h = audit_hash_ino(inode_f->val); | 1225 | h = audit_hash_ino(inode_f->val); |
@@ -1235,6 +1257,10 @@ static inline int audit_del_rule(struct audit_entry *entry, | |||
1235 | list_del_rcu(&e->list); | 1257 | list_del_rcu(&e->list); |
1236 | call_rcu(&e->rcu, audit_free_rule_rcu); | 1258 | call_rcu(&e->rcu, audit_free_rule_rcu); |
1237 | 1259 | ||
1260 | #ifdef CONFIG_AUDITSYSCALL | ||
1261 | if (!dont_count) | ||
1262 | audit_n_rules--; | ||
1263 | #endif | ||
1238 | mutex_unlock(&audit_filter_mutex); | 1264 | mutex_unlock(&audit_filter_mutex); |
1239 | 1265 | ||
1240 | if (!list_empty(&inotify_list)) | 1266 | if (!list_empty(&inotify_list)) |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index ae40ac8c39e7..efc1b74bebf3 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -85,6 +85,9 @@ extern int audit_enabled; | |||
85 | /* Indicates that audit should log the full pathname. */ | 85 | /* Indicates that audit should log the full pathname. */ |
86 | #define AUDIT_NAME_FULL -1 | 86 | #define AUDIT_NAME_FULL -1 |
87 | 87 | ||
88 | /* number of audit rules */ | ||
89 | int audit_n_rules; | ||
90 | |||
88 | /* When fs/namei.c:getname() is called, we store the pointer in name and | 91 | /* When fs/namei.c:getname() is called, we store the pointer in name and |
89 | * we don't let putname() free it (instead we free all of the saved | 92 | * we don't let putname() free it (instead we free all of the saved |
90 | * pointers at syscall exit time). | 93 | * pointers at syscall exit time). |
@@ -174,6 +177,7 @@ struct audit_aux_data_path { | |||
174 | 177 | ||
175 | /* The per-task audit context. */ | 178 | /* The per-task audit context. */ |
176 | struct audit_context { | 179 | struct audit_context { |
180 | int dummy; /* must be the first element */ | ||
177 | int in_syscall; /* 1 if task is in a syscall */ | 181 | int in_syscall; /* 1 if task is in a syscall */ |
178 | enum audit_state state; | 182 | enum audit_state state; |
179 | unsigned int serial; /* serial number for record */ | 183 | unsigned int serial; /* serial number for record */ |
@@ -514,7 +518,7 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk, | |||
514 | context->return_valid = return_valid; | 518 | context->return_valid = return_valid; |
515 | context->return_code = return_code; | 519 | context->return_code = return_code; |
516 | 520 | ||
517 | if (context->in_syscall && !context->auditable) { | 521 | if (context->in_syscall && !context->dummy && !context->auditable) { |
518 | enum audit_state state; | 522 | enum audit_state state; |
519 | 523 | ||
520 | state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]); | 524 | state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_EXIT]); |
@@ -530,17 +534,7 @@ static inline struct audit_context *audit_get_context(struct task_struct *tsk, | |||
530 | } | 534 | } |
531 | 535 | ||
532 | get_context: | 536 | get_context: |
533 | context->pid = tsk->pid; | 537 | |
534 | context->ppid = sys_getppid(); /* sic. tsk == current in all cases */ | ||
535 | context->uid = tsk->uid; | ||
536 | context->gid = tsk->gid; | ||
537 | context->euid = tsk->euid; | ||
538 | context->suid = tsk->suid; | ||
539 | context->fsuid = tsk->fsuid; | ||
540 | context->egid = tsk->egid; | ||
541 | context->sgid = tsk->sgid; | ||
542 | context->fsgid = tsk->fsgid; | ||
543 | context->personality = tsk->personality; | ||
544 | tsk->audit_context = NULL; | 538 | tsk->audit_context = NULL; |
545 | return context; | 539 | return context; |
546 | } | 540 | } |
@@ -749,6 +743,17 @@ static void audit_log_exit(struct audit_context *context, struct task_struct *ts | |||
749 | const char *tty; | 743 | const char *tty; |
750 | 744 | ||
751 | /* tsk == current */ | 745 | /* tsk == current */ |
746 | context->pid = tsk->pid; | ||
747 | context->ppid = sys_getppid(); /* sic. tsk == current in all cases */ | ||
748 | context->uid = tsk->uid; | ||
749 | context->gid = tsk->gid; | ||
750 | context->euid = tsk->euid; | ||
751 | context->suid = tsk->suid; | ||
752 | context->fsuid = tsk->fsuid; | ||
753 | context->egid = tsk->egid; | ||
754 | context->sgid = tsk->sgid; | ||
755 | context->fsgid = tsk->fsgid; | ||
756 | context->personality = tsk->personality; | ||
752 | 757 | ||
753 | ab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL); | 758 | ab = audit_log_start(context, GFP_KERNEL, AUDIT_SYSCALL); |
754 | if (!ab) | 759 | if (!ab) |
@@ -1066,7 +1071,8 @@ void audit_syscall_entry(int arch, int major, | |||
1066 | context->argv[3] = a4; | 1071 | context->argv[3] = a4; |
1067 | 1072 | ||
1068 | state = context->state; | 1073 | state = context->state; |
1069 | if (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT) | 1074 | context->dummy = !audit_n_rules; |
1075 | if (!context->dummy && (state == AUDIT_SETUP_CONTEXT || state == AUDIT_BUILD_CONTEXT)) | ||
1070 | state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]); | 1076 | state = audit_filter_syscall(tsk, context, &audit_filter_list[AUDIT_FILTER_ENTRY]); |
1071 | if (likely(state == AUDIT_DISABLED)) | 1077 | if (likely(state == AUDIT_DISABLED)) |
1072 | return; | 1078 | return; |
@@ -1199,14 +1205,18 @@ void audit_putname(const char *name) | |||
1199 | #endif | 1205 | #endif |
1200 | } | 1206 | } |
1201 | 1207 | ||
1202 | static void audit_inode_context(int idx, const struct inode *inode) | 1208 | /* Copy inode data into an audit_names. */ |
1209 | static void audit_copy_inode(struct audit_names *name, const struct inode *inode) | ||
1203 | { | 1210 | { |
1204 | struct audit_context *context = current->audit_context; | 1211 | name->ino = inode->i_ino; |
1205 | 1212 | name->dev = inode->i_sb->s_dev; | |
1206 | selinux_get_inode_sid(inode, &context->names[idx].osid); | 1213 | name->mode = inode->i_mode; |
1214 | name->uid = inode->i_uid; | ||
1215 | name->gid = inode->i_gid; | ||
1216 | name->rdev = inode->i_rdev; | ||
1217 | selinux_get_inode_sid(inode, &name->osid); | ||
1207 | } | 1218 | } |
1208 | 1219 | ||
1209 | |||
1210 | /** | 1220 | /** |
1211 | * audit_inode - store the inode and device from a lookup | 1221 | * audit_inode - store the inode and device from a lookup |
1212 | * @name: name being audited | 1222 | * @name: name being audited |
@@ -1240,20 +1250,14 @@ void __audit_inode(const char *name, const struct inode *inode) | |||
1240 | ++context->ino_count; | 1250 | ++context->ino_count; |
1241 | #endif | 1251 | #endif |
1242 | } | 1252 | } |
1243 | context->names[idx].ino = inode->i_ino; | 1253 | audit_copy_inode(&context->names[idx], inode); |
1244 | context->names[idx].dev = inode->i_sb->s_dev; | ||
1245 | context->names[idx].mode = inode->i_mode; | ||
1246 | context->names[idx].uid = inode->i_uid; | ||
1247 | context->names[idx].gid = inode->i_gid; | ||
1248 | context->names[idx].rdev = inode->i_rdev; | ||
1249 | audit_inode_context(idx, inode); | ||
1250 | } | 1254 | } |
1251 | 1255 | ||
1252 | /** | 1256 | /** |
1253 | * audit_inode_child - collect inode info for created/removed objects | 1257 | * audit_inode_child - collect inode info for created/removed objects |
1254 | * @dname: inode's dentry name | 1258 | * @dname: inode's dentry name |
1255 | * @inode: inode being audited | 1259 | * @inode: inode being audited |
1256 | * @pino: inode number of dentry parent | 1260 | * @parent: inode of dentry parent |
1257 | * | 1261 | * |
1258 | * For syscalls that create or remove filesystem objects, audit_inode | 1262 | * For syscalls that create or remove filesystem objects, audit_inode |
1259 | * can only collect information for the filesystem object's parent. | 1263 | * can only collect information for the filesystem object's parent. |
@@ -1264,7 +1268,7 @@ void __audit_inode(const char *name, const struct inode *inode) | |||
1264 | * unsuccessful attempts. | 1268 | * unsuccessful attempts. |
1265 | */ | 1269 | */ |
1266 | void __audit_inode_child(const char *dname, const struct inode *inode, | 1270 | void __audit_inode_child(const char *dname, const struct inode *inode, |
1267 | unsigned long pino) | 1271 | const struct inode *parent) |
1268 | { | 1272 | { |
1269 | int idx; | 1273 | int idx; |
1270 | struct audit_context *context = current->audit_context; | 1274 | struct audit_context *context = current->audit_context; |
@@ -1278,7 +1282,7 @@ void __audit_inode_child(const char *dname, const struct inode *inode, | |||
1278 | if (!dname) | 1282 | if (!dname) |
1279 | goto update_context; | 1283 | goto update_context; |
1280 | for (idx = 0; idx < context->name_count; idx++) | 1284 | for (idx = 0; idx < context->name_count; idx++) |
1281 | if (context->names[idx].ino == pino) { | 1285 | if (context->names[idx].ino == parent->i_ino) { |
1282 | const char *name = context->names[idx].name; | 1286 | const char *name = context->names[idx].name; |
1283 | 1287 | ||
1284 | if (!name) | 1288 | if (!name) |
@@ -1302,16 +1306,47 @@ update_context: | |||
1302 | context->names[idx].name_len = AUDIT_NAME_FULL; | 1306 | context->names[idx].name_len = AUDIT_NAME_FULL; |
1303 | context->names[idx].name_put = 0; /* don't call __putname() */ | 1307 | context->names[idx].name_put = 0; /* don't call __putname() */ |
1304 | 1308 | ||
1305 | if (inode) { | 1309 | if (!inode) |
1306 | context->names[idx].ino = inode->i_ino; | 1310 | context->names[idx].ino = (unsigned long)-1; |
1307 | context->names[idx].dev = inode->i_sb->s_dev; | 1311 | else |
1308 | context->names[idx].mode = inode->i_mode; | 1312 | audit_copy_inode(&context->names[idx], inode); |
1309 | context->names[idx].uid = inode->i_uid; | 1313 | |
1310 | context->names[idx].gid = inode->i_gid; | 1314 | /* A parent was not found in audit_names, so copy the inode data for the |
1311 | context->names[idx].rdev = inode->i_rdev; | 1315 | * provided parent. */ |
1312 | audit_inode_context(idx, inode); | 1316 | if (!found_name) { |
1313 | } else | 1317 | idx = context->name_count++; |
1314 | context->names[idx].ino = (unsigned long)-1; | 1318 | #if AUDIT_DEBUG |
1319 | context->ino_count++; | ||
1320 | #endif | ||
1321 | audit_copy_inode(&context->names[idx], parent); | ||
1322 | } | ||
1323 | } | ||
1324 | |||
1325 | /** | ||
1326 | * audit_inode_update - update inode info for last collected name | ||
1327 | * @inode: inode being audited | ||
1328 | * | ||
1329 | * When open() is called on an existing object with the O_CREAT flag, the inode | ||
1330 | * data audit initially collects is incorrect. This additional hook ensures | ||
1331 | * audit has the inode data for the actual object to be opened. | ||
1332 | */ | ||
1333 | void __audit_inode_update(const struct inode *inode) | ||
1334 | { | ||
1335 | struct audit_context *context = current->audit_context; | ||
1336 | int idx; | ||
1337 | |||
1338 | if (!context->in_syscall || !inode) | ||
1339 | return; | ||
1340 | |||
1341 | if (context->name_count == 0) { | ||
1342 | context->name_count++; | ||
1343 | #if AUDIT_DEBUG | ||
1344 | context->ino_count++; | ||
1345 | #endif | ||
1346 | } | ||
1347 | idx = context->name_count - 1; | ||
1348 | |||
1349 | audit_copy_inode(&context->names[idx], inode); | ||
1315 | } | 1350 | } |
1316 | 1351 | ||
1317 | /** | 1352 | /** |
@@ -1642,7 +1677,7 @@ int audit_bprm(struct linux_binprm *bprm) | |||
1642 | unsigned long p, next; | 1677 | unsigned long p, next; |
1643 | void *to; | 1678 | void *to; |
1644 | 1679 | ||
1645 | if (likely(!audit_enabled || !context)) | 1680 | if (likely(!audit_enabled || !context || context->dummy)) |
1646 | return 0; | 1681 | return 0; |
1647 | 1682 | ||
1648 | ax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p, | 1683 | ax = kmalloc(sizeof(*ax) + PAGE_SIZE * MAX_ARG_PAGES - bprm->p, |
@@ -1680,7 +1715,7 @@ int audit_socketcall(int nargs, unsigned long *args) | |||
1680 | struct audit_aux_data_socketcall *ax; | 1715 | struct audit_aux_data_socketcall *ax; |
1681 | struct audit_context *context = current->audit_context; | 1716 | struct audit_context *context = current->audit_context; |
1682 | 1717 | ||
1683 | if (likely(!context)) | 1718 | if (likely(!context || context->dummy)) |
1684 | return 0; | 1719 | return 0; |
1685 | 1720 | ||
1686 | ax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL); | 1721 | ax = kmalloc(sizeof(*ax) + nargs * sizeof(unsigned long), GFP_KERNEL); |
@@ -1708,7 +1743,7 @@ int audit_sockaddr(int len, void *a) | |||
1708 | struct audit_aux_data_sockaddr *ax; | 1743 | struct audit_aux_data_sockaddr *ax; |
1709 | struct audit_context *context = current->audit_context; | 1744 | struct audit_context *context = current->audit_context; |
1710 | 1745 | ||
1711 | if (likely(!context)) | 1746 | if (likely(!context || context->dummy)) |
1712 | return 0; | 1747 | return 0; |
1713 | 1748 | ||
1714 | ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL); | 1749 | ax = kmalloc(sizeof(*ax) + len, GFP_KERNEL); |
diff --git a/kernel/delayacct.c b/kernel/delayacct.c index f05392d64267..57ca3730205d 100644 --- a/kernel/delayacct.c +++ b/kernel/delayacct.c | |||
@@ -19,15 +19,15 @@ | |||
19 | #include <linux/sysctl.h> | 19 | #include <linux/sysctl.h> |
20 | #include <linux/delayacct.h> | 20 | #include <linux/delayacct.h> |
21 | 21 | ||
22 | int delayacct_on __read_mostly; /* Delay accounting turned on/off */ | 22 | int delayacct_on __read_mostly = 1; /* Delay accounting turned on/off */ |
23 | kmem_cache_t *delayacct_cache; | 23 | kmem_cache_t *delayacct_cache; |
24 | 24 | ||
25 | static int __init delayacct_setup_enable(char *str) | 25 | static int __init delayacct_setup_disable(char *str) |
26 | { | 26 | { |
27 | delayacct_on = 1; | 27 | delayacct_on = 0; |
28 | return 1; | 28 | return 1; |
29 | } | 29 | } |
30 | __setup("delayacct", delayacct_setup_enable); | 30 | __setup("nodelayacct", delayacct_setup_disable); |
31 | 31 | ||
32 | void delayacct_init(void) | 32 | void delayacct_init(void) |
33 | { | 33 | { |
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index d17766d40dab..be989efc7856 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c | |||
@@ -835,7 +835,7 @@ static void migrate_hrtimers(int cpu) | |||
835 | } | 835 | } |
836 | #endif /* CONFIG_HOTPLUG_CPU */ | 836 | #endif /* CONFIG_HOTPLUG_CPU */ |
837 | 837 | ||
838 | static int __devinit hrtimer_cpu_notify(struct notifier_block *self, | 838 | static int __cpuinit hrtimer_cpu_notify(struct notifier_block *self, |
839 | unsigned long action, void *hcpu) | 839 | unsigned long action, void *hcpu) |
840 | { | 840 | { |
841 | long cpu = (long)hcpu; | 841 | long cpu = (long)hcpu; |
@@ -859,7 +859,7 @@ static int __devinit hrtimer_cpu_notify(struct notifier_block *self, | |||
859 | return NOTIFY_OK; | 859 | return NOTIFY_OK; |
860 | } | 860 | } |
861 | 861 | ||
862 | static struct notifier_block __devinitdata hrtimers_nb = { | 862 | static struct notifier_block __cpuinitdata hrtimers_nb = { |
863 | .notifier_call = hrtimer_cpu_notify, | 863 | .notifier_call = hrtimer_cpu_notify, |
864 | }; | 864 | }; |
865 | 865 | ||
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 4e461438e48b..92be519eff26 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -137,16 +137,40 @@ EXPORT_SYMBOL(enable_irq); | |||
137 | * @irq: interrupt to control | 137 | * @irq: interrupt to control |
138 | * @on: enable/disable power management wakeup | 138 | * @on: enable/disable power management wakeup |
139 | * | 139 | * |
140 | * Enable/disable power management wakeup mode | 140 | * Enable/disable power management wakeup mode, which is |
141 | * disabled by default. Enables and disables must match, | ||
142 | * just as they match for non-wakeup mode support. | ||
143 | * | ||
144 | * Wakeup mode lets this IRQ wake the system from sleep | ||
145 | * states like "suspend to RAM". | ||
141 | */ | 146 | */ |
142 | int set_irq_wake(unsigned int irq, unsigned int on) | 147 | int set_irq_wake(unsigned int irq, unsigned int on) |
143 | { | 148 | { |
144 | struct irq_desc *desc = irq_desc + irq; | 149 | struct irq_desc *desc = irq_desc + irq; |
145 | unsigned long flags; | 150 | unsigned long flags; |
146 | int ret = -ENXIO; | 151 | int ret = -ENXIO; |
152 | int (*set_wake)(unsigned, unsigned) = desc->chip->set_wake; | ||
147 | 153 | ||
154 | /* wakeup-capable irqs can be shared between drivers that | ||
155 | * don't need to have the same sleep mode behaviors. | ||
156 | */ | ||
148 | spin_lock_irqsave(&desc->lock, flags); | 157 | spin_lock_irqsave(&desc->lock, flags); |
149 | if (desc->chip->set_wake) | 158 | if (on) { |
159 | if (desc->wake_depth++ == 0) | ||
160 | desc->status |= IRQ_WAKEUP; | ||
161 | else | ||
162 | set_wake = NULL; | ||
163 | } else { | ||
164 | if (desc->wake_depth == 0) { | ||
165 | printk(KERN_WARNING "Unbalanced IRQ %d " | ||
166 | "wake disable\n", irq); | ||
167 | WARN_ON(1); | ||
168 | } else if (--desc->wake_depth == 0) | ||
169 | desc->status &= ~IRQ_WAKEUP; | ||
170 | else | ||
171 | set_wake = NULL; | ||
172 | } | ||
173 | if (set_wake) | ||
150 | ret = desc->chip->set_wake(irq, on); | 174 | ret = desc->chip->set_wake(irq, on); |
151 | spin_unlock_irqrestore(&desc->lock, flags); | 175 | spin_unlock_irqrestore(&desc->lock, flags); |
152 | return ret; | 176 | return ret; |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 64aab081153b..3f57dfdc8f92 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -393,6 +393,7 @@ static int __kprobes add_new_kprobe(struct kprobe *old_p, struct kprobe *p) | |||
393 | static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p) | 393 | static inline void add_aggr_kprobe(struct kprobe *ap, struct kprobe *p) |
394 | { | 394 | { |
395 | copy_kprobe(p, ap); | 395 | copy_kprobe(p, ap); |
396 | flush_insn_slot(ap); | ||
396 | ap->addr = p->addr; | 397 | ap->addr = p->addr; |
397 | ap->pre_handler = aggr_pre_handler; | 398 | ap->pre_handler = aggr_pre_handler; |
398 | ap->fault_handler = aggr_fault_handler; | 399 | ap->fault_handler = aggr_fault_handler; |
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index 759805c9859a..436ab35f6fa7 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
@@ -548,7 +548,7 @@ static void __devinit rcu_online_cpu(int cpu) | |||
548 | tasklet_init(&per_cpu(rcu_tasklet, cpu), rcu_process_callbacks, 0UL); | 548 | tasklet_init(&per_cpu(rcu_tasklet, cpu), rcu_process_callbacks, 0UL); |
549 | } | 549 | } |
550 | 550 | ||
551 | static int __devinit rcu_cpu_notify(struct notifier_block *self, | 551 | static int __cpuinit rcu_cpu_notify(struct notifier_block *self, |
552 | unsigned long action, void *hcpu) | 552 | unsigned long action, void *hcpu) |
553 | { | 553 | { |
554 | long cpu = (long)hcpu; | 554 | long cpu = (long)hcpu; |
@@ -565,7 +565,7 @@ static int __devinit rcu_cpu_notify(struct notifier_block *self, | |||
565 | return NOTIFY_OK; | 565 | return NOTIFY_OK; |
566 | } | 566 | } |
567 | 567 | ||
568 | static struct notifier_block __devinitdata rcu_nb = { | 568 | static struct notifier_block __cpuinitdata rcu_nb = { |
569 | .notifier_call = rcu_cpu_notify, | 569 | .notifier_call = rcu_cpu_notify, |
570 | }; | 570 | }; |
571 | 571 | ||
diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index d2ef13b485e7..3e13a1e5856f 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c | |||
@@ -7,6 +7,8 @@ | |||
7 | * Copyright (C) 2005-2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com> | 7 | * Copyright (C) 2005-2006 Timesys Corp., Thomas Gleixner <tglx@timesys.com> |
8 | * Copyright (C) 2005 Kihon Technologies Inc., Steven Rostedt | 8 | * Copyright (C) 2005 Kihon Technologies Inc., Steven Rostedt |
9 | * Copyright (C) 2006 Esben Nielsen | 9 | * Copyright (C) 2006 Esben Nielsen |
10 | * | ||
11 | * See Documentation/rt-mutex-design.txt for details. | ||
10 | */ | 12 | */ |
11 | #include <linux/spinlock.h> | 13 | #include <linux/spinlock.h> |
12 | #include <linux/module.h> | 14 | #include <linux/module.h> |
diff --git a/kernel/sched.c b/kernel/sched.c index b44b9a43b0fc..a2be2d055299 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -4456,9 +4456,9 @@ asmlinkage long sys_sched_yield(void) | |||
4456 | return 0; | 4456 | return 0; |
4457 | } | 4457 | } |
4458 | 4458 | ||
4459 | static inline int __resched_legal(void) | 4459 | static inline int __resched_legal(int expected_preempt_count) |
4460 | { | 4460 | { |
4461 | if (unlikely(preempt_count())) | 4461 | if (unlikely(preempt_count() != expected_preempt_count)) |
4462 | return 0; | 4462 | return 0; |
4463 | if (unlikely(system_state != SYSTEM_RUNNING)) | 4463 | if (unlikely(system_state != SYSTEM_RUNNING)) |
4464 | return 0; | 4464 | return 0; |
@@ -4484,7 +4484,7 @@ static void __cond_resched(void) | |||
4484 | 4484 | ||
4485 | int __sched cond_resched(void) | 4485 | int __sched cond_resched(void) |
4486 | { | 4486 | { |
4487 | if (need_resched() && __resched_legal()) { | 4487 | if (need_resched() && __resched_legal(0)) { |
4488 | __cond_resched(); | 4488 | __cond_resched(); |
4489 | return 1; | 4489 | return 1; |
4490 | } | 4490 | } |
@@ -4510,7 +4510,7 @@ int cond_resched_lock(spinlock_t *lock) | |||
4510 | ret = 1; | 4510 | ret = 1; |
4511 | spin_lock(lock); | 4511 | spin_lock(lock); |
4512 | } | 4512 | } |
4513 | if (need_resched() && __resched_legal()) { | 4513 | if (need_resched() && __resched_legal(1)) { |
4514 | spin_release(&lock->dep_map, 1, _THIS_IP_); | 4514 | spin_release(&lock->dep_map, 1, _THIS_IP_); |
4515 | _raw_spin_unlock(lock); | 4515 | _raw_spin_unlock(lock); |
4516 | preempt_enable_no_resched(); | 4516 | preempt_enable_no_resched(); |
@@ -4526,7 +4526,7 @@ int __sched cond_resched_softirq(void) | |||
4526 | { | 4526 | { |
4527 | BUG_ON(!in_softirq()); | 4527 | BUG_ON(!in_softirq()); |
4528 | 4528 | ||
4529 | if (need_resched() && __resched_legal()) { | 4529 | if (need_resched() && __resched_legal(0)) { |
4530 | raw_local_irq_disable(); | 4530 | raw_local_irq_disable(); |
4531 | _local_bh_enable(); | 4531 | _local_bh_enable(); |
4532 | raw_local_irq_enable(); | 4532 | raw_local_irq_enable(); |
@@ -6494,7 +6494,12 @@ static int build_sched_domains(const cpumask_t *cpu_map) | |||
6494 | for (i = 0; i < MAX_NUMNODES; i++) | 6494 | for (i = 0; i < MAX_NUMNODES; i++) |
6495 | init_numa_sched_groups_power(sched_group_nodes[i]); | 6495 | init_numa_sched_groups_power(sched_group_nodes[i]); |
6496 | 6496 | ||
6497 | init_numa_sched_groups_power(sched_group_allnodes); | 6497 | if (sched_group_allnodes) { |
6498 | int group = cpu_to_allnodes_group(first_cpu(*cpu_map)); | ||
6499 | struct sched_group *sg = &sched_group_allnodes[group]; | ||
6500 | |||
6501 | init_numa_sched_groups_power(sg); | ||
6502 | } | ||
6498 | #endif | 6503 | #endif |
6499 | 6504 | ||
6500 | /* Attach the domains */ | 6505 | /* Attach the domains */ |
@@ -6761,6 +6766,11 @@ void __init sched_init(void) | |||
6761 | } | 6766 | } |
6762 | 6767 | ||
6763 | set_load_weight(&init_task); | 6768 | set_load_weight(&init_task); |
6769 | |||
6770 | #ifdef CONFIG_RT_MUTEXES | ||
6771 | plist_head_init(&init_task.pi_waiters, &init_task.pi_lock); | ||
6772 | #endif | ||
6773 | |||
6764 | /* | 6774 | /* |
6765 | * The boot idle thread does lazy MMU switching as well: | 6775 | * The boot idle thread does lazy MMU switching as well: |
6766 | */ | 6776 | */ |
diff --git a/kernel/signal.c b/kernel/signal.c index 7fe874d12fae..bfdb5686fa3e 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -791,22 +791,31 @@ out: | |||
791 | /* | 791 | /* |
792 | * Force a signal that the process can't ignore: if necessary | 792 | * Force a signal that the process can't ignore: if necessary |
793 | * we unblock the signal and change any SIG_IGN to SIG_DFL. | 793 | * we unblock the signal and change any SIG_IGN to SIG_DFL. |
794 | * | ||
795 | * Note: If we unblock the signal, we always reset it to SIG_DFL, | ||
796 | * since we do not want to have a signal handler that was blocked | ||
797 | * be invoked when user space had explicitly blocked it. | ||
798 | * | ||
799 | * We don't want to have recursive SIGSEGV's etc, for example. | ||
794 | */ | 800 | */ |
795 | |||
796 | int | 801 | int |
797 | force_sig_info(int sig, struct siginfo *info, struct task_struct *t) | 802 | force_sig_info(int sig, struct siginfo *info, struct task_struct *t) |
798 | { | 803 | { |
799 | unsigned long int flags; | 804 | unsigned long int flags; |
800 | int ret; | 805 | int ret, blocked, ignored; |
806 | struct k_sigaction *action; | ||
801 | 807 | ||
802 | spin_lock_irqsave(&t->sighand->siglock, flags); | 808 | spin_lock_irqsave(&t->sighand->siglock, flags); |
803 | if (t->sighand->action[sig-1].sa.sa_handler == SIG_IGN) { | 809 | action = &t->sighand->action[sig-1]; |
804 | t->sighand->action[sig-1].sa.sa_handler = SIG_DFL; | 810 | ignored = action->sa.sa_handler == SIG_IGN; |
805 | } | 811 | blocked = sigismember(&t->blocked, sig); |
806 | if (sigismember(&t->blocked, sig)) { | 812 | if (blocked || ignored) { |
807 | sigdelset(&t->blocked, sig); | 813 | action->sa.sa_handler = SIG_DFL; |
814 | if (blocked) { | ||
815 | sigdelset(&t->blocked, sig); | ||
816 | recalc_sigpending_tsk(t); | ||
817 | } | ||
808 | } | 818 | } |
809 | recalc_sigpending_tsk(t); | ||
810 | ret = specific_send_sig_info(sig, info, t); | 819 | ret = specific_send_sig_info(sig, info, t); |
811 | spin_unlock_irqrestore(&t->sighand->siglock, flags); | 820 | spin_unlock_irqrestore(&t->sighand->siglock, flags); |
812 | 821 | ||
diff --git a/kernel/softirq.c b/kernel/softirq.c index 0f08a84ae307..3789ca98197c 100644 --- a/kernel/softirq.c +++ b/kernel/softirq.c | |||
@@ -65,6 +65,7 @@ static inline void wakeup_softirqd(void) | |||
65 | * This one is for softirq.c-internal use, | 65 | * This one is for softirq.c-internal use, |
66 | * where hardirqs are disabled legitimately: | 66 | * where hardirqs are disabled legitimately: |
67 | */ | 67 | */ |
68 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
68 | static void __local_bh_disable(unsigned long ip) | 69 | static void __local_bh_disable(unsigned long ip) |
69 | { | 70 | { |
70 | unsigned long flags; | 71 | unsigned long flags; |
@@ -80,6 +81,13 @@ static void __local_bh_disable(unsigned long ip) | |||
80 | trace_softirqs_off(ip); | 81 | trace_softirqs_off(ip); |
81 | raw_local_irq_restore(flags); | 82 | raw_local_irq_restore(flags); |
82 | } | 83 | } |
84 | #else /* !CONFIG_TRACE_IRQFLAGS */ | ||
85 | static inline void __local_bh_disable(unsigned long ip) | ||
86 | { | ||
87 | add_preempt_count(SOFTIRQ_OFFSET); | ||
88 | barrier(); | ||
89 | } | ||
90 | #endif /* CONFIG_TRACE_IRQFLAGS */ | ||
83 | 91 | ||
84 | void local_bh_disable(void) | 92 | void local_bh_disable(void) |
85 | { | 93 | { |
@@ -121,12 +129,16 @@ EXPORT_SYMBOL(_local_bh_enable); | |||
121 | 129 | ||
122 | void local_bh_enable(void) | 130 | void local_bh_enable(void) |
123 | { | 131 | { |
132 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
124 | unsigned long flags; | 133 | unsigned long flags; |
125 | 134 | ||
126 | WARN_ON_ONCE(in_irq()); | 135 | WARN_ON_ONCE(in_irq()); |
136 | #endif | ||
127 | WARN_ON_ONCE(irqs_disabled()); | 137 | WARN_ON_ONCE(irqs_disabled()); |
128 | 138 | ||
139 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
129 | local_irq_save(flags); | 140 | local_irq_save(flags); |
141 | #endif | ||
130 | /* | 142 | /* |
131 | * Are softirqs going to be turned on now: | 143 | * Are softirqs going to be turned on now: |
132 | */ | 144 | */ |
@@ -142,18 +154,22 @@ void local_bh_enable(void) | |||
142 | do_softirq(); | 154 | do_softirq(); |
143 | 155 | ||
144 | dec_preempt_count(); | 156 | dec_preempt_count(); |
157 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
145 | local_irq_restore(flags); | 158 | local_irq_restore(flags); |
159 | #endif | ||
146 | preempt_check_resched(); | 160 | preempt_check_resched(); |
147 | } | 161 | } |
148 | EXPORT_SYMBOL(local_bh_enable); | 162 | EXPORT_SYMBOL(local_bh_enable); |
149 | 163 | ||
150 | void local_bh_enable_ip(unsigned long ip) | 164 | void local_bh_enable_ip(unsigned long ip) |
151 | { | 165 | { |
166 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
152 | unsigned long flags; | 167 | unsigned long flags; |
153 | 168 | ||
154 | WARN_ON_ONCE(in_irq()); | 169 | WARN_ON_ONCE(in_irq()); |
155 | 170 | ||
156 | local_irq_save(flags); | 171 | local_irq_save(flags); |
172 | #endif | ||
157 | /* | 173 | /* |
158 | * Are softirqs going to be turned on now: | 174 | * Are softirqs going to be turned on now: |
159 | */ | 175 | */ |
@@ -169,7 +185,9 @@ void local_bh_enable_ip(unsigned long ip) | |||
169 | do_softirq(); | 185 | do_softirq(); |
170 | 186 | ||
171 | dec_preempt_count(); | 187 | dec_preempt_count(); |
188 | #ifdef CONFIG_TRACE_IRQFLAGS | ||
172 | local_irq_restore(flags); | 189 | local_irq_restore(flags); |
190 | #endif | ||
173 | preempt_check_resched(); | 191 | preempt_check_resched(); |
174 | } | 192 | } |
175 | EXPORT_SYMBOL(local_bh_enable_ip); | 193 | EXPORT_SYMBOL(local_bh_enable_ip); |
@@ -547,7 +565,7 @@ static void takeover_tasklets(unsigned int cpu) | |||
547 | } | 565 | } |
548 | #endif /* CONFIG_HOTPLUG_CPU */ | 566 | #endif /* CONFIG_HOTPLUG_CPU */ |
549 | 567 | ||
550 | static int __devinit cpu_callback(struct notifier_block *nfb, | 568 | static int __cpuinit cpu_callback(struct notifier_block *nfb, |
551 | unsigned long action, | 569 | unsigned long action, |
552 | void *hcpu) | 570 | void *hcpu) |
553 | { | 571 | { |
@@ -587,7 +605,7 @@ static int __devinit cpu_callback(struct notifier_block *nfb, | |||
587 | return NOTIFY_OK; | 605 | return NOTIFY_OK; |
588 | } | 606 | } |
589 | 607 | ||
590 | static struct notifier_block __devinitdata cpu_nfb = { | 608 | static struct notifier_block __cpuinitdata cpu_nfb = { |
591 | .notifier_call = cpu_callback | 609 | .notifier_call = cpu_callback |
592 | }; | 610 | }; |
593 | 611 | ||
diff --git a/kernel/softlockup.c b/kernel/softlockup.c index 6b76caa22981..03e6a2b0b787 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c | |||
@@ -104,7 +104,7 @@ static int watchdog(void * __bind_cpu) | |||
104 | /* | 104 | /* |
105 | * Create/destroy watchdog threads as CPUs come and go: | 105 | * Create/destroy watchdog threads as CPUs come and go: |
106 | */ | 106 | */ |
107 | static int __devinit | 107 | static int __cpuinit |
108 | cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) | 108 | cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) |
109 | { | 109 | { |
110 | int hotcpu = (unsigned long)hcpu; | 110 | int hotcpu = (unsigned long)hcpu; |
@@ -142,7 +142,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
142 | return NOTIFY_OK; | 142 | return NOTIFY_OK; |
143 | } | 143 | } |
144 | 144 | ||
145 | static struct notifier_block __devinitdata cpu_nfb = { | 145 | static struct notifier_block __cpuinitdata cpu_nfb = { |
146 | .notifier_call = cpu_callback | 146 | .notifier_call = cpu_callback |
147 | }; | 147 | }; |
148 | 148 | ||
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index f45179ce028e..e78187657330 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -121,46 +121,45 @@ static int send_reply(struct sk_buff *skb, pid_t pid) | |||
121 | /* | 121 | /* |
122 | * Send taskstats data in @skb to listeners registered for @cpu's exit data | 122 | * Send taskstats data in @skb to listeners registered for @cpu's exit data |
123 | */ | 123 | */ |
124 | static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu) | 124 | static void send_cpu_listeners(struct sk_buff *skb, unsigned int cpu) |
125 | { | 125 | { |
126 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); | 126 | struct genlmsghdr *genlhdr = nlmsg_data((struct nlmsghdr *)skb->data); |
127 | struct listener_list *listeners; | 127 | struct listener_list *listeners; |
128 | struct listener *s, *tmp; | 128 | struct listener *s, *tmp; |
129 | struct sk_buff *skb_next, *skb_cur = skb; | 129 | struct sk_buff *skb_next, *skb_cur = skb; |
130 | void *reply = genlmsg_data(genlhdr); | 130 | void *reply = genlmsg_data(genlhdr); |
131 | int rc, ret, delcount = 0; | 131 | int rc, delcount = 0; |
132 | 132 | ||
133 | rc = genlmsg_end(skb, reply); | 133 | rc = genlmsg_end(skb, reply); |
134 | if (rc < 0) { | 134 | if (rc < 0) { |
135 | nlmsg_free(skb); | 135 | nlmsg_free(skb); |
136 | return rc; | 136 | return; |
137 | } | 137 | } |
138 | 138 | ||
139 | rc = 0; | 139 | rc = 0; |
140 | listeners = &per_cpu(listener_array, cpu); | 140 | listeners = &per_cpu(listener_array, cpu); |
141 | down_read(&listeners->sem); | 141 | down_read(&listeners->sem); |
142 | list_for_each_entry_safe(s, tmp, &listeners->list, list) { | 142 | list_for_each_entry(s, &listeners->list, list) { |
143 | skb_next = NULL; | 143 | skb_next = NULL; |
144 | if (!list_is_last(&s->list, &listeners->list)) { | 144 | if (!list_is_last(&s->list, &listeners->list)) { |
145 | skb_next = skb_clone(skb_cur, GFP_KERNEL); | 145 | skb_next = skb_clone(skb_cur, GFP_KERNEL); |
146 | if (!skb_next) { | 146 | if (!skb_next) |
147 | nlmsg_free(skb_cur); | ||
148 | rc = -ENOMEM; | ||
149 | break; | 147 | break; |
150 | } | ||
151 | } | 148 | } |
152 | ret = genlmsg_unicast(skb_cur, s->pid); | 149 | rc = genlmsg_unicast(skb_cur, s->pid); |
153 | if (ret == -ECONNREFUSED) { | 150 | if (rc == -ECONNREFUSED) { |
154 | s->valid = 0; | 151 | s->valid = 0; |
155 | delcount++; | 152 | delcount++; |
156 | rc = ret; | ||
157 | } | 153 | } |
158 | skb_cur = skb_next; | 154 | skb_cur = skb_next; |
159 | } | 155 | } |
160 | up_read(&listeners->sem); | 156 | up_read(&listeners->sem); |
161 | 157 | ||
158 | if (skb_cur) | ||
159 | nlmsg_free(skb_cur); | ||
160 | |||
162 | if (!delcount) | 161 | if (!delcount) |
163 | return rc; | 162 | return; |
164 | 163 | ||
165 | /* Delete invalidated entries */ | 164 | /* Delete invalidated entries */ |
166 | down_write(&listeners->sem); | 165 | down_write(&listeners->sem); |
@@ -171,13 +170,12 @@ static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu) | |||
171 | } | 170 | } |
172 | } | 171 | } |
173 | up_write(&listeners->sem); | 172 | up_write(&listeners->sem); |
174 | return rc; | ||
175 | } | 173 | } |
176 | 174 | ||
177 | static int fill_pid(pid_t pid, struct task_struct *pidtsk, | 175 | static int fill_pid(pid_t pid, struct task_struct *pidtsk, |
178 | struct taskstats *stats) | 176 | struct taskstats *stats) |
179 | { | 177 | { |
180 | int rc; | 178 | int rc = 0; |
181 | struct task_struct *tsk = pidtsk; | 179 | struct task_struct *tsk = pidtsk; |
182 | 180 | ||
183 | if (!pidtsk) { | 181 | if (!pidtsk) { |
@@ -196,12 +194,10 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk, | |||
196 | * Each accounting subsystem adds calls to its functions to | 194 | * Each accounting subsystem adds calls to its functions to |
197 | * fill in relevant parts of struct taskstsats as follows | 195 | * fill in relevant parts of struct taskstsats as follows |
198 | * | 196 | * |
199 | * rc = per-task-foo(stats, tsk); | 197 | * per-task-foo(stats, tsk); |
200 | * if (rc) | ||
201 | * goto err; | ||
202 | */ | 198 | */ |
203 | 199 | ||
204 | rc = delayacct_add_tsk(stats, tsk); | 200 | delayacct_add_tsk(stats, tsk); |
205 | stats->version = TASKSTATS_VERSION; | 201 | stats->version = TASKSTATS_VERSION; |
206 | 202 | ||
207 | /* Define err: label here if needed */ | 203 | /* Define err: label here if needed */ |
diff --git a/kernel/timer.c b/kernel/timer.c index 05809c2e2fd6..b650f04888ed 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -84,7 +84,7 @@ typedef struct tvec_t_base_s tvec_base_t; | |||
84 | 84 | ||
85 | tvec_base_t boot_tvec_bases; | 85 | tvec_base_t boot_tvec_bases; |
86 | EXPORT_SYMBOL(boot_tvec_bases); | 86 | EXPORT_SYMBOL(boot_tvec_bases); |
87 | static DEFINE_PER_CPU(tvec_base_t *, tvec_bases) = { &boot_tvec_bases }; | 87 | static DEFINE_PER_CPU(tvec_base_t *, tvec_bases) = &boot_tvec_bases; |
88 | 88 | ||
89 | static inline void set_running_timer(tvec_base_t *base, | 89 | static inline void set_running_timer(tvec_base_t *base, |
90 | struct timer_list *timer) | 90 | struct timer_list *timer) |
@@ -408,7 +408,7 @@ static int cascade(tvec_base_t *base, tvec_t *tv, int index) | |||
408 | * This function cascades all vectors and executes all expired timer | 408 | * This function cascades all vectors and executes all expired timer |
409 | * vectors. | 409 | * vectors. |
410 | */ | 410 | */ |
411 | #define INDEX(N) (base->timer_jiffies >> (TVR_BITS + N * TVN_BITS)) & TVN_MASK | 411 | #define INDEX(N) ((base->timer_jiffies >> (TVR_BITS + (N) * TVN_BITS)) & TVN_MASK) |
412 | 412 | ||
413 | static inline void __run_timers(tvec_base_t *base) | 413 | static inline void __run_timers(tvec_base_t *base) |
414 | { | 414 | { |
@@ -1688,7 +1688,7 @@ static void __devinit migrate_timers(int cpu) | |||
1688 | } | 1688 | } |
1689 | #endif /* CONFIG_HOTPLUG_CPU */ | 1689 | #endif /* CONFIG_HOTPLUG_CPU */ |
1690 | 1690 | ||
1691 | static int __devinit timer_cpu_notify(struct notifier_block *self, | 1691 | static int __cpuinit timer_cpu_notify(struct notifier_block *self, |
1692 | unsigned long action, void *hcpu) | 1692 | unsigned long action, void *hcpu) |
1693 | { | 1693 | { |
1694 | long cpu = (long)hcpu; | 1694 | long cpu = (long)hcpu; |
@@ -1708,7 +1708,7 @@ static int __devinit timer_cpu_notify(struct notifier_block *self, | |||
1708 | return NOTIFY_OK; | 1708 | return NOTIFY_OK; |
1709 | } | 1709 | } |
1710 | 1710 | ||
1711 | static struct notifier_block __devinitdata timers_nb = { | 1711 | static struct notifier_block __cpuinitdata timers_nb = { |
1712 | .notifier_call = timer_cpu_notify, | 1712 | .notifier_call = timer_cpu_notify, |
1713 | }; | 1713 | }; |
1714 | 1714 | ||
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index eebb1d839235..448e8f7b342d 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -93,9 +93,12 @@ static void __queue_work(struct cpu_workqueue_struct *cwq, | |||
93 | spin_unlock_irqrestore(&cwq->lock, flags); | 93 | spin_unlock_irqrestore(&cwq->lock, flags); |
94 | } | 94 | } |
95 | 95 | ||
96 | /* | 96 | /** |
97 | * Queue work on a workqueue. Return non-zero if it was successfully | 97 | * queue_work - queue work on a workqueue |
98 | * added. | 98 | * @wq: workqueue to use |
99 | * @work: work to queue | ||
100 | * | ||
101 | * Returns non-zero if it was successfully added. | ||
99 | * | 102 | * |
100 | * We queue the work to the CPU it was submitted, but there is no | 103 | * We queue the work to the CPU it was submitted, but there is no |
101 | * guarantee that it will be processed by that CPU. | 104 | * guarantee that it will be processed by that CPU. |
@@ -128,6 +131,14 @@ static void delayed_work_timer_fn(unsigned long __data) | |||
128 | __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work); | 131 | __queue_work(per_cpu_ptr(wq->cpu_wq, cpu), work); |
129 | } | 132 | } |
130 | 133 | ||
134 | /** | ||
135 | * queue_delayed_work - queue work on a workqueue after delay | ||
136 | * @wq: workqueue to use | ||
137 | * @work: work to queue | ||
138 | * @delay: number of jiffies to wait before queueing | ||
139 | * | ||
140 | * Returns non-zero if it was successfully added. | ||
141 | */ | ||
131 | int fastcall queue_delayed_work(struct workqueue_struct *wq, | 142 | int fastcall queue_delayed_work(struct workqueue_struct *wq, |
132 | struct work_struct *work, unsigned long delay) | 143 | struct work_struct *work, unsigned long delay) |
133 | { | 144 | { |
@@ -150,6 +161,15 @@ int fastcall queue_delayed_work(struct workqueue_struct *wq, | |||
150 | } | 161 | } |
151 | EXPORT_SYMBOL_GPL(queue_delayed_work); | 162 | EXPORT_SYMBOL_GPL(queue_delayed_work); |
152 | 163 | ||
164 | /** | ||
165 | * queue_delayed_work_on - queue work on specific CPU after delay | ||
166 | * @cpu: CPU number to execute work on | ||
167 | * @wq: workqueue to use | ||
168 | * @work: work to queue | ||
169 | * @delay: number of jiffies to wait before queueing | ||
170 | * | ||
171 | * Returns non-zero if it was successfully added. | ||
172 | */ | ||
153 | int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, | 173 | int queue_delayed_work_on(int cpu, struct workqueue_struct *wq, |
154 | struct work_struct *work, unsigned long delay) | 174 | struct work_struct *work, unsigned long delay) |
155 | { | 175 | { |
@@ -275,8 +295,9 @@ static void flush_cpu_workqueue(struct cpu_workqueue_struct *cwq) | |||
275 | } | 295 | } |
276 | } | 296 | } |
277 | 297 | ||
278 | /* | 298 | /** |
279 | * flush_workqueue - ensure that any scheduled work has run to completion. | 299 | * flush_workqueue - ensure that any scheduled work has run to completion. |
300 | * @wq: workqueue to flush | ||
280 | * | 301 | * |
281 | * Forces execution of the workqueue and blocks until its completion. | 302 | * Forces execution of the workqueue and blocks until its completion. |
282 | * This is typically used in driver shutdown handlers. | 303 | * This is typically used in driver shutdown handlers. |
@@ -400,6 +421,12 @@ static void cleanup_workqueue_thread(struct workqueue_struct *wq, int cpu) | |||
400 | kthread_stop(p); | 421 | kthread_stop(p); |
401 | } | 422 | } |
402 | 423 | ||
424 | /** | ||
425 | * destroy_workqueue - safely terminate a workqueue | ||
426 | * @wq: target workqueue | ||
427 | * | ||
428 | * Safely destroy a workqueue. All work currently pending will be done first. | ||
429 | */ | ||
403 | void destroy_workqueue(struct workqueue_struct *wq) | 430 | void destroy_workqueue(struct workqueue_struct *wq) |
404 | { | 431 | { |
405 | int cpu; | 432 | int cpu; |
@@ -425,18 +452,41 @@ EXPORT_SYMBOL_GPL(destroy_workqueue); | |||
425 | 452 | ||
426 | static struct workqueue_struct *keventd_wq; | 453 | static struct workqueue_struct *keventd_wq; |
427 | 454 | ||
455 | /** | ||
456 | * schedule_work - put work task in global workqueue | ||
457 | * @work: job to be done | ||
458 | * | ||
459 | * This puts a job in the kernel-global workqueue. | ||
460 | */ | ||
428 | int fastcall schedule_work(struct work_struct *work) | 461 | int fastcall schedule_work(struct work_struct *work) |
429 | { | 462 | { |
430 | return queue_work(keventd_wq, work); | 463 | return queue_work(keventd_wq, work); |
431 | } | 464 | } |
432 | EXPORT_SYMBOL(schedule_work); | 465 | EXPORT_SYMBOL(schedule_work); |
433 | 466 | ||
467 | /** | ||
468 | * schedule_delayed_work - put work task in global workqueue after delay | ||
469 | * @work: job to be done | ||
470 | * @delay: number of jiffies to wait | ||
471 | * | ||
472 | * After waiting for a given time this puts a job in the kernel-global | ||
473 | * workqueue. | ||
474 | */ | ||
434 | int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay) | 475 | int fastcall schedule_delayed_work(struct work_struct *work, unsigned long delay) |
435 | { | 476 | { |
436 | return queue_delayed_work(keventd_wq, work, delay); | 477 | return queue_delayed_work(keventd_wq, work, delay); |
437 | } | 478 | } |
438 | EXPORT_SYMBOL(schedule_delayed_work); | 479 | EXPORT_SYMBOL(schedule_delayed_work); |
439 | 480 | ||
481 | /** | ||
482 | * schedule_delayed_work_on - queue work in global workqueue on CPU after delay | ||
483 | * @cpu: cpu to use | ||
484 | * @work: job to be done | ||
485 | * @delay: number of jiffies to wait | ||
486 | * | ||
487 | * After waiting for a given time this puts a job in the kernel-global | ||
488 | * workqueue on the specified CPU. | ||
489 | */ | ||
440 | int schedule_delayed_work_on(int cpu, | 490 | int schedule_delayed_work_on(int cpu, |
441 | struct work_struct *work, unsigned long delay) | 491 | struct work_struct *work, unsigned long delay) |
442 | { | 492 | { |