From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753683AbdLFBXs (ORCPT ); Tue, 5 Dec 2017 20:23:48 -0500 Received: from perses.usurf.usu.edu ([129.123.197.145]:49723 "EHLO Perses.usurf.usu.edu" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1753336AbdLFBXq (ORCPT ); Tue, 5 Dec 2017 20:23:46 -0500 From: Jonathan Haws To: "linux-kernel@vger.kernel.org" Subject: Re: [RFC][PATCHv2] Fixing POSIX wait queue to insert in task priority order for real-time, including normal tasks Thread-Topic: [RFC][PATCHv2] Fixing POSIX wait queue to insert in task priority order for real-time, including normal tasks Thread-Index: AQHTbi+40/g0mgJo2UizvUhwx1IanaM1+q6A Date: Wed, 6 Dec 2017 01:23:44 +0000 Message-ID: <1512523423.9445.7.camel@sdl.usu.edu> References: <1512522932-10318-1-git-send-email-jhaws@sdl.usu.edu> In-Reply-To: <1512522932-10318-1-git-send-email-jhaws@sdl.usu.edu> Reply-To: Jonathan Haws Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Evolution 3.18.5.2-0ubuntu3.2 x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [172.31.22.119] Content-Type: text/plain; charset="utf-8" Content-ID: MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id vB61NsWf028488 Sorry for the initial email - forgot the signed-off-by in my commit.  Still new to this... I'd like feedback from the community on this patch.  I've tested this against my applications that were exhibiting problematic behavior when tasks would wake up in FIFO order instead of priority order when trying to write to a POSIX message queue.  Without the patch, multiple RT tasks waiting to write to a queue wake up in FIFO order (assuming nice value untouched); with the patch they wake up in priority order (based on RT priority setting via sched_setparam. Is this the correct way to remedy this issue?  Using prio here pulls in the current priority of the task, including boosts from priority inheritance.  In that case, would normal_prio be more appropriate? Anyway, if this patch is acceptable then I'd also love some feedback to know what steps need to be taken from here to push it along. Thanks! Jon > Signed-off-by: Jonathan Haws > --- >  ipc/mqueue.c | 2 +- >  1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/ipc/mqueue.c b/ipc/mqueue.c > index 9649ecd..cb96db9 100644 > --- a/ipc/mqueue.c > +++ b/ipc/mqueue.c > @@ -546,7 +546,7 @@ static void wq_add(struct mqueue_inode_info > *info, int sr, >   ewp->task = current; >   >   list_for_each_entry(walk, &info->e_wait_q[sr].list, list) { > - if (walk->task->static_prio <= current->static_prio) > { > + if (walk->task->prio <= current->prio) { >   list_add_tail(&ewp->list, &walk->list); >   return; >   }