Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sched/core: Move preempt_model_*() helpers from sched.h to preempt.h

Move the declarations and inlined implementations of the preempt_model_*()
helpers to preempt.h so that they can be referenced in spinlock.h without
creating a potential circular dependency between spinlock.h and sched.h.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ankur Arora <ankur.a.arora@oracle.com>
Link: https://lkml.kernel.org/r/20240528003521.979836-2-ankur.a.arora@oracle.com

authored by

Sean Christopherson and committed by
Peter Zijlstra
f0dc887f f90cc919

+41 -41
+41
include/linux/preempt.h
··· 481 481 DEFINE_LOCK_GUARD_0(preempt_notrace, preempt_disable_notrace(), preempt_enable_notrace()) 482 482 DEFINE_LOCK_GUARD_0(migrate, migrate_disable(), migrate_enable()) 483 483 484 + #ifdef CONFIG_PREEMPT_DYNAMIC 485 + 486 + extern bool preempt_model_none(void); 487 + extern bool preempt_model_voluntary(void); 488 + extern bool preempt_model_full(void); 489 + 490 + #else 491 + 492 + static inline bool preempt_model_none(void) 493 + { 494 + return IS_ENABLED(CONFIG_PREEMPT_NONE); 495 + } 496 + static inline bool preempt_model_voluntary(void) 497 + { 498 + return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY); 499 + } 500 + static inline bool preempt_model_full(void) 501 + { 502 + return IS_ENABLED(CONFIG_PREEMPT); 503 + } 504 + 505 + #endif 506 + 507 + static inline bool preempt_model_rt(void) 508 + { 509 + return IS_ENABLED(CONFIG_PREEMPT_RT); 510 + } 511 + 512 + /* 513 + * Does the preemption model allow non-cooperative preemption? 514 + * 515 + * For !CONFIG_PREEMPT_DYNAMIC kernels this is an exact match with 516 + * CONFIG_PREEMPTION; for CONFIG_PREEMPT_DYNAMIC this doesn't work as the 517 + * kernel is *built* with CONFIG_PREEMPTION=y but may run with e.g. the 518 + * PREEMPT_NONE model. 519 + */ 520 + static inline bool preempt_model_preemptible(void) 521 + { 522 + return preempt_model_full() || preempt_model_rt(); 523 + } 524 + 484 525 #endif /* __LINUX_PREEMPT_H */
-41
include/linux/sched.h
··· 2064 2064 __cond_resched_rwlock_write(lock); \ 2065 2065 }) 2066 2066 2067 - #ifdef CONFIG_PREEMPT_DYNAMIC 2068 - 2069 - extern bool preempt_model_none(void); 2070 - extern bool preempt_model_voluntary(void); 2071 - extern bool preempt_model_full(void); 2072 - 2073 - #else 2074 - 2075 - static inline bool preempt_model_none(void) 2076 - { 2077 - return IS_ENABLED(CONFIG_PREEMPT_NONE); 2078 - } 2079 - static inline bool preempt_model_voluntary(void) 2080 - { 2081 - return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY); 2082 - } 2083 - static inline bool preempt_model_full(void) 2084 - { 2085 - return IS_ENABLED(CONFIG_PREEMPT); 2086 - } 2087 - 2088 - #endif 2089 - 2090 - static inline bool preempt_model_rt(void) 2091 - { 2092 - return IS_ENABLED(CONFIG_PREEMPT_RT); 2093 - } 2094 - 2095 - /* 2096 - * Does the preemption model allow non-cooperative preemption? 2097 - * 2098 - * For !CONFIG_PREEMPT_DYNAMIC kernels this is an exact match with 2099 - * CONFIG_PREEMPTION; for CONFIG_PREEMPT_DYNAMIC this doesn't work as the 2100 - * kernel is *built* with CONFIG_PREEMPTION=y but may run with e.g. the 2101 - * PREEMPT_NONE model. 2102 - */ 2103 - static inline bool preempt_model_preemptible(void) 2104 - { 2105 - return preempt_model_full() || preempt_model_rt(); 2106 - } 2107 - 2108 2067 static __always_inline bool need_resched(void) 2109 2068 { 2110 2069 return unlikely(tif_need_resched());