[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8fN2VQQTGUZ3ykw@gmail.com>
Date: Wed, 18 Jan 2023 11:45:45 +0100
From: Ingo Molnar <mingo@...nel.org>
To: Mel Gorman <mgorman@...hsingularity.net>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Davidlohr Bueso <dave@...olabs.net>,
Linux-RT <linux-rt-users@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] locking/rwbase: Prevent indefinite writer starvation
* Mel Gorman <mgorman@...hsingularity.net> wrote:
> > > dio_truncate is not a realtime application but indefinite writer
> > > starvation
> >
> > If so then the PI boosting would not work if we would have it ;)
> >
>
> True, but it's still undesirable for a basic functional test using normal
> tasks with no prioritisation to stall forever.
Agreed.
> +/*
> + * Allow reader bias with a pending writer for a minimum of 4ms or 1 tick.
> + * This matches RWSEM_WAIT_TIMEOUT for the generic RWSEM implementation.
> + * The granularity is not exact as the lowest bit in rwbase_rt->waiter_timeout
> + * is used to detect recent DL / RT tasks taking a read lock.
> + */
> +#define RWBASE_RT_WAIT_TIMEOUT DIV_ROUND_UP(HZ, 250)
> +
> +static void __sched update_dlrt_reader(struct rwbase_rt *rwb)
> +{
> + /* No update required if DL / RT tasks already identified. */
> + if (rwb->waiter_timeout & 1)
> + return;
> +
> + /*
> + * Record a DL / RT task acquiring the lock for read. This may result
> + * in indefinite writer starvation but DL / RT tasks should avoid such
> + * behaviour.
> + */
> + if (rt_task(current)) {
> + struct rt_mutex_base *rtm = &rwb->rtmutex;
> + unsigned long flags;
> +
> + raw_spin_lock_irqsave(&rtm->wait_lock, flags);
> + rwb->waiter_timeout |= 1;
> + raw_spin_unlock_irqrestore(&rtm->wait_lock, flags);
> + }
> +}
So I'm not sure this should be dependent on the task being an RT task.
Starvation scenarios are bad no matter what scheduling policy is used.
Should be unconditional - and all workloads should live with the new
behavior.
Thanks,
Ingo
Powered by blists - more mailing lists