~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/sched/idle.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/sched/idle.h (Version linux-6.12-rc7) and /include/linux/sched/idle.h (Version linux-6.1.116)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 #ifndef _LINUX_SCHED_IDLE_H                         2 #ifndef _LINUX_SCHED_IDLE_H
  3 #define _LINUX_SCHED_IDLE_H                         3 #define _LINUX_SCHED_IDLE_H
  4                                                     4 
  5 #include <linux/sched.h>                            5 #include <linux/sched.h>
  6                                                     6 
  7 enum cpu_idle_type {                                7 enum cpu_idle_type {
  8         __CPU_NOT_IDLE = 0,                    << 
  9         CPU_IDLE,                                   8         CPU_IDLE,
                                                   >>   9         CPU_NOT_IDLE,
 10         CPU_NEWLY_IDLE,                            10         CPU_NEWLY_IDLE,
 11         CPU_MAX_IDLE_TYPES                         11         CPU_MAX_IDLE_TYPES
 12 };                                                 12 };
 13                                                    13 
 14 #ifdef CONFIG_SMP                                  14 #ifdef CONFIG_SMP
 15 extern void wake_up_if_idle(int cpu);              15 extern void wake_up_if_idle(int cpu);
 16 #else                                              16 #else
 17 static inline void wake_up_if_idle(int cpu) {      17 static inline void wake_up_if_idle(int cpu) { }
 18 #endif                                             18 #endif
 19                                                    19 
 20 /*                                                 20 /*
 21  * Idle thread specific functions to determine     21  * Idle thread specific functions to determine the need_resched
 22  * polling state.                                  22  * polling state.
 23  */                                                23  */
 24 #ifdef TIF_POLLING_NRFLAG                          24 #ifdef TIF_POLLING_NRFLAG
 25                                                    25 
 26 #ifdef _ASM_GENERIC_BITOPS_INSTRUMENTED_ATOMIC !!  26 static inline void __current_set_polling(void)
 27                                                << 
 28 static __always_inline void __current_set_poll << 
 29 {                                              << 
 30         arch_set_bit(TIF_POLLING_NRFLAG,       << 
 31                      (unsigned long *)(&curren << 
 32 }                                              << 
 33                                                << 
 34 static __always_inline void __current_clr_poll << 
 35 {                                              << 
 36         arch_clear_bit(TIF_POLLING_NRFLAG,     << 
 37                        (unsigned long *)(&curr << 
 38 }                                              << 
 39                                                << 
 40 #else                                          << 
 41                                                << 
 42 static __always_inline void __current_set_poll << 
 43 {                                                  27 {
 44         set_bit(TIF_POLLING_NRFLAG,            !!  28         set_thread_flag(TIF_POLLING_NRFLAG);
 45                 (unsigned long *)(&current_thr << 
 46 }                                                  29 }
 47                                                    30 
 48 static __always_inline void __current_clr_poll !!  31 static inline bool __must_check current_set_polling_and_test(void)
 49 {                                              << 
 50         clear_bit(TIF_POLLING_NRFLAG,          << 
 51                   (unsigned long *)(&current_t << 
 52 }                                              << 
 53                                                << 
 54 #endif /* _ASM_GENERIC_BITOPS_INSTRUMENTED_ATO << 
 55                                                << 
 56 static __always_inline bool __must_check curre << 
 57 {                                                  32 {
 58         __current_set_polling();                   33         __current_set_polling();
 59                                                    34 
 60         /*                                         35         /*
 61          * Polling state must be visible befor     36          * Polling state must be visible before we test NEED_RESCHED,
 62          * paired by resched_curr()                37          * paired by resched_curr()
 63          */                                        38          */
 64         smp_mb__after_atomic();                    39         smp_mb__after_atomic();
 65                                                    40 
 66         return unlikely(tif_need_resched());       41         return unlikely(tif_need_resched());
 67 }                                                  42 }
 68                                                    43 
 69 static __always_inline bool __must_check curre !!  44 static inline void __current_clr_polling(void)
                                                   >>  45 {
                                                   >>  46         clear_thread_flag(TIF_POLLING_NRFLAG);
                                                   >>  47 }
                                                   >>  48 
                                                   >>  49 static inline bool __must_check current_clr_polling_and_test(void)
 70 {                                                  50 {
 71         __current_clr_polling();                   51         __current_clr_polling();
 72                                                    52 
 73         /*                                         53         /*
 74          * Polling state must be visible befor     54          * Polling state must be visible before we test NEED_RESCHED,
 75          * paired by resched_curr()                55          * paired by resched_curr()
 76          */                                        56          */
 77         smp_mb__after_atomic();                    57         smp_mb__after_atomic();
 78                                                    58 
 79         return unlikely(tif_need_resched());       59         return unlikely(tif_need_resched());
 80 }                                                  60 }
 81                                                    61 
 82 #else                                              62 #else
 83 static inline void __current_set_polling(void)     63 static inline void __current_set_polling(void) { }
 84 static inline void __current_clr_polling(void)     64 static inline void __current_clr_polling(void) { }
 85                                                    65 
 86 static inline bool __must_check current_set_po     66 static inline bool __must_check current_set_polling_and_test(void)
 87 {                                                  67 {
 88         return unlikely(tif_need_resched());       68         return unlikely(tif_need_resched());
 89 }                                                  69 }
 90 static inline bool __must_check current_clr_po     70 static inline bool __must_check current_clr_polling_and_test(void)
 91 {                                                  71 {
 92         return unlikely(tif_need_resched());       72         return unlikely(tif_need_resched());
 93 }                                                  73 }
 94 #endif                                             74 #endif
 95                                                    75 
 96 static __always_inline void current_clr_pollin !!  76 static inline void current_clr_polling(void)
 97 {                                                  77 {
 98         __current_clr_polling();                   78         __current_clr_polling();
 99                                                    79 
100         /*                                         80         /*
101          * Ensure we check TIF_NEED_RESCHED af     81          * Ensure we check TIF_NEED_RESCHED after we clear the polling bit.
102          * Once the bit is cleared, we'll get      82          * Once the bit is cleared, we'll get IPIs with every new
103          * TIF_NEED_RESCHED and the IPI handle     83          * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also
104          * fold.                                   84          * fold.
105          */                                        85          */
106         smp_mb(); /* paired with resched_curr(     86         smp_mb(); /* paired with resched_curr() */
107                                                    87 
108         preempt_fold_need_resched();               88         preempt_fold_need_resched();
109 }                                                  89 }
110                                                    90 
111 #endif /* _LINUX_SCHED_IDLE_H */                   91 #endif /* _LINUX_SCHED_IDLE_H */
112                                                    92 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php