Re: [RFC][PATCHv2] Fixing POSIX wait queue to insert in task priority order for real-time, including normal tasks

From: Jonathan Haws
Date: Tue Dec 05 2017 - 20:23:52 EST


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 <jhaws@xxxxxxxxxxx>
> ---
> Â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;
> Â }