[Skiboot] [PATCH 24/34] cpu: Add cpu_check_jobs()
Benjamin Herrenschmidt
benh at kernel.crashing.org
Sun Jul 24 09:27:18 AEST 2016
Wrapper around list_empty_nocheck() to see if there's any
job pending on a given CPU
Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
core/cpu.c | 8 ++++++--
include/cpu.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/core/cpu.c b/core/cpu.c
index d3a858a..6dd841c 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -160,6 +160,11 @@ void cpu_wait_job(struct cpu_job *job, bool free_it)
free(job);
}
+bool cpu_check_jobs(struct cpu_thread *cpu)
+{
+ return !list_empty_nocheck(&cpu->job_queue);
+}
+
void cpu_process_jobs(void)
{
struct cpu_thread *cpu = this_cpu();
@@ -168,8 +173,7 @@ void cpu_process_jobs(void)
void *data;
sync();
- if (list_empty_nocheck(&cpu->job_queue) &&
- list_empty_nocheck(&global_job_queue))
+ if (!cpu_check_jobs(cpu))
return;
lock(&cpu->job_lock);
diff --git a/include/cpu.h b/include/cpu.h
index fcd886b..1188168 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -242,6 +242,8 @@ extern void cpu_wait_job(struct cpu_job *job, bool free_it);
extern void cpu_process_jobs(void);
/* Fallback to running jobs synchronously for global jobs */
extern void cpu_process_local_jobs(void);
+/* Check if there's any job pending */
+bool cpu_check_jobs(struct cpu_thread *cpu);
static inline void cpu_give_self_os(void)
{
--
2.7.4
More information about the Skiboot
mailing list