From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751832AbdJDPtO (ORCPT ); Wed, 4 Oct 2017 11:49:14 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:58228 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbdJDPtK (ORCPT ); Wed, 4 Oct 2017 11:49:10 -0400 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Jens Axboe , tglx@linutronix.de, Sebastian Andrzej Siewior Subject: [PATCH 1/2] sched/rt: Add a helper to test for a RT task Date: Wed, 4 Oct 2017 17:49:00 +0200 Message-Id: <20171004154901.26904-1-bigeasy@linutronix.de> X-Mailer: git-send-email 2.14.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This helper returns true if a task has elevated priority which is true for RT tasks (SCHED_RR and SCHED_FIFO) and also for SCHED_DEADLINE. A task which runs at RT priority due to PI-boosting is not considered as one with elevated priority. Signed-off-by: Sebastian Andrzej Siewior --- include/linux/sched/rt.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h index f93329aba31a..30a86b8178f8 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h @@ -17,6 +17,17 @@ static inline int rt_task(struct task_struct *p) return rt_prio(p->prio); } =20 +static inline bool task_is_elevated(struct task_struct *tsk) +{ + int policy =3D tsk->policy; + + if (policy =3D=3D SCHED_FIFO || policy =3D=3D SCHED_RR) + return true; + if (policy =3D=3D SCHED_DEADLINE) + return true; + return false; +} + #ifdef CONFIG_RT_MUTEXES /* * Must hold either p->pi_lock or task_rq(p)->lock. --=20 2.14.2