FROMLIST: freezer: Add frozen_or_skipped() helper function
Occasionally it is necessary to see if a task is either frozen or sleeping in the PF_FREEZER_SKIP state. In preparation for adding additional users of this check, introduce a frozen_or_skipped() helper function and convert the hung task detector over to using it. Signed-off-by: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/linux-arch/20210525151432.16875-16-will@kernel.org/ Bug: 186372082 Signed-off-by: Will Deacon <willdeacon@google.com> Change-Id: I138ffe2fae5a2da96df6f30d50d3a8a0dc61724c
This commit is contained in:
parent
7b04b63e1c
commit
3128f5e30c
@ -27,6 +27,11 @@ static inline bool frozen(struct task_struct *p)
|
||||
return p->flags & PF_FROZEN;
|
||||
}
|
||||
|
||||
static inline bool frozen_or_skipped(struct task_struct *p)
|
||||
{
|
||||
return p->flags & (PF_FROZEN | PF_FREEZER_SKIP);
|
||||
}
|
||||
|
||||
extern bool freezing_slow_path(struct task_struct *p);
|
||||
|
||||
/*
|
||||
@ -270,6 +275,7 @@ static inline int freezable_schedule_hrtimeout_range(ktime_t *expires,
|
||||
|
||||
#else /* !CONFIG_FREEZER */
|
||||
static inline bool frozen(struct task_struct *p) { return false; }
|
||||
static inline bool frozen_or_skipped(struct task_struct *p) { return false; }
|
||||
static inline bool freezing(struct task_struct *p) { return false; }
|
||||
static inline void __thaw_task(struct task_struct *t) {}
|
||||
|
||||
|
@ -94,8 +94,8 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
|
||||
* Ensure the task is not frozen.
|
||||
* Also, skip vfork and any other user process that freezer should skip.
|
||||
*/
|
||||
if (unlikely(t->flags & (PF_FROZEN | PF_FREEZER_SKIP)))
|
||||
return;
|
||||
if (unlikely(frozen_or_skipped(t)))
|
||||
return;
|
||||
|
||||
/*
|
||||
* When a freshly created task is scheduled once, changes its state to
|
||||
|
Loading…
Reference in New Issue
Block a user