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

TOMOYO Linux Cross Reference
Linux/arch/arm64/include/asm/preempt.h

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/arm64/include/asm/preempt.h (Architecture i386) and /arch/sparc64/include/asm-sparc64/preempt.h (Architecture sparc64)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 
  2 #ifndef __ASM_PREEMPT_H                           
  3 #define __ASM_PREEMPT_H                           
  4                                                   
  5 #include <linux/jump_label.h>                     
  6 #include <linux/thread_info.h>                    
  7                                                   
  8 #define PREEMPT_NEED_RESCHED    BIT(32)           
  9 #define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED)    
 10                                                   
 11 static inline int preempt_count(void)             
 12 {                                                 
 13         return READ_ONCE(current_thread_info()    
 14 }                                                 
 15                                                   
 16 static inline void preempt_count_set(u64 pc)      
 17 {                                                 
 18         /* Preserve existing value of PREEMPT_    
 19         WRITE_ONCE(current_thread_info()->pree    
 20 }                                                 
 21                                                   
 22 #define init_task_preempt_count(p) do { \         
 23         task_thread_info(p)->preempt_count = F    
 24 } while (0)                                       
 25                                                   
 26 #define init_idle_preempt_count(p, cpu) do { \    
 27         task_thread_info(p)->preempt_count = P    
 28 } while (0)                                       
 29                                                   
 30 static inline void set_preempt_need_resched(vo    
 31 {                                                 
 32         current_thread_info()->preempt.need_re    
 33 }                                                 
 34                                                   
 35 static inline void clear_preempt_need_resched(    
 36 {                                                 
 37         current_thread_info()->preempt.need_re    
 38 }                                                 
 39                                                   
 40 static inline bool test_preempt_need_resched(v    
 41 {                                                 
 42         return !current_thread_info()->preempt    
 43 }                                                 
 44                                                   
 45 static inline void __preempt_count_add(int val    
 46 {                                                 
 47         u32 pc = READ_ONCE(current_thread_info    
 48         pc += val;                                
 49         WRITE_ONCE(current_thread_info()->pree    
 50 }                                                 
 51                                                   
 52 static inline void __preempt_count_sub(int val    
 53 {                                                 
 54         u32 pc = READ_ONCE(current_thread_info    
 55         pc -= val;                                
 56         WRITE_ONCE(current_thread_info()->pree    
 57 }                                                 
 58                                                   
 59 static inline bool __preempt_count_dec_and_tes    
 60 {                                                 
 61         struct thread_info *ti = current_threa    
 62         u64 pc = READ_ONCE(ti->preempt_count);    
 63                                                   
 64         /* Update only the count field, leavin    
 65         WRITE_ONCE(ti->preempt.count, --pc);      
 66                                                   
 67         /*                                        
 68          * If we wrote back all zeroes, then w    
 69          * need of a reschedule. Otherwise, we    
 70          * preempt_count in case the need_resc    
 71          * interrupt occurring between the non    
 72          * pair.                                  
 73          */                                       
 74         return !pc || !READ_ONCE(ti->preempt_c    
 75 }                                                 
 76                                                   
 77 static inline bool should_resched(int preempt_    
 78 {                                                 
 79         u64 pc = READ_ONCE(current_thread_info    
 80         return pc == preempt_offset;              
 81 }                                                 
 82                                                   
 83 #ifdef CONFIG_PREEMPTION                          
 84                                                   
 85 void preempt_schedule(void);                      
 86 void preempt_schedule_notrace(void);              
 87                                                   
 88 #ifdef CONFIG_PREEMPT_DYNAMIC                     
 89                                                   
 90 DECLARE_STATIC_KEY_TRUE(sk_dynamic_irqentry_ex    
 91 void dynamic_preempt_schedule(void);              
 92 #define __preempt_schedule()            dynami    
 93 void dynamic_preempt_schedule_notrace(void);      
 94 #define __preempt_schedule_notrace()    dynami    
 95                                                   
 96 #else /* CONFIG_PREEMPT_DYNAMIC */                
 97                                                   
 98 #define __preempt_schedule()            preemp    
 99 #define __preempt_schedule_notrace()    preemp    
100                                                   
101 #endif /* CONFIG_PREEMPT_DYNAMIC */               
102 #endif /* CONFIG_PREEMPTION */                    
103                                                   
104 #endif /* __ASM_PREEMPT_H */                      
105                                                   

~ [ 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