[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200428163125.GC16910@hirez.programming.kicks-ass.net>
Date: Tue, 28 Apr 2020 18:31:25 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Suren Baghdasaryan <surenb@...gle.com>
Cc: mingo@...hat.com, hannes@...xchg.org, will@...nel.org,
akpm@...ux-foundation.org, tglx@...utronix.de,
ben.dooks@...ethink.co.uk, cl@...k-chips.com, ke.wang@...soc.com,
shakeelb@...gle.com, linux-kernel@...r.kernel.org,
kernel-team@...roid.com
Subject: Re: [PATCH 1/1] kthread: break dependency between worker->lock and
task_struct->pi_lock
On Mon, Apr 27, 2020 at 11:43:58AM -0700, Suren Baghdasaryan wrote:
> A number of kthread-related functions indirectly take task_struct->pi_lock
> while holding worker->lock in the call chain like this:
> spin_lock(&worker->lock)
> kthread_insert_work
> wake_up_process
> try_to_wake_up
> raw_spin_lock_irqsave(&p->pi_lock, flags)
>
> This lock dependency exists whenever kthread_insert_work is called either
> directly or indirectly via __kthread_queue_delayed_work in the following
> functions:
> kthread_queue_work
> kthread_delayed_work_timer_fn
> kthread_queue_delayed_work
> kthread_flush_work
> kthread_mod_delayed_work
>
> This creates possibilities for circular dependencies like the one reported
> at: https://lkml.org/lkml/2020/4/24/954
Please, do not use lkml.org links.
Also, ideally, we'd pull that kthread_queue_delayed_work() out from
under rq->lock.
In fact, looking at it, WTH is the delayed branch of
kthread_queue_delayed_work() under that lock? That whole
delayed_work_list thing smells like bong-hits.
Powered by blists - more mailing lists