process.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. #include <linux/errno.h>
  2. #include <linux/kernel.h>
  3. #include <linux/mm.h>
  4. #include <linux/smp.h>
  5. #include <linux/prctl.h>
  6. #include <linux/slab.h>
  7. #include <linux/sched.h>
  8. #include <linux/module.h>
  9. #include <linux/pm.h>
  10. #include <linux/clockchips.h>
  11. #include <linux/random.h>
  12. #include <linux/user-return-notifier.h>
  13. #include <linux/dmi.h>
  14. #include <linux/utsname.h>
  15. #include <trace/events/power.h>
  16. #include <linux/hw_breakpoint.h>
  17. #include <asm/system.h>
  18. #include <asm/apic.h>
  19. #include <asm/syscalls.h>
  20. #include <asm/idle.h>
  21. #include <asm/uaccess.h>
  22. #include <asm/i387.h>
  23. #include <asm/ds.h>
  24. #include <asm/debugreg.h>
  25. unsigned long idle_halt;
  26. EXPORT_SYMBOL(idle_halt);
  27. unsigned long idle_nomwait;
  28. EXPORT_SYMBOL(idle_nomwait);
  29. struct kmem_cache *task_xstate_cachep;
  30. int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
  31. {
  32. *dst = *src;
  33. if (src->thread.xstate) {
  34. dst->thread.xstate = kmem_cache_alloc(task_xstate_cachep,
  35. GFP_KERNEL);
  36. if (!dst->thread.xstate)
  37. return -ENOMEM;
  38. WARN_ON((unsigned long)dst->thread.xstate & 15);
  39. memcpy(dst->thread.xstate, src->thread.xstate, xstate_size);
  40. }
  41. return 0;
  42. }
  43. void free_thread_xstate(struct task_struct *tsk)
  44. {
  45. if (tsk->thread.xstate) {
  46. kmem_cache_free(task_xstate_cachep, tsk->thread.xstate);
  47. tsk->thread.xstate = NULL;
  48. }
  49. WARN(tsk->thread.ds_ctx, "leaking DS context\n");
  50. }
  51. void free_thread_info(struct thread_info *ti)
  52. {
  53. free_thread_xstate(ti->task);
  54. free_pages((unsigned long)ti, get_order(THREAD_SIZE));
  55. }
  56. void arch_task_cache_init(void)
  57. {
  58. task_xstate_cachep =
  59. kmem_cache_create("task_xstate", xstate_size,
  60. __alignof__(union thread_xstate),
  61. SLAB_PANIC | SLAB_NOTRACK, NULL);
  62. }
  63. /*
  64. * Free current thread data structures etc..
  65. */
  66. void exit_thread(void)
  67. {
  68. struct task_struct *me = current;
  69. struct thread_struct *t = &me->thread;
  70. unsigned long *bp = t->io_bitmap_ptr;
  71. if (bp) {
  72. struct tss_struct *tss = &per_cpu(init_tss, get_cpu());
  73. t->io_bitmap_ptr = NULL;
  74. clear_thread_flag(TIF_IO_BITMAP);
  75. /*
  76. * Careful, clear this in the TSS too:
  77. */
  78. memset(tss->io_bitmap, 0xff, t->io_bitmap_max);
  79. t->io_bitmap_max = 0;
  80. put_cpu();
  81. kfree(bp);
  82. }
  83. }
  84. void show_regs(struct pt_regs *regs)
  85. {
  86. show_registers(regs);
  87. show_trace(NULL, regs, (unsigned long *)kernel_stack_pointer(regs),
  88. regs->bp);
  89. }
  90. void show_regs_common(void)
  91. {
  92. const char *board, *product;
  93. board = dmi_get_system_info(DMI_BOARD_NAME);
  94. if (!board)
  95. board = "";
  96. product = dmi_get_system_info(DMI_PRODUCT_NAME);
  97. if (!product)
  98. product = "";
  99. printk(KERN_CONT "\n");
  100. printk(KERN_DEFAULT "Pid: %d, comm: %.20s %s %s %.*s %s/%s\n",
  101. current->pid, current->comm, print_tainted(),
  102. init_utsname()->release,
  103. (int)strcspn(init_utsname()->version, " "),
  104. init_utsname()->version, board, product);
  105. }
  106. void flush_thread(void)
  107. {
  108. struct task_struct *tsk = current;
  109. flush_ptrace_hw_breakpoint(tsk);
  110. memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));
  111. /*
  112. * Forget coprocessor state..
  113. */
  114. tsk->fpu_counter = 0;
  115. clear_fpu(tsk);
  116. clear_used_math();
  117. }
  118. static void hard_disable_TSC(void)
  119. {
  120. write_cr4(read_cr4() | X86_CR4_TSD);
  121. }
  122. void disable_TSC(void)
  123. {
  124. preempt_disable();
  125. if (!test_and_set_thread_flag(TIF_NOTSC))
  126. /*
  127. * Must flip the CPU state synchronously with
  128. * TIF_NOTSC in the current running context.
  129. */
  130. hard_disable_TSC();
  131. preempt_enable();
  132. }
  133. static void hard_enable_TSC(void)
  134. {
  135. write_cr4(read_cr4() & ~X86_CR4_TSD);
  136. }
  137. static void enable_TSC(void)
  138. {
  139. preempt_disable();
  140. if (test_and_clear_thread_flag(TIF_NOTSC))
  141. /*
  142. * Must flip the CPU state synchronously with
  143. * TIF_NOTSC in the current running context.
  144. */
  145. hard_enable_TSC();
  146. preempt_enable();
  147. }
  148. int get_tsc_mode(unsigned long adr)
  149. {
  150. unsigned int val;
  151. if (test_thread_flag(TIF_NOTSC))
  152. val = PR_TSC_SIGSEGV;
  153. else
  154. val = PR_TSC_ENABLE;
  155. return put_user(val, (unsigned int __user *)adr);
  156. }
  157. int set_tsc_mode(unsigned int val)
  158. {
  159. if (val == PR_TSC_SIGSEGV)
  160. disable_TSC();
  161. else if (val == PR_TSC_ENABLE)
  162. enable_TSC();
  163. else
  164. return -EINVAL;
  165. return 0;
  166. }
  167. void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
  168. struct tss_struct *tss)
  169. {
  170. struct thread_struct *prev, *next;
  171. prev = &prev_p->thread;
  172. next = &next_p->thread;
  173. if (test_tsk_thread_flag(next_p, TIF_DS_AREA_MSR) ||
  174. test_tsk_thread_flag(prev_p, TIF_DS_AREA_MSR))
  175. ds_switch_to(prev_p, next_p);
  176. else if (next->debugctlmsr != prev->debugctlmsr)
  177. update_debugctlmsr(next->debugctlmsr);
  178. if (test_tsk_thread_flag(prev_p, TIF_NOTSC) ^
  179. test_tsk_thread_flag(next_p, TIF_NOTSC)) {
  180. /* prev and next are different */
  181. if (test_tsk_thread_flag(next_p, TIF_NOTSC))
  182. hard_disable_TSC();
  183. else
  184. hard_enable_TSC();
  185. }
  186. if (test_tsk_thread_flag(next_p, TIF_IO_BITMAP)) {
  187. /*
  188. * Copy the relevant range of the IO bitmap.
  189. * Normally this is 128 bytes or less:
  190. */
  191. memcpy(tss->io_bitmap, next->io_bitmap_ptr,
  192. max(prev->io_bitmap_max, next->io_bitmap_max));
  193. } else if (test_tsk_thread_flag(prev_p, TIF_IO_BITMAP)) {
  194. /*
  195. * Clear any possible leftover bits:
  196. */
  197. memset(tss->io_bitmap, 0xff, prev->io_bitmap_max);
  198. }
  199. propagate_user_return_notify(prev_p, next_p);
  200. }
  201. int sys_fork(struct pt_regs *regs)
  202. {
  203. return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
  204. }
  205. /*
  206. * This is trivial, and on the face of it looks like it
  207. * could equally well be done in user mode.
  208. *
  209. * Not so, for quite unobvious reasons - register pressure.
  210. * In user mode vfork() cannot have a stack frame, and if
  211. * done by calling the "clone()" system call directly, you
  212. * do not have enough call-clobbered registers to hold all
  213. * the information you need.
  214. */
  215. int sys_vfork(struct pt_regs *regs)
  216. {
  217. return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->sp, regs, 0,
  218. NULL, NULL);
  219. }
  220. long
  221. sys_clone(unsigned long clone_flags, unsigned long newsp,
  222. void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
  223. {
  224. if (!newsp)
  225. newsp = regs->sp;
  226. return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
  227. }
  228. /*
  229. * This gets run with %si containing the
  230. * function to call, and %di containing
  231. * the "args".
  232. */
  233. extern void kernel_thread_helper(void);
  234. /*
  235. * Create a kernel thread
  236. */
  237. int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
  238. {
  239. struct pt_regs regs;
  240. memset(&regs, 0, sizeof(regs));
  241. regs.si = (unsigned long) fn;
  242. regs.di = (unsigned long) arg;
  243. #ifdef CONFIG_X86_32
  244. regs.ds = __USER_DS;
  245. regs.es = __USER_DS;
  246. regs.fs = __KERNEL_PERCPU;
  247. regs.gs = __KERNEL_STACK_CANARY;
  248. #else
  249. regs.ss = __KERNEL_DS;
  250. #endif
  251. regs.orig_ax = -1;
  252. regs.ip = (unsigned long) kernel_thread_helper;
  253. regs.cs = __KERNEL_CS | get_kernel_rpl();
  254. regs.flags = X86_EFLAGS_IF | 0x2;
  255. /* Ok, create the new process.. */
  256. return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
  257. }
  258. EXPORT_SYMBOL(kernel_thread);
  259. /*
  260. * sys_execve() executes a new program.
  261. */
  262. long sys_execve(char __user *name, char __user * __user *argv,
  263. char __user * __user *envp, struct pt_regs *regs)
  264. {
  265. long error;
  266. char *filename;
  267. filename = getname(name);
  268. error = PTR_ERR(filename);
  269. if (IS_ERR(filename))
  270. return error;
  271. error = do_execve(filename, argv, envp, regs);
  272. #ifdef CONFIG_X86_32
  273. if (error == 0) {
  274. /* Make sure we don't return using sysenter.. */
  275. set_thread_flag(TIF_IRET);
  276. }
  277. #endif
  278. putname(filename);
  279. return error;
  280. }
  281. /*
  282. * Idle related variables and functions
  283. */
  284. unsigned long boot_option_idle_override = 0;
  285. EXPORT_SYMBOL(boot_option_idle_override);
  286. /*
  287. * Powermanagement idle function, if any..
  288. */
  289. void (*pm_idle)(void);
  290. EXPORT_SYMBOL(pm_idle);
  291. #ifdef CONFIG_X86_32
  292. /*
  293. * This halt magic was a workaround for ancient floppy DMA
  294. * wreckage. It should be safe to remove.
  295. */
  296. static int hlt_counter;
  297. void disable_hlt(void)
  298. {
  299. hlt_counter++;
  300. }
  301. EXPORT_SYMBOL(disable_hlt);
  302. void enable_hlt(void)
  303. {
  304. hlt_counter--;
  305. }
  306. EXPORT_SYMBOL(enable_hlt);
  307. static inline int hlt_use_halt(void)
  308. {
  309. return (!hlt_counter && boot_cpu_data.hlt_works_ok);
  310. }
  311. #else
  312. static inline int hlt_use_halt(void)
  313. {
  314. return 1;
  315. }
  316. #endif
  317. /*
  318. * We use this if we don't have any better
  319. * idle routine..
  320. */
  321. void default_idle(void)
  322. {
  323. if (hlt_use_halt()) {
  324. trace_power_start(POWER_CSTATE, 1);
  325. current_thread_info()->status &= ~TS_POLLING;
  326. /*
  327. * TS_POLLING-cleared state must be visible before we
  328. * test NEED_RESCHED:
  329. */
  330. smp_mb();
  331. if (!need_resched())
  332. safe_halt(); /* enables interrupts racelessly */
  333. else
  334. local_irq_enable();
  335. current_thread_info()->status |= TS_POLLING;
  336. } else {
  337. local_irq_enable();
  338. /* loop is done by the caller */
  339. cpu_relax();
  340. }
  341. }
  342. #ifdef CONFIG_APM_MODULE
  343. EXPORT_SYMBOL(default_idle);
  344. #endif
  345. void stop_this_cpu(void *dummy)
  346. {
  347. local_irq_disable();
  348. /*
  349. * Remove this CPU:
  350. */
  351. set_cpu_online(smp_processor_id(), false);
  352. disable_local_APIC();
  353. for (;;) {
  354. if (hlt_works(smp_processor_id()))
  355. halt();
  356. }
  357. }
  358. static void do_nothing(void *unused)
  359. {
  360. }
  361. /*
  362. * cpu_idle_wait - Used to ensure that all the CPUs discard old value of
  363. * pm_idle and update to new pm_idle value. Required while changing pm_idle
  364. * handler on SMP systems.
  365. *
  366. * Caller must have changed pm_idle to the new value before the call. Old
  367. * pm_idle value will not be used by any CPU after the return of this function.
  368. */
  369. void cpu_idle_wait(void)
  370. {
  371. smp_mb();
  372. /* kick all the CPUs so that they exit out of pm_idle */
  373. smp_call_function(do_nothing, NULL, 1);
  374. }
  375. EXPORT_SYMBOL_GPL(cpu_idle_wait);
  376. /*
  377. * This uses new MONITOR/MWAIT instructions on P4 processors with PNI,
  378. * which can obviate IPI to trigger checking of need_resched.
  379. * We execute MONITOR against need_resched and enter optimized wait state
  380. * through MWAIT. Whenever someone changes need_resched, we would be woken
  381. * up from MWAIT (without an IPI).
  382. *
  383. * New with Core Duo processors, MWAIT can take some hints based on CPU
  384. * capability.
  385. */
  386. void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
  387. {
  388. trace_power_start(POWER_CSTATE, (ax>>4)+1);
  389. if (!need_resched()) {
  390. if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
  391. clflush((void *)&current_thread_info()->flags);
  392. __monitor((void *)&current_thread_info()->flags, 0, 0);
  393. smp_mb();
  394. if (!need_resched())
  395. __mwait(ax, cx);
  396. }
  397. }
  398. /* Default MONITOR/MWAIT with no hints, used for default C1 state */
  399. static void mwait_idle(void)
  400. {
  401. if (!need_resched()) {
  402. trace_power_start(POWER_CSTATE, 1);
  403. if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
  404. clflush((void *)&current_thread_info()->flags);
  405. __monitor((void *)&current_thread_info()->flags, 0, 0);
  406. smp_mb();
  407. if (!need_resched())
  408. __sti_mwait(0, 0);
  409. else
  410. local_irq_enable();
  411. } else
  412. local_irq_enable();
  413. }
  414. /*
  415. * On SMP it's slightly faster (but much more power-consuming!)
  416. * to poll the ->work.need_resched flag instead of waiting for the
  417. * cross-CPU IPI to arrive. Use this option with caution.
  418. */
  419. static void poll_idle(void)
  420. {
  421. trace_power_start(POWER_CSTATE, 0);
  422. local_irq_enable();
  423. while (!need_resched())
  424. cpu_relax();
  425. trace_power_end(0);
  426. }
  427. /*
  428. * mwait selection logic:
  429. *
  430. * It depends on the CPU. For AMD CPUs that support MWAIT this is
  431. * wrong. Family 0x10 and 0x11 CPUs will enter C1 on HLT. Powersavings
  432. * then depend on a clock divisor and current Pstate of the core. If
  433. * all cores of a processor are in halt state (C1) the processor can
  434. * enter the C1E (C1 enhanced) state. If mwait is used this will never
  435. * happen.
  436. *
  437. * idle=mwait overrides this decision and forces the usage of mwait.
  438. */
  439. static int __cpuinitdata force_mwait;
  440. #define MWAIT_INFO 0x05
  441. #define MWAIT_ECX_EXTENDED_INFO 0x01
  442. #define MWAIT_EDX_C1 0xf0
  443. static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
  444. {
  445. u32 eax, ebx, ecx, edx;
  446. if (force_mwait)
  447. return 1;
  448. if (c->cpuid_level < MWAIT_INFO)
  449. return 0;
  450. cpuid(MWAIT_INFO, &eax, &ebx, &ecx, &edx);
  451. /* Check, whether EDX has extended info about MWAIT */
  452. if (!(ecx & MWAIT_ECX_EXTENDED_INFO))
  453. return 1;
  454. /*
  455. * edx enumeratios MONITOR/MWAIT extensions. Check, whether
  456. * C1 supports MWAIT
  457. */
  458. return (edx & MWAIT_EDX_C1);
  459. }
  460. /*
  461. * Check for AMD CPUs, where APIC timer interrupt does not wake up CPU from C1e.
  462. * For more information see
  463. * - Erratum #400 for NPT family 0xf and family 0x10 CPUs
  464. * - Erratum #365 for family 0x11 (not affected because C1e not in use)
  465. */
  466. static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
  467. {
  468. u64 val;
  469. if (c->x86_vendor != X86_VENDOR_AMD)
  470. goto no_c1e_idle;
  471. /* Family 0x0f models < rev F do not have C1E */
  472. if (c->x86 == 0x0F && c->x86_model >= 0x40)
  473. return 1;
  474. if (c->x86 == 0x10) {
  475. /*
  476. * check OSVW bit for CPUs that are not affected
  477. * by erratum #400
  478. */
  479. rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
  480. if (val >= 2) {
  481. rdmsrl(MSR_AMD64_OSVW_STATUS, val);
  482. if (!(val & BIT(1)))
  483. goto no_c1e_idle;
  484. }
  485. return 1;
  486. }
  487. no_c1e_idle:
  488. return 0;
  489. }
  490. static cpumask_var_t c1e_mask;
  491. static int c1e_detected;
  492. void c1e_remove_cpu(int cpu)
  493. {
  494. if (c1e_mask != NULL)
  495. cpumask_clear_cpu(cpu, c1e_mask);
  496. }
  497. /*
  498. * C1E aware idle routine. We check for C1E active in the interrupt
  499. * pending message MSR. If we detect C1E, then we handle it the same
  500. * way as C3 power states (local apic timer and TSC stop)
  501. */
  502. static void c1e_idle(void)
  503. {
  504. if (need_resched())
  505. return;
  506. if (!c1e_detected) {
  507. u32 lo, hi;
  508. rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
  509. if (lo & K8_INTP_C1E_ACTIVE_MASK) {
  510. c1e_detected = 1;
  511. if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
  512. mark_tsc_unstable("TSC halt in AMD C1E");
  513. printk(KERN_INFO "System has AMD C1E enabled\n");
  514. set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
  515. }
  516. }
  517. if (c1e_detected) {
  518. int cpu = smp_processor_id();
  519. if (!cpumask_test_cpu(cpu, c1e_mask)) {
  520. cpumask_set_cpu(cpu, c1e_mask);
  521. /*
  522. * Force broadcast so ACPI can not interfere.
  523. */
  524. clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_FORCE,
  525. &cpu);
  526. printk(KERN_INFO "Switch to broadcast mode on CPU%d\n",
  527. cpu);
  528. }
  529. clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &cpu);
  530. default_idle();
  531. /*
  532. * The switch back from broadcast mode needs to be
  533. * called with interrupts disabled.
  534. */
  535. local_irq_disable();
  536. clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &cpu);
  537. local_irq_enable();
  538. } else
  539. default_idle();
  540. }
  541. void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
  542. {
  543. #ifdef CONFIG_SMP
  544. if (pm_idle == poll_idle && smp_num_siblings > 1) {
  545. printk_once(KERN_WARNING "WARNING: polling idle and HT enabled,"
  546. " performance may degrade.\n");
  547. }
  548. #endif
  549. if (pm_idle)
  550. return;
  551. if (cpu_has(c, X86_FEATURE_MWAIT) && mwait_usable(c)) {
  552. /*
  553. * One CPU supports mwait => All CPUs supports mwait
  554. */
  555. printk(KERN_INFO "using mwait in idle threads.\n");
  556. pm_idle = mwait_idle;
  557. } else if (check_c1e_idle(c)) {
  558. printk(KERN_INFO "using C1E aware idle routine\n");
  559. pm_idle = c1e_idle;
  560. } else
  561. pm_idle = default_idle;
  562. }
  563. void __init init_c1e_mask(void)
  564. {
  565. /* If we're using c1e_idle, we need to allocate c1e_mask. */
  566. if (pm_idle == c1e_idle)
  567. zalloc_cpumask_var(&c1e_mask, GFP_KERNEL);
  568. }
  569. static int __init idle_setup(char *str)
  570. {
  571. if (!str)
  572. return -EINVAL;
  573. if (!strcmp(str, "poll")) {
  574. printk("using polling idle threads.\n");
  575. pm_idle = poll_idle;
  576. } else if (!strcmp(str, "mwait"))
  577. force_mwait = 1;
  578. else if (!strcmp(str, "halt")) {
  579. /*
  580. * When the boot option of idle=halt is added, halt is
  581. * forced to be used for CPU idle. In such case CPU C2/C3
  582. * won't be used again.
  583. * To continue to load the CPU idle driver, don't touch
  584. * the boot_option_idle_override.
  585. */
  586. pm_idle = default_idle;
  587. idle_halt = 1;
  588. return 0;
  589. } else if (!strcmp(str, "nomwait")) {
  590. /*
  591. * If the boot option of "idle=nomwait" is added,
  592. * it means that mwait will be disabled for CPU C2/C3
  593. * states. In such case it won't touch the variable
  594. * of boot_option_idle_override.
  595. */
  596. idle_nomwait = 1;
  597. return 0;
  598. } else
  599. return -1;
  600. boot_option_idle_override = 1;
  601. return 0;
  602. }
  603. early_param("idle", idle_setup);
  604. unsigned long arch_align_stack(unsigned long sp)
  605. {
  606. if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
  607. sp -= get_random_int() % 8192;
  608. return sp & ~0xf;
  609. }
  610. unsigned long arch_randomize_brk(struct mm_struct *mm)
  611. {
  612. unsigned long range_end = mm->brk + 0x02000000;
  613. return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
  614. }