LCOV - code coverage report
Current view: top level - include/linux/sched - rt.h (source / functions) Hit Total Coverage
Test: gcov_data_raspi2_real_modules_combined.info Lines: 4 4 100.0 %
Date: 2020-09-30 20:25:40 Functions: 0 0 -
Branches: 8 12 66.7 %

           Branch data     Line data    Source code
       1                 :            : /* SPDX-License-Identifier: GPL-2.0 */
       2                 :            : #ifndef _LINUX_SCHED_RT_H
       3                 :            : #define _LINUX_SCHED_RT_H
       4                 :            : 
       5                 :            : #include <linux/sched.h>
       6                 :            : 
       7                 :            : struct task_struct;
       8                 :            : 
       9                 :            : static inline int rt_prio(int prio)
      10                 :            : {
      11   [ +  +  +  +  :    1688391 :         if (unlikely(prio < MAX_RT_PRIO))
          +  -  #  #  -  
                +  +  + ]
      12                 :            :                 return 1;
      13                 :            :         return 0;
      14                 :            : }
      15                 :            : 
      16                 :            : static inline int rt_task(struct task_struct *p)
      17                 :            : {
      18                 :    1462092 :         return rt_prio(p->prio);
      19                 :            : }
      20                 :            : 
      21                 :            : static inline bool task_is_realtime(struct task_struct *tsk)
      22                 :            : {
      23                 :            :         int policy = tsk->policy;
      24                 :            : 
      25                 :            :         if (policy == SCHED_FIFO || policy == SCHED_RR)
      26                 :            :                 return true;
      27                 :            :         if (policy == SCHED_DEADLINE)
      28                 :            :                 return true;
      29                 :            :         return false;
      30                 :            : }
      31                 :            : 
      32                 :            : #ifdef CONFIG_RT_MUTEXES
      33                 :            : /*
      34                 :            :  * Must hold either p->pi_lock or task_rq(p)->lock.
      35                 :            :  */
      36                 :            : static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p)
      37                 :            : {
      38                 :       2070 :         return p->pi_top_task;
      39                 :            : }
      40                 :            : extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task);
      41                 :            : extern void rt_mutex_adjust_pi(struct task_struct *p);
      42                 :            : static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
      43                 :            : {
      44                 :    6736254 :         return tsk->pi_blocked_on != NULL;
      45                 :            : }
      46                 :            : #else
      47                 :            : static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
      48                 :            : {
      49                 :            :         return NULL;
      50                 :            : }
      51                 :            : # define rt_mutex_adjust_pi(p)          do { } while (0)
      52                 :            : static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
      53                 :            : {
      54                 :            :         return false;
      55                 :            : }
      56                 :            : #endif
      57                 :            : 
      58                 :            : extern void normalize_rt_tasks(void);
      59                 :            : 
      60                 :            : 
      61                 :            : /*
      62                 :            :  * default timeslice is 100 msecs (used only for SCHED_RR tasks).
      63                 :            :  * Timeslices get refilled after they expire.
      64                 :            :  */
      65                 :            : #define RR_TIMESLICE            (100 * HZ / 1000)
      66                 :            : 
      67                 :            : #endif /* _LINUX_SCHED_RT_H */

Generated by: LCOV version 1.14