Commit d2865c7d4ef818421941579e185c1e4743692f85

Authored by Linus Torvalds

Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull scheduler fixes from Ingo Molnar:
 "A CONFIG_STACK_GROWSUP=y fix, and a hotplug llc CPU mask fix"

* 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  sched: Fix unreleased llc_shared_mask bit during CPU hotplug
  sched: Fix end_of_stack() and location of stack canary for architectures using CONFIG_STACK_GROWSUP

Showing 2 changed files Side-by-side Diff

arch/x86/kernel/smpboot.c
... ... @@ -1284,6 +1284,9 @@
1284 1284  
1285 1285 for_each_cpu(sibling, cpu_sibling_mask(cpu))
1286 1286 cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling));
  1287 + for_each_cpu(sibling, cpu_llc_shared_mask(cpu))
  1288 + cpumask_clear_cpu(cpu, cpu_llc_shared_mask(sibling));
  1289 + cpumask_clear(cpu_llc_shared_mask(cpu));
1287 1290 cpumask_clear(cpu_sibling_mask(cpu));
1288 1291 cpumask_clear(cpu_core_mask(cpu));
1289 1292 c->phys_proc_id = 0;
include/linux/sched.h
... ... @@ -2608,9 +2608,22 @@
2608 2608 task_thread_info(p)->task = p;
2609 2609 }
2610 2610  
  2611 +/*
  2612 + * Return the address of the last usable long on the stack.
  2613 + *
  2614 + * When the stack grows down, this is just above the thread
  2615 + * info struct. Going any lower will corrupt the threadinfo.
  2616 + *
  2617 + * When the stack grows up, this is the highest address.
  2618 + * Beyond that position, we corrupt data on the next page.
  2619 + */
2611 2620 static inline unsigned long *end_of_stack(struct task_struct *p)
2612 2621 {
  2622 +#ifdef CONFIG_STACK_GROWSUP
  2623 + return (unsigned long *)((unsigned long)task_thread_info(p) + THREAD_SIZE) - 1;
  2624 +#else
2613 2625 return (unsigned long *)(task_thread_info(p) + 1);
  2626 +#endif
2614 2627 }
2615 2628  
2616 2629 #endif