aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 19:38:06 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-07 19:38:06 -0400
commit26c12d93348f0bda0756aff83f4867d9ae58a5a6 (patch)
tree65221f6837c66a9260c5c973e5fb908b10e0d504 /kernel
parentdc5ed40686a4da95881c35d913b60f867755cbe2 (diff)
parentfdc5813fbbd484a54c88477f91a78934cda8bb32 (diff)
Merge branch 'akpm' (incoming from Andrew)
Merge second patch-bomb from Andrew Morton: - the rest of MM - zram updates - zswap updates - exit - procfs - exec - wait - crash dump - lib/idr - rapidio - adfs, affs, bfs, ufs - cris - Kconfig things - initramfs - small amount of IPC material - percpu enhancements - early ioremap support - various other misc things * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (156 commits) MAINTAINERS: update Intel C600 SAS driver maintainers fs/ufs: remove unused ufs_super_block_third pointer fs/ufs: remove unused ufs_super_block_second pointer fs/ufs: remove unused ufs_super_block_first pointer fs/ufs/super.c: add __init to init_inodecache() doc/kernel-parameters.txt: add early_ioremap_debug arm64: add early_ioremap support arm64: initialize pgprot info earlier in boot x86: use generic early_ioremap mm: create generic early_ioremap() support x86/mm: sparse warning fix for early_memremap lglock: map to spinlock when !CONFIG_SMP percpu: add preemption checks to __this_cpu ops vmstat: use raw_cpu_ops to avoid false positives on preemption checks slub: use raw_cpu_inc for incrementing statistics net: replace __this_cpu_inc in route.c with raw_cpu_inc modules: use raw_cpu_write for initialization of per cpu refcount. mm: use raw_cpu ops for determining current NUMA node percpu: add raw_cpu_ops slub: fix leak of 'name' in sysfs_slab_add ...
Diffstat (limited to 'kernel')
-rw-r--r--kernel/debug/debug_core.c14
-rw-r--r--kernel/exit.c110
-rw-r--r--kernel/fork.c34
-rw-r--r--kernel/kallsyms.c11
-rw-r--r--kernel/kexec.c5
-rw-r--r--kernel/ksysfs.c5
-rw-r--r--kernel/locking/Makefile3
-rw-r--r--kernel/module.c2
-rw-r--r--kernel/panic.c13
-rw-r--r--kernel/power/power.h3
-rw-r--r--kernel/power/snapshot.c3
-rw-r--r--kernel/power/suspend.c5
-rw-r--r--kernel/power/swap.c2
-rw-r--r--kernel/res_counter.c23
-rw-r--r--kernel/sched/clock.c3
-rw-r--r--kernel/sched/core.c3
-rw-r--r--kernel/signal.c4
-rw-r--r--kernel/sys.c15
-rw-r--r--kernel/sysctl.c6
-rw-r--r--kernel/time/timekeeping.c5
-rw-r--r--kernel/trace/trace.h3
21 files changed, 155 insertions, 117 deletions
diff --git a/kernel/debug/debug_core.c b/kernel/debug/debug_core.c
index 99982a70ddad..2956c8da1605 100644
--- a/kernel/debug/debug_core.c
+++ b/kernel/debug/debug_core.c
@@ -49,6 +49,7 @@
49#include <linux/pid.h> 49#include <linux/pid.h>
50#include <linux/smp.h> 50#include <linux/smp.h>
51#include <linux/mm.h> 51#include <linux/mm.h>
52#include <linux/vmacache.h>
52#include <linux/rcupdate.h> 53#include <linux/rcupdate.h>
53 54
54#include <asm/cacheflush.h> 55#include <asm/cacheflush.h>
@@ -224,10 +225,17 @@ static void kgdb_flush_swbreak_addr(unsigned long addr)
224 if (!CACHE_FLUSH_IS_SAFE) 225 if (!CACHE_FLUSH_IS_SAFE)
225 return; 226 return;
226 227
227 if (current->mm && current->mm->mmap_cache) { 228 if (current->mm) {
228 flush_cache_range(current->mm->mmap_cache, 229 int i;
229 addr, addr + BREAK_INSTR_SIZE); 230
231 for (i = 0; i < VMACACHE_SIZE; i++) {
232 if (!current->vmacache[i])
233 continue;
234 flush_cache_range(current->vmacache[i],
235 addr, addr + BREAK_INSTR_SIZE);
236 }
230 } 237 }
238
231 /* Force flush instruction cache if it was outside the mm */ 239 /* Force flush instruction cache if it was outside the mm */
232 flush_icache_range(addr, addr + BREAK_INSTR_SIZE); 240 flush_icache_range(addr, addr + BREAK_INSTR_SIZE);
233} 241}
diff --git a/kernel/exit.c b/kernel/exit.c
index 6480d1c85d7a..6ed6a1d552b5 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -570,7 +570,7 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p,
570 if (same_thread_group(p->real_parent, father)) 570 if (same_thread_group(p->real_parent, father))
571 return; 571 return;
572 572
573 /* We don't want people slaying init. */ 573 /* We don't want people slaying init. */
574 p->exit_signal = SIGCHLD; 574 p->exit_signal = SIGCHLD;
575 575
576 /* If it has exited notify the new parent about this child's death. */ 576 /* If it has exited notify the new parent about this child's death. */
@@ -784,9 +784,10 @@ void do_exit(long code)
784 exit_shm(tsk); 784 exit_shm(tsk);
785 exit_files(tsk); 785 exit_files(tsk);
786 exit_fs(tsk); 786 exit_fs(tsk);
787 if (group_dead)
788 disassociate_ctty(1);
787 exit_task_namespaces(tsk); 789 exit_task_namespaces(tsk);
788 exit_task_work(tsk); 790 exit_task_work(tsk);
789 check_stack_usage();
790 exit_thread(); 791 exit_thread();
791 792
792 /* 793 /*
@@ -799,19 +800,15 @@ void do_exit(long code)
799 800
800 cgroup_exit(tsk); 801 cgroup_exit(tsk);
801 802
802 if (group_dead)
803 disassociate_ctty(1);
804
805 module_put(task_thread_info(tsk)->exec_domain->module); 803 module_put(task_thread_info(tsk)->exec_domain->module);
806 804
807 proc_exit_connector(tsk);
808
809 /* 805 /*
810 * FIXME: do that only when needed, using sched_exit tracepoint 806 * FIXME: do that only when needed, using sched_exit tracepoint
811 */ 807 */
812 flush_ptrace_hw_breakpoint(tsk); 808 flush_ptrace_hw_breakpoint(tsk);
813 809
814 exit_notify(tsk, group_dead); 810 exit_notify(tsk, group_dead);
811 proc_exit_connector(tsk);
815#ifdef CONFIG_NUMA 812#ifdef CONFIG_NUMA
816 task_lock(tsk); 813 task_lock(tsk);
817 mpol_put(tsk->mempolicy); 814 mpol_put(tsk->mempolicy);
@@ -844,6 +841,7 @@ void do_exit(long code)
844 841
845 validate_creds_for_do_exit(tsk); 842 validate_creds_for_do_exit(tsk);
846 843
844 check_stack_usage();
847 preempt_disable(); 845 preempt_disable();
848 if (tsk->nr_dirtied) 846 if (tsk->nr_dirtied)
849 __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied); 847 __this_cpu_add(dirty_throttle_leaks, tsk->nr_dirtied);
@@ -1038,17 +1036,13 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
1038 return wait_noreap_copyout(wo, p, pid, uid, why, status); 1036 return wait_noreap_copyout(wo, p, pid, uid, why, status);
1039 } 1037 }
1040 1038
1039 traced = ptrace_reparented(p);
1041 /* 1040 /*
1042 * Try to move the task's state to DEAD 1041 * Move the task's state to DEAD/TRACE, only one thread can do this.
1043 * only one thread is allowed to do this:
1044 */ 1042 */
1045 state = xchg(&p->exit_state, EXIT_DEAD); 1043 state = traced && thread_group_leader(p) ? EXIT_TRACE : EXIT_DEAD;
1046 if (state != EXIT_ZOMBIE) { 1044 if (cmpxchg(&p->exit_state, EXIT_ZOMBIE, state) != EXIT_ZOMBIE)
1047 BUG_ON(state != EXIT_DEAD);
1048 return 0; 1045 return 0;
1049 }
1050
1051 traced = ptrace_reparented(p);
1052 /* 1046 /*
1053 * It can be ptraced but not reparented, check 1047 * It can be ptraced but not reparented, check
1054 * thread_group_leader() to filter out sub-threads. 1048 * thread_group_leader() to filter out sub-threads.
@@ -1109,7 +1103,7 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
1109 1103
1110 /* 1104 /*
1111 * Now we are sure this task is interesting, and no other 1105 * Now we are sure this task is interesting, and no other
1112 * thread can reap it because we set its state to EXIT_DEAD. 1106 * thread can reap it because we its state == DEAD/TRACE.
1113 */ 1107 */
1114 read_unlock(&tasklist_lock); 1108 read_unlock(&tasklist_lock);
1115 1109
@@ -1146,22 +1140,19 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
1146 if (!retval) 1140 if (!retval)
1147 retval = pid; 1141 retval = pid;
1148 1142
1149 if (traced) { 1143 if (state == EXIT_TRACE) {
1150 write_lock_irq(&tasklist_lock); 1144 write_lock_irq(&tasklist_lock);
1151 /* We dropped tasklist, ptracer could die and untrace */ 1145 /* We dropped tasklist, ptracer could die and untrace */
1152 ptrace_unlink(p); 1146 ptrace_unlink(p);
1153 /* 1147
1154 * If this is not a sub-thread, notify the parent. 1148 /* If parent wants a zombie, don't release it now */
1155 * If parent wants a zombie, don't release it now. 1149 state = EXIT_ZOMBIE;
1156 */ 1150 if (do_notify_parent(p, p->exit_signal))
1157 if (thread_group_leader(p) && 1151 state = EXIT_DEAD;
1158 !do_notify_parent(p, p->exit_signal)) { 1152 p->exit_state = state;
1159 p->exit_state = EXIT_ZOMBIE;
1160 p = NULL;
1161 }
1162 write_unlock_irq(&tasklist_lock); 1153 write_unlock_irq(&tasklist_lock);
1163 } 1154 }
1164 if (p != NULL) 1155 if (state == EXIT_DEAD)
1165 release_task(p); 1156 release_task(p);
1166 1157
1167 return retval; 1158 return retval;
@@ -1338,7 +1329,12 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
1338static int wait_consider_task(struct wait_opts *wo, int ptrace, 1329static int wait_consider_task(struct wait_opts *wo, int ptrace,
1339 struct task_struct *p) 1330 struct task_struct *p)
1340{ 1331{
1341 int ret = eligible_child(wo, p); 1332 int ret;
1333
1334 if (unlikely(p->exit_state == EXIT_DEAD))
1335 return 0;
1336
1337 ret = eligible_child(wo, p);
1342 if (!ret) 1338 if (!ret)
1343 return ret; 1339 return ret;
1344 1340
@@ -1356,33 +1352,44 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace,
1356 return 0; 1352 return 0;
1357 } 1353 }
1358 1354
1359 /* dead body doesn't have much to contribute */ 1355 if (unlikely(p->exit_state == EXIT_TRACE)) {
1360 if (unlikely(p->exit_state == EXIT_DEAD)) {
1361 /* 1356 /*
1362 * But do not ignore this task until the tracer does 1357 * ptrace == 0 means we are the natural parent. In this case
1363 * wait_task_zombie()->do_notify_parent(). 1358 * we should clear notask_error, debugger will notify us.
1364 */ 1359 */
1365 if (likely(!ptrace) && unlikely(ptrace_reparented(p))) 1360 if (likely(!ptrace))
1366 wo->notask_error = 0; 1361 wo->notask_error = 0;
1367 return 0; 1362 return 0;
1368 } 1363 }
1369 1364
1370 /* slay zombie? */ 1365 if (likely(!ptrace) && unlikely(p->ptrace)) {
1371 if (p->exit_state == EXIT_ZOMBIE) {
1372 /* 1366 /*
1373 * A zombie ptracee is only visible to its ptracer. 1367 * If it is traced by its real parent's group, just pretend
1374 * Notification and reaping will be cascaded to the real 1368 * the caller is ptrace_do_wait() and reap this child if it
1375 * parent when the ptracer detaches. 1369 * is zombie.
1370 *
1371 * This also hides group stop state from real parent; otherwise
1372 * a single stop can be reported twice as group and ptrace stop.
1373 * If a ptracer wants to distinguish these two events for its
1374 * own children it should create a separate process which takes
1375 * the role of real parent.
1376 */ 1376 */
1377 if (likely(!ptrace) && unlikely(p->ptrace)) { 1377 if (!ptrace_reparented(p))
1378 /* it will become visible, clear notask_error */ 1378 ptrace = 1;
1379 wo->notask_error = 0; 1379 }
1380 return 0;
1381 }
1382 1380
1381 /* slay zombie? */
1382 if (p->exit_state == EXIT_ZOMBIE) {
1383 /* we don't reap group leaders with subthreads */ 1383 /* we don't reap group leaders with subthreads */
1384 if (!delay_group_leader(p)) 1384 if (!delay_group_leader(p)) {
1385 return wait_task_zombie(wo, p); 1385 /*
1386 * A zombie ptracee is only visible to its ptracer.
1387 * Notification and reaping will be cascaded to the
1388 * real parent when the ptracer detaches.
1389 */
1390 if (unlikely(ptrace) || likely(!p->ptrace))
1391 return wait_task_zombie(wo, p);
1392 }
1386 1393
1387 /* 1394 /*
1388 * Allow access to stopped/continued state via zombie by 1395 * Allow access to stopped/continued state via zombie by
@@ -1408,19 +1415,6 @@ static int wait_consider_task(struct wait_opts *wo, int ptrace,
1408 wo->notask_error = 0; 1415 wo->notask_error = 0;
1409 } else { 1416 } else {
1410 /* 1417 /*
1411 * If @p is ptraced by a task in its real parent's group,
1412 * hide group stop/continued state when looking at @p as
1413 * the real parent; otherwise, a single stop can be
1414 * reported twice as group and ptrace stops.
1415 *
1416 * If a ptracer wants to distinguish the two events for its
1417 * own children, it should create a separate process which
1418 * takes the role of real parent.
1419 */
1420 if (likely(!ptrace) && p->ptrace && !ptrace_reparented(p))
1421 return 0;
1422
1423 /*
1424 * @p is alive and it's gonna stop, continue or exit, so 1418 * @p is alive and it's gonna stop, continue or exit, so
1425 * there always is something to wait for. 1419 * there always is something to wait for.
1426 */ 1420 */
diff --git a/kernel/fork.c b/kernel/fork.c
index abc45890f0a5..54a8d26f612f 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -28,6 +28,8 @@
28#include <linux/mman.h> 28#include <linux/mman.h>
29#include <linux/mmu_notifier.h> 29#include <linux/mmu_notifier.h>
30#include <linux/fs.h> 30#include <linux/fs.h>
31#include <linux/mm.h>
32#include <linux/vmacache.h>
31#include <linux/nsproxy.h> 33#include <linux/nsproxy.h>
32#include <linux/capability.h> 34#include <linux/capability.h>
33#include <linux/cpu.h> 35#include <linux/cpu.h>
@@ -71,6 +73,7 @@
71#include <linux/signalfd.h> 73#include <linux/signalfd.h>
72#include <linux/uprobes.h> 74#include <linux/uprobes.h>
73#include <linux/aio.h> 75#include <linux/aio.h>
76#include <linux/compiler.h>
74 77
75#include <asm/pgtable.h> 78#include <asm/pgtable.h>
76#include <asm/pgalloc.h> 79#include <asm/pgalloc.h>
@@ -284,7 +287,7 @@ void __init fork_init(unsigned long mempages)
284 init_task.signal->rlim[RLIMIT_NPROC]; 287 init_task.signal->rlim[RLIMIT_NPROC];
285} 288}
286 289
287int __attribute__((weak)) arch_dup_task_struct(struct task_struct *dst, 290int __weak arch_dup_task_struct(struct task_struct *dst,
288 struct task_struct *src) 291 struct task_struct *src)
289{ 292{
290 *dst = *src; 293 *dst = *src;
@@ -364,7 +367,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
364 367
365 mm->locked_vm = 0; 368 mm->locked_vm = 0;
366 mm->mmap = NULL; 369 mm->mmap = NULL;
367 mm->mmap_cache = NULL; 370 mm->vmacache_seqnum = 0;
368 mm->map_count = 0; 371 mm->map_count = 0;
369 cpumask_clear(mm_cpumask(mm)); 372 cpumask_clear(mm_cpumask(mm));
370 mm->mm_rb = RB_ROOT; 373 mm->mm_rb = RB_ROOT;
@@ -530,8 +533,6 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
530 atomic_set(&mm->mm_count, 1); 533 atomic_set(&mm->mm_count, 1);
531 init_rwsem(&mm->mmap_sem); 534 init_rwsem(&mm->mmap_sem);
532 INIT_LIST_HEAD(&mm->mmlist); 535 INIT_LIST_HEAD(&mm->mmlist);
533 mm->flags = (current->mm) ?
534 (current->mm->flags & MMF_INIT_MASK) : default_dump_filter;
535 mm->core_state = NULL; 536 mm->core_state = NULL;
536 atomic_long_set(&mm->nr_ptes, 0); 537 atomic_long_set(&mm->nr_ptes, 0);
537 memset(&mm->rss_stat, 0, sizeof(mm->rss_stat)); 538 memset(&mm->rss_stat, 0, sizeof(mm->rss_stat));
@@ -540,8 +541,15 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p)
540 mm_init_owner(mm, p); 541 mm_init_owner(mm, p);
541 clear_tlb_flush_pending(mm); 542 clear_tlb_flush_pending(mm);
542 543
543 if (likely(!mm_alloc_pgd(mm))) { 544 if (current->mm) {
545 mm->flags = current->mm->flags & MMF_INIT_MASK;
546 mm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;
547 } else {
548 mm->flags = default_dump_filter;
544 mm->def_flags = 0; 549 mm->def_flags = 0;
550 }
551
552 if (likely(!mm_alloc_pgd(mm))) {
545 mmu_notifier_mm_init(mm); 553 mmu_notifier_mm_init(mm);
546 return mm; 554 return mm;
547 } 555 }
@@ -877,6 +885,9 @@ static int copy_mm(unsigned long clone_flags, struct task_struct *tsk)
877 if (!oldmm) 885 if (!oldmm)
878 return 0; 886 return 0;
879 887
888 /* initialize the new vmacache entries */
889 vmacache_flush(tsk);
890
880 if (clone_flags & CLONE_VM) { 891 if (clone_flags & CLONE_VM) {
881 atomic_inc(&oldmm->mm_users); 892 atomic_inc(&oldmm->mm_users);
882 mm = oldmm; 893 mm = oldmm;
@@ -1070,15 +1081,6 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
1070 return 0; 1081 return 0;
1071} 1082}
1072 1083
1073static void copy_flags(unsigned long clone_flags, struct task_struct *p)
1074{
1075 unsigned long new_flags = p->flags;
1076
1077 new_flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER);
1078 new_flags |= PF_FORKNOEXEC;
1079 p->flags = new_flags;
1080}
1081
1082SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr) 1084SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
1083{ 1085{
1084 current->clear_child_tid = tidptr; 1086 current->clear_child_tid = tidptr;
@@ -1228,7 +1230,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1228 goto bad_fork_cleanup_count; 1230 goto bad_fork_cleanup_count;
1229 1231
1230 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */ 1232 delayacct_tsk_init(p); /* Must remain after dup_task_struct() */
1231 copy_flags(clone_flags, p); 1233 p->flags &= ~(PF_SUPERPRIV | PF_WQ_WORKER);
1234 p->flags |= PF_FORKNOEXEC;
1232 INIT_LIST_HEAD(&p->children); 1235 INIT_LIST_HEAD(&p->children);
1233 INIT_LIST_HEAD(&p->sibling); 1236 INIT_LIST_HEAD(&p->sibling);
1234 rcu_copy_process(p); 1237 rcu_copy_process(p);
@@ -1274,7 +1277,6 @@ static struct task_struct *copy_process(unsigned long clone_flags,
1274 p->mempolicy = NULL; 1277 p->mempolicy = NULL;
1275 goto bad_fork_cleanup_threadgroup_lock; 1278 goto bad_fork_cleanup_threadgroup_lock;
1276 } 1279 }
1277 mpol_fix_fork_child_flag(p);
1278#endif 1280#endif
1279#ifdef CONFIG_CPUSETS 1281#ifdef CONFIG_CPUSETS
1280 p->cpuset_mem_spread_rotor = NUMA_NO_NODE; 1282 p->cpuset_mem_spread_rotor = NUMA_NO_NODE;
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 3127ad52cdb2..cb0cf37dac3a 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -23,6 +23,7 @@
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/ctype.h> 24#include <linux/ctype.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/compiler.h>
26 27
27#include <asm/sections.h> 28#include <asm/sections.h>
28 29
@@ -36,8 +37,8 @@
36 * These will be re-linked against their real values 37 * These will be re-linked against their real values
37 * during the second link stage. 38 * during the second link stage.
38 */ 39 */
39extern const unsigned long kallsyms_addresses[] __attribute__((weak)); 40extern const unsigned long kallsyms_addresses[] __weak;
40extern const u8 kallsyms_names[] __attribute__((weak)); 41extern const u8 kallsyms_names[] __weak;
41 42
42/* 43/*
43 * Tell the compiler that the count isn't in the small data section if the arch 44 * Tell the compiler that the count isn't in the small data section if the arch
@@ -46,10 +47,10 @@ extern const u8 kallsyms_names[] __attribute__((weak));
46extern const unsigned long kallsyms_num_syms 47extern const unsigned long kallsyms_num_syms
47__attribute__((weak, section(".rodata"))); 48__attribute__((weak, section(".rodata")));
48 49
49extern const u8 kallsyms_token_table[] __attribute__((weak)); 50extern const u8 kallsyms_token_table[] __weak;
50extern const u16 kallsyms_token_index[] __attribute__((weak)); 51extern const u16 kallsyms_token_index[] __weak;
51 52
52extern const unsigned long kallsyms_markers[] __attribute__((weak)); 53extern const unsigned long kallsyms_markers[] __weak;
53 54
54static inline int is_kernel_inittext(unsigned long addr) 55static inline int is_kernel_inittext(unsigned long addr)
55{ 56{
diff --git a/kernel/kexec.c b/kernel/kexec.c
index c0d261c7db7b..c8380ad203bc 100644
--- a/kernel/kexec.c
+++ b/kernel/kexec.c
@@ -32,6 +32,7 @@
32#include <linux/vmalloc.h> 32#include <linux/vmalloc.h>
33#include <linux/swap.h> 33#include <linux/swap.h>
34#include <linux/syscore_ops.h> 34#include <linux/syscore_ops.h>
35#include <linux/compiler.h>
35 36
36#include <asm/page.h> 37#include <asm/page.h>
37#include <asm/uaccess.h> 38#include <asm/uaccess.h>
@@ -1551,10 +1552,10 @@ void vmcoreinfo_append_str(const char *fmt, ...)
1551 * provide an empty default implementation here -- architecture 1552 * provide an empty default implementation here -- architecture
1552 * code may override this 1553 * code may override this
1553 */ 1554 */
1554void __attribute__ ((weak)) arch_crash_save_vmcoreinfo(void) 1555void __weak arch_crash_save_vmcoreinfo(void)
1555{} 1556{}
1556 1557
1557unsigned long __attribute__ ((weak)) paddr_vmcoreinfo_note(void) 1558unsigned long __weak paddr_vmcoreinfo_note(void)
1558{ 1559{
1559 return __pa((unsigned long)(char *)&vmcoreinfo_note); 1560 return __pa((unsigned long)(char *)&vmcoreinfo_note);
1560} 1561}
diff --git a/kernel/ksysfs.c b/kernel/ksysfs.c
index e660964086e2..2495a9b14ac8 100644
--- a/kernel/ksysfs.c
+++ b/kernel/ksysfs.c
@@ -18,6 +18,7 @@
18#include <linux/stat.h> 18#include <linux/stat.h>
19#include <linux/sched.h> 19#include <linux/sched.h>
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/compiler.h>
21 22
22#include <linux/rcupdate.h> /* rcu_expedited */ 23#include <linux/rcupdate.h> /* rcu_expedited */
23 24
@@ -162,8 +163,8 @@ KERNEL_ATTR_RW(rcu_expedited);
162/* 163/*
163 * Make /sys/kernel/notes give the raw contents of our kernel .notes section. 164 * Make /sys/kernel/notes give the raw contents of our kernel .notes section.
164 */ 165 */
165extern const void __start_notes __attribute__((weak)); 166extern const void __start_notes __weak;
166extern const void __stop_notes __attribute__((weak)); 167extern const void __stop_notes __weak;
167#define notes_size (&__stop_notes - &__start_notes) 168#define notes_size (&__stop_notes - &__start_notes)
168 169
169static ssize_t notes_read(struct file *filp, struct kobject *kobj, 170static ssize_t notes_read(struct file *filp, struct kobject *kobj,
diff --git a/kernel/locking/Makefile b/kernel/locking/Makefile
index 306a76b51e0f..b8bdcd4785b7 100644
--- a/kernel/locking/Makefile
+++ b/kernel/locking/Makefile
@@ -1,5 +1,5 @@
1 1
2obj-y += mutex.o semaphore.o rwsem.o lglock.o mcs_spinlock.o 2obj-y += mutex.o semaphore.o rwsem.o mcs_spinlock.o
3 3
4ifdef CONFIG_FUNCTION_TRACER 4ifdef CONFIG_FUNCTION_TRACER
5CFLAGS_REMOVE_lockdep.o = -pg 5CFLAGS_REMOVE_lockdep.o = -pg
@@ -14,6 +14,7 @@ ifeq ($(CONFIG_PROC_FS),y)
14obj-$(CONFIG_LOCKDEP) += lockdep_proc.o 14obj-$(CONFIG_LOCKDEP) += lockdep_proc.o
15endif 15endif
16obj-$(CONFIG_SMP) += spinlock.o 16obj-$(CONFIG_SMP) += spinlock.o
17obj-$(CONFIG_SMP) += lglock.o
17obj-$(CONFIG_PROVE_LOCKING) += spinlock.o 18obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
18obj-$(CONFIG_RT_MUTEXES) += rtmutex.o 19obj-$(CONFIG_RT_MUTEXES) += rtmutex.o
19obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o 20obj-$(CONFIG_DEBUG_RT_MUTEXES) += rtmutex-debug.o
diff --git a/kernel/module.c b/kernel/module.c
index 29f7790eaa14..11869408f79b 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -640,7 +640,7 @@ static int module_unload_init(struct module *mod)
640 INIT_LIST_HEAD(&mod->target_list); 640 INIT_LIST_HEAD(&mod->target_list);
641 641
642 /* Hold reference count during initialization. */ 642 /* Hold reference count during initialization. */
643 __this_cpu_write(mod->refptr->incs, 1); 643 raw_cpu_write(mod->refptr->incs, 1);
644 644
645 return 0; 645 return 0;
646} 646}
diff --git a/kernel/panic.c b/kernel/panic.c
index 79fd820bb5e8..d02fa9fef46a 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -100,7 +100,7 @@ void panic(const char *fmt, ...)
100 va_start(args, fmt); 100 va_start(args, fmt);
101 vsnprintf(buf, sizeof(buf), fmt, args); 101 vsnprintf(buf, sizeof(buf), fmt, args);
102 va_end(args); 102 va_end(args);
103 printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf); 103 pr_emerg("Kernel panic - not syncing: %s\n", buf);
104#ifdef CONFIG_DEBUG_BUGVERBOSE 104#ifdef CONFIG_DEBUG_BUGVERBOSE
105 /* 105 /*
106 * Avoid nested stack-dumping if a panic occurs during oops processing 106 * Avoid nested stack-dumping if a panic occurs during oops processing
@@ -141,7 +141,7 @@ void panic(const char *fmt, ...)
141 * Delay timeout seconds before rebooting the machine. 141 * Delay timeout seconds before rebooting the machine.
142 * We can't use the "normal" timers since we just panicked. 142 * We can't use the "normal" timers since we just panicked.
143 */ 143 */
144 printk(KERN_EMERG "Rebooting in %d seconds..", panic_timeout); 144 pr_emerg("Rebooting in %d seconds..", panic_timeout);
145 145
146 for (i = 0; i < panic_timeout * 1000; i += PANIC_TIMER_STEP) { 146 for (i = 0; i < panic_timeout * 1000; i += PANIC_TIMER_STEP) {
147 touch_nmi_watchdog(); 147 touch_nmi_watchdog();
@@ -165,7 +165,7 @@ void panic(const char *fmt, ...)
165 extern int stop_a_enabled; 165 extern int stop_a_enabled;
166 /* Make sure the user can actually press Stop-A (L1-A) */ 166 /* Make sure the user can actually press Stop-A (L1-A) */
167 stop_a_enabled = 1; 167 stop_a_enabled = 1;
168 printk(KERN_EMERG "Press Stop-A (L1-A) to return to the boot prom\n"); 168 pr_emerg("Press Stop-A (L1-A) to return to the boot prom\n");
169 } 169 }
170#endif 170#endif
171#if defined(CONFIG_S390) 171#if defined(CONFIG_S390)
@@ -176,6 +176,7 @@ void panic(const char *fmt, ...)
176 disabled_wait(caller); 176 disabled_wait(caller);
177 } 177 }
178#endif 178#endif
179 pr_emerg("---[ end Kernel panic - not syncing: %s\n", buf);
179 local_irq_enable(); 180 local_irq_enable();
180 for (i = 0; ; i += PANIC_TIMER_STEP) { 181 for (i = 0; ; i += PANIC_TIMER_STEP) {
181 touch_softlockup_watchdog(); 182 touch_softlockup_watchdog();
@@ -276,8 +277,7 @@ unsigned long get_taint(void)
276void add_taint(unsigned flag, enum lockdep_ok lockdep_ok) 277void add_taint(unsigned flag, enum lockdep_ok lockdep_ok)
277{ 278{
278 if (lockdep_ok == LOCKDEP_NOW_UNRELIABLE && __debug_locks_off()) 279 if (lockdep_ok == LOCKDEP_NOW_UNRELIABLE && __debug_locks_off())
279 printk(KERN_WARNING 280 pr_warn("Disabling lock debugging due to kernel taint\n");
280 "Disabling lock debugging due to kernel taint\n");
281 281
282 set_bit(flag, &tainted_mask); 282 set_bit(flag, &tainted_mask);
283} 283}
@@ -382,8 +382,7 @@ late_initcall(init_oops_id);
382void print_oops_end_marker(void) 382void print_oops_end_marker(void)
383{ 383{
384 init_oops_id(); 384 init_oops_id();
385 printk(KERN_WARNING "---[ end trace %016llx ]---\n", 385 pr_warn("---[ end trace %016llx ]---\n", (unsigned long long)oops_id);
386 (unsigned long long)oops_id);
387} 386}
388 387
389/* 388/*
diff --git a/kernel/power/power.h b/kernel/power/power.h
index 1ca753106557..15f37ea08719 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -2,6 +2,7 @@
2#include <linux/suspend_ioctls.h> 2#include <linux/suspend_ioctls.h>
3#include <linux/utsname.h> 3#include <linux/utsname.h>
4#include <linux/freezer.h> 4#include <linux/freezer.h>
5#include <linux/compiler.h>
5 6
6struct swsusp_info { 7struct swsusp_info {
7 struct new_utsname uts; 8 struct new_utsname uts;
@@ -11,7 +12,7 @@ struct swsusp_info {
11 unsigned long image_pages; 12 unsigned long image_pages;
12 unsigned long pages; 13 unsigned long pages;
13 unsigned long size; 14 unsigned long size;
14} __attribute__((aligned(PAGE_SIZE))); 15} __aligned(PAGE_SIZE);
15 16
16#ifdef CONFIG_HIBERNATION 17#ifdef CONFIG_HIBERNATION
17/* kernel/power/snapshot.c */ 18/* kernel/power/snapshot.c */
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 149e745eaa52..18fb7a2fb14b 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -27,6 +27,7 @@
27#include <linux/highmem.h> 27#include <linux/highmem.h>
28#include <linux/list.h> 28#include <linux/list.h>
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/compiler.h>
30 31
31#include <asm/uaccess.h> 32#include <asm/uaccess.h>
32#include <asm/mmu_context.h> 33#include <asm/mmu_context.h>
@@ -155,7 +156,7 @@ static inline void free_image_page(void *addr, int clear_nosave_free)
155struct linked_page { 156struct linked_page {
156 struct linked_page *next; 157 struct linked_page *next;
157 char data[LINKED_PAGE_DATA_SIZE]; 158 char data[LINKED_PAGE_DATA_SIZE];
158} __attribute__((packed)); 159} __packed;
159 160
160static inline void 161static inline void
161free_list_of_pages(struct linked_page *list, int clear_page_nosave) 162free_list_of_pages(struct linked_page *list, int clear_page_nosave)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 90b3d9366d1a..c3ad9cafe930 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -26,6 +26,7 @@
26#include <linux/syscore_ops.h> 26#include <linux/syscore_ops.h>
27#include <linux/ftrace.h> 27#include <linux/ftrace.h>
28#include <trace/events/power.h> 28#include <trace/events/power.h>
29#include <linux/compiler.h>
29 30
30#include "power.h" 31#include "power.h"
31 32
@@ -156,13 +157,13 @@ static int suspend_prepare(suspend_state_t state)
156} 157}
157 158
158/* default implementation */ 159/* default implementation */
159void __attribute__ ((weak)) arch_suspend_disable_irqs(void) 160void __weak arch_suspend_disable_irqs(void)
160{ 161{
161 local_irq_disable(); 162 local_irq_disable();
162} 163}
163 164
164/* default implementation */ 165/* default implementation */
165void __attribute__ ((weak)) arch_suspend_enable_irqs(void) 166void __weak arch_suspend_enable_irqs(void)
166{ 167{
167 local_irq_enable(); 168 local_irq_enable();
168} 169}
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 7c33ed200410..8c9a4819f798 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -101,7 +101,7 @@ struct swsusp_header {
101 unsigned int flags; /* Flags to pass to the "boot" kernel */ 101 unsigned int flags; /* Flags to pass to the "boot" kernel */
102 char orig_sig[10]; 102 char orig_sig[10];
103 char sig[10]; 103 char sig[10];
104} __attribute__((packed)); 104} __packed;
105 105
106static struct swsusp_header *swsusp_header; 106static struct swsusp_header *swsusp_header;
107 107
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index 4aa8a305aede..51dbac6a3633 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -22,8 +22,18 @@ void res_counter_init(struct res_counter *counter, struct res_counter *parent)
22 counter->parent = parent; 22 counter->parent = parent;
23} 23}
24 24
25int res_counter_charge_locked(struct res_counter *counter, unsigned long val, 25static u64 res_counter_uncharge_locked(struct res_counter *counter,
26 bool force) 26 unsigned long val)
27{
28 if (WARN_ON(counter->usage < val))
29 val = counter->usage;
30
31 counter->usage -= val;
32 return counter->usage;
33}
34
35static int res_counter_charge_locked(struct res_counter *counter,
36 unsigned long val, bool force)
27{ 37{
28 int ret = 0; 38 int ret = 0;
29 39
@@ -86,15 +96,6 @@ int res_counter_charge_nofail(struct res_counter *counter, unsigned long val,
86 return __res_counter_charge(counter, val, limit_fail_at, true); 96 return __res_counter_charge(counter, val, limit_fail_at, true);
87} 97}
88 98
89u64 res_counter_uncharge_locked(struct res_counter *counter, unsigned long val)
90{
91 if (WARN_ON(counter->usage < val))
92 val = counter->usage;
93
94 counter->usage -= val;
95 return counter->usage;
96}
97
98u64 res_counter_uncharge_until(struct res_counter *counter, 99u64 res_counter_uncharge_until(struct res_counter *counter,
99 struct res_counter *top, 100 struct res_counter *top,
100 unsigned long val) 101 unsigned long val)
diff --git a/kernel/sched/clock.c b/kernel/sched/clock.c
index b30a2924ef14..3ef6451e972e 100644
--- a/kernel/sched/clock.c
+++ b/kernel/sched/clock.c
@@ -60,13 +60,14 @@
60#include <linux/sched.h> 60#include <linux/sched.h>
61#include <linux/static_key.h> 61#include <linux/static_key.h>
62#include <linux/workqueue.h> 62#include <linux/workqueue.h>
63#include <linux/compiler.h>
63 64
64/* 65/*
65 * Scheduler clock - returns current time in nanosec units. 66 * Scheduler clock - returns current time in nanosec units.
66 * This is default implementation. 67 * This is default implementation.
67 * Architectures and sub-architectures can override this. 68 * Architectures and sub-architectures can override this.
68 */ 69 */
69unsigned long long __attribute__((weak)) sched_clock(void) 70unsigned long long __weak sched_clock(void)
70{ 71{
71 return (unsigned long long)(jiffies - INITIAL_JIFFIES) 72 return (unsigned long long)(jiffies - INITIAL_JIFFIES)
72 * (NSEC_PER_SEC / HZ); 73 * (NSEC_PER_SEC / HZ);
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 0ff3f34bc7e3..268a45ea238c 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -73,6 +73,7 @@
73#include <linux/init_task.h> 73#include <linux/init_task.h>
74#include <linux/binfmts.h> 74#include <linux/binfmts.h>
75#include <linux/context_tracking.h> 75#include <linux/context_tracking.h>
76#include <linux/compiler.h>
76 77
77#include <asm/switch_to.h> 78#include <asm/switch_to.h>
78#include <asm/tlb.h> 79#include <asm/tlb.h>
@@ -6452,7 +6453,7 @@ static cpumask_var_t fallback_doms;
6452 * cpu core maps. It is supposed to return 1 if the topology changed 6453 * cpu core maps. It is supposed to return 1 if the topology changed
6453 * or 0 if it stayed the same. 6454 * or 0 if it stayed the same.
6454 */ 6455 */
6455int __attribute__((weak)) arch_update_cpu_topology(void) 6456int __weak arch_update_cpu_topology(void)
6456{ 6457{
6457 return 0; 6458 return 0;
6458} 6459}
diff --git a/kernel/signal.c b/kernel/signal.c
index 5d4b05a229a6..6ea13c09ae56 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -33,6 +33,8 @@
33#include <linux/uprobes.h> 33#include <linux/uprobes.h>
34#include <linux/compat.h> 34#include <linux/compat.h>
35#include <linux/cn_proc.h> 35#include <linux/cn_proc.h>
36#include <linux/compiler.h>
37
36#define CREATE_TRACE_POINTS 38#define CREATE_TRACE_POINTS
37#include <trace/events/signal.h> 39#include <trace/events/signal.h>
38 40
@@ -3618,7 +3620,7 @@ SYSCALL_DEFINE3(sigsuspend, int, unused1, int, unused2, old_sigset_t, mask)
3618} 3620}
3619#endif 3621#endif
3620 3622
3621__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma) 3623__weak const char *arch_vma_name(struct vm_area_struct *vma)
3622{ 3624{
3623 return NULL; 3625 return NULL;
3624} 3626}
diff --git a/kernel/sys.c b/kernel/sys.c
index adaeab6f7a87..fba0f29401ea 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1996,6 +1996,21 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
1996 if (arg2 || arg3 || arg4 || arg5) 1996 if (arg2 || arg3 || arg4 || arg5)
1997 return -EINVAL; 1997 return -EINVAL;
1998 return current->no_new_privs ? 1 : 0; 1998 return current->no_new_privs ? 1 : 0;
1999 case PR_GET_THP_DISABLE:
2000 if (arg2 || arg3 || arg4 || arg5)
2001 return -EINVAL;
2002 error = !!(me->mm->def_flags & VM_NOHUGEPAGE);
2003 break;
2004 case PR_SET_THP_DISABLE:
2005 if (arg3 || arg4 || arg5)
2006 return -EINVAL;
2007 down_write(&me->mm->mmap_sem);
2008 if (arg2)
2009 me->mm->def_flags |= VM_NOHUGEPAGE;
2010 else
2011 me->mm->def_flags &= ~VM_NOHUGEPAGE;
2012 up_write(&me->mm->mmap_sem);
2013 break;
1999 default: 2014 default:
2000 error = -EINVAL; 2015 error = -EINVAL;
2001 break; 2016 break;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index 5c14b547882e..74f5b580fe34 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -141,6 +141,11 @@ static int min_percpu_pagelist_fract = 8;
141static int ngroups_max = NGROUPS_MAX; 141static int ngroups_max = NGROUPS_MAX;
142static const int cap_last_cap = CAP_LAST_CAP; 142static const int cap_last_cap = CAP_LAST_CAP;
143 143
144/*this is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs */
145#ifdef CONFIG_DETECT_HUNG_TASK
146static unsigned long hung_task_timeout_max = (LONG_MAX/HZ);
147#endif
148
144#ifdef CONFIG_INOTIFY_USER 149#ifdef CONFIG_INOTIFY_USER
145#include <linux/inotify.h> 150#include <linux/inotify.h>
146#endif 151#endif
@@ -985,6 +990,7 @@ static struct ctl_table kern_table[] = {
985 .maxlen = sizeof(unsigned long), 990 .maxlen = sizeof(unsigned long),
986 .mode = 0644, 991 .mode = 0644,
987 .proc_handler = proc_dohung_task_timeout_secs, 992 .proc_handler = proc_dohung_task_timeout_secs,
993 .extra2 = &hung_task_timeout_max,
988 }, 994 },
989 { 995 {
990 .procname = "hung_task_warnings", 996 .procname = "hung_task_warnings",
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 5b40279ecd71..f7df8ea21707 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -22,6 +22,7 @@
22#include <linux/tick.h> 22#include <linux/tick.h>
23#include <linux/stop_machine.h> 23#include <linux/stop_machine.h>
24#include <linux/pvclock_gtod.h> 24#include <linux/pvclock_gtod.h>
25#include <linux/compiler.h>
25 26
26#include "tick-internal.h" 27#include "tick-internal.h"
27#include "ntp_internal.h" 28#include "ntp_internal.h"
@@ -760,7 +761,7 @@ u64 timekeeping_max_deferment(void)
760 * 761 *
761 * XXX - Do be sure to remove it once all arches implement it. 762 * XXX - Do be sure to remove it once all arches implement it.
762 */ 763 */
763void __attribute__((weak)) read_persistent_clock(struct timespec *ts) 764void __weak read_persistent_clock(struct timespec *ts)
764{ 765{
765 ts->tv_sec = 0; 766 ts->tv_sec = 0;
766 ts->tv_nsec = 0; 767 ts->tv_nsec = 0;
@@ -775,7 +776,7 @@ void __attribute__((weak)) read_persistent_clock(struct timespec *ts)
775 * 776 *
776 * XXX - Do be sure to remove it once all arches implement it. 777 * XXX - Do be sure to remove it once all arches implement it.
777 */ 778 */
778void __attribute__((weak)) read_boot_clock(struct timespec *ts) 779void __weak read_boot_clock(struct timespec *ts)
779{ 780{
780 ts->tv_sec = 0; 781 ts->tv_sec = 0;
781 ts->tv_nsec = 0; 782 ts->tv_nsec = 0;
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index ffc314b7e92b..2e29d7ba5a52 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -13,6 +13,7 @@
13#include <linux/hw_breakpoint.h> 13#include <linux/hw_breakpoint.h>
14#include <linux/trace_seq.h> 14#include <linux/trace_seq.h>
15#include <linux/ftrace_event.h> 15#include <linux/ftrace_event.h>
16#include <linux/compiler.h>
16 17
17#ifdef CONFIG_FTRACE_SYSCALLS 18#ifdef CONFIG_FTRACE_SYSCALLS
18#include <asm/unistd.h> /* For NR_SYSCALLS */ 19#include <asm/unistd.h> /* For NR_SYSCALLS */
@@ -1279,7 +1280,7 @@ int set_tracer_flag(struct trace_array *tr, unsigned int mask, int enabled);
1279#undef FTRACE_ENTRY 1280#undef FTRACE_ENTRY
1280#define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \ 1281#define FTRACE_ENTRY(call, struct_name, id, tstruct, print, filter) \
1281 extern struct ftrace_event_call \ 1282 extern struct ftrace_event_call \
1282 __attribute__((__aligned__(4))) event_##call; 1283 __aligned(4) event_##call;
1283#undef FTRACE_ENTRY_DUP 1284#undef FTRACE_ENTRY_DUP
1284#define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print, filter) \ 1285#define FTRACE_ENTRY_DUP(call, struct_name, id, tstruct, print, filter) \
1285 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print), \ 1286 FTRACE_ENTRY(call, struct_name, id, PARAMS(tstruct), PARAMS(print), \