Messages in this thread | | | Date | Wed, 12 May 2021 11:07:54 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH v2 04/19] sched: Prepare for Core-wide rq->lock |
| |
On Sat, May 08, 2021 at 04:07:35PM +0800, Aubrey Li wrote: > > +#ifdef CONFIG_SMP > > +/* > > + * double_rq_lock - safely lock two runqueues > > + */ > > +void double_rq_lock(struct rq *rq1, struct rq *rq2) > > Do we need the static lock checking here? > __acquires(rq1->lock) > __acquires(rq2->lock) > > > +{ > > + lockdep_assert_irqs_disabled(); > > + > > + if (rq_order_less(rq2, rq1)) > > + swap(rq1, rq2); > > + > > + raw_spin_rq_lock(rq1); > > + if (rq_lockp(rq1) == rq_lockp(rq2)) { > > And here? > __acquire(rq2->lock); > > > + return; > } > > + > > + raw_spin_rq_lock_nested(rq2, SINGLE_DEPTH_NESTING); > > +} > > +#endif
I'd as soon rip out all that sparse annotation crud; I don't think I've ever had any benefit from it.
> > @@ -2368,11 +2354,11 @@ static inline void double_rq_unlock(stru > > __releases(rq1->lock) > > __releases(rq2->lock) > > { > > - raw_spin_rq_unlock(rq1); > > if (rq_lockp(rq1) != rq_lockp(rq2)) > > raw_spin_rq_unlock(rq2); > > else > > __release(rq2->lock); > > + raw_spin_rq_unlock(rq1); > > This change seems not necessary, as the softlockup root cause is not > the misorder lock release.
No, it really is needed; rq_lockp() is not stable if we don't hold a lock.
| |