core.c (ceeadb83aea28372e54857bf88ab7e17af48ab7b) core.c (c597bfddc9e9e8a63817252b67c3ca0e544ace26)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kernel/sched/core.c
4 *
5 * Core kernel scheduler code and related syscalls
6 *
7 * Copyright (C) 1991-2002 Linus Torvalds
8 */

--- 6506 unchanged lines hidden (view full) ---

6515 * cond_resched <- RET0
6516 * might_resched <- RET0
6517 * preempt_schedule <- preempt_schedule
6518 * preempt_schedule_notrace <- preempt_schedule_notrace
6519 * irqentry_exit_cond_resched <- irqentry_exit_cond_resched
6520 */
6521
6522enum {
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * kernel/sched/core.c
4 *
5 * Core kernel scheduler code and related syscalls
6 *
7 * Copyright (C) 1991-2002 Linus Torvalds
8 */

--- 6506 unchanged lines hidden (view full) ---

6515 * cond_resched <- RET0
6516 * might_resched <- RET0
6517 * preempt_schedule <- preempt_schedule
6518 * preempt_schedule_notrace <- preempt_schedule_notrace
6519 * irqentry_exit_cond_resched <- irqentry_exit_cond_resched
6520 */
6521
6522enum {
6523 preempt_dynamic_none = 0,
6523 preempt_dynamic_undefined = -1,
6524 preempt_dynamic_none,
6524 preempt_dynamic_voluntary,
6525 preempt_dynamic_full,
6526};
6527
6525 preempt_dynamic_voluntary,
6526 preempt_dynamic_full,
6527};
6528
6528int preempt_dynamic_mode = preempt_dynamic_full;
6529int preempt_dynamic_mode = preempt_dynamic_undefined;
6529
6530int sched_dynamic_mode(const char *str)
6531{
6532 if (!strcmp(str, "none"))
6533 return preempt_dynamic_none;
6534
6535 if (!strcmp(str, "voluntary"))
6536 return preempt_dynamic_voluntary;

--- 56 unchanged lines hidden (view full) ---

6593 return 1;
6594 }
6595
6596 sched_dynamic_update(mode);
6597 return 0;
6598}
6599__setup("preempt=", setup_preempt_mode);
6600
6530
6531int sched_dynamic_mode(const char *str)
6532{
6533 if (!strcmp(str, "none"))
6534 return preempt_dynamic_none;
6535
6536 if (!strcmp(str, "voluntary"))
6537 return preempt_dynamic_voluntary;

--- 56 unchanged lines hidden (view full) ---

6594 return 1;
6595 }
6596
6597 sched_dynamic_update(mode);
6598 return 0;
6599}
6600__setup("preempt=", setup_preempt_mode);
6601
6601#endif /* CONFIG_PREEMPT_DYNAMIC */
6602static void __init preempt_dynamic_init(void)
6603{
6604 if (preempt_dynamic_mode == preempt_dynamic_undefined) {
6605 if (IS_ENABLED(CONFIG_PREEMPT_NONE_BEHAVIOUR)) {
6606 sched_dynamic_update(preempt_dynamic_none);
6607 } else if (IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY_BEHAVIOUR)) {
6608 sched_dynamic_update(preempt_dynamic_voluntary);
6609 } else {
6610 /* Default static call setting, nothing to do */
6611 WARN_ON_ONCE(!IS_ENABLED(CONFIG_PREEMPT_BEHAVIOUR));
6612 preempt_dynamic_mode = preempt_dynamic_full;
6613 pr_info("Dynamic Preempt: full\n");
6614 }
6615 }
6616}
6602
6617
6618#else /* !CONFIG_PREEMPT_DYNAMIC */
6619
6620static inline void preempt_dynamic_init(void) { }
6621
6622#endif /* #ifdef CONFIG_PREEMPT_DYNAMIC */
6623
6603/*
6604 * This is the entry point to schedule() from kernel preemption
6605 * off of irq context.
6606 * Note, that this is called and return with irqs disabled. This will
6607 * protect us against recursive calling from irq.
6608 */
6609asmlinkage __visible void __sched preempt_schedule_irq(void)
6610{

--- 2782 unchanged lines hidden (view full) ---

9393 balance_push_set(smp_processor_id(), false);
9394#endif
9395 init_sched_fair_class();
9396
9397 psi_init();
9398
9399 init_uclamp();
9400
6624/*
6625 * This is the entry point to schedule() from kernel preemption
6626 * off of irq context.
6627 * Note, that this is called and return with irqs disabled. This will
6628 * protect us against recursive calling from irq.
6629 */
6630asmlinkage __visible void __sched preempt_schedule_irq(void)
6631{

--- 2782 unchanged lines hidden (view full) ---

9414 balance_push_set(smp_processor_id(), false);
9415#endif
9416 init_sched_fair_class();
9417
9418 psi_init();
9419
9420 init_uclamp();
9421
9422 preempt_dynamic_init();
9423
9401 scheduler_running = 1;
9402}
9403
9404#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
9405static inline int preempt_count_equals(int preempt_offset)
9406{
9407 int nested = preempt_count() + rcu_preempt_depth();
9408

--- 1380 unchanged lines hidden ---
9424 scheduler_running = 1;
9425}
9426
9427#ifdef CONFIG_DEBUG_ATOMIC_SLEEP
9428static inline int preempt_count_equals(int preempt_offset)
9429{
9430 int nested = preempt_count() + rcu_preempt_depth();
9431

--- 1380 unchanged lines hidden ---