[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210806104835.GE22037@worktop.programming.kicks-ass.net>
Date: Fri, 6 Aug 2021 12:48:35 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Juri Lelli <juri.lelli@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Davidlohr Bueso <dave@...olabs.net>,
Mike Galbraith <efault@....de>
Subject: Re: [patch V3 48/64] locking/ww_mutex: Add RT priority to W/W order
On Thu, Aug 05, 2021 at 05:13:48PM +0200, Thomas Gleixner wrote:
> static inline bool
> +__ww_ctx_less(struct ww_acquire_ctx *a, struct ww_acquire_ctx *b)
> {
> +/*
> + * Can only do the RT prio for WW_RT because task->prio isn't stable due to PI,
> + * so the wait_list ordering will go wobbly. rt_mutex re-queues the waiter and
> + * isn't affected by this.
> + */
> +#ifdef WW_RT
> + /* kernel prio; less is more */
> + int a_prio = a->task->prio;
> + int b_prio = b->task->prio;
> +
> + if (dl_prio(a_prio) || dl_prio(b_prio)) {
Whoever wrote this was an idiot :-) Both should be rt_prio().
> +
> + if (a_prio > b_prio)
> + return true;
> +
> + if (a_prio < b_prio)
> + return false;
> +
> + /* equal static prio */
> +
> + if (dl_prio(a_prio)) {
> + if (dl_time_before(b->task->dl.deadline,
> + a->task->dl.deadline))
> + return true;
> +
> + if (dl_time_before(a->task->dl.deadline,
> + b->task->dl.deadline))
> + return false;
> + }
> +
> + /* equal prio */
> + }
> +#endif
>
> + /* FIFO order tie break -- bigger is younger */
> return (signed long)(a->stamp - b->stamp) > 0;
> }
Powered by blists - more mailing lists