Re: [PATCH 6/7] psi: pressure stall information for CPU, memory, and IO

From: Johannes Weiner
Date: Thu May 10 2018 - 10:22:56 EST


On Wed, May 09, 2018 at 12:21:00PM +0200, Peter Zijlstra wrote:
> On Mon, May 07, 2018 at 05:01:34PM -0400, Johannes Weiner wrote:
> > + local_irq_disable();
> > + rq = this_rq();
> > + raw_spin_lock(&rq->lock);
> > + rq_pin_lock(rq, &rf);
>
> Given that churn in sched.h, you seen rq_lock() and friends.
>
> Either write this like:
>
> local_irq_disable();
> rq = this_rq();
> rq_lock(rq, &rf);
>
> Or instroduce "rq = this_rq_lock_irq()", which we could also use in
> do_sched_yield().

Sounds good, I'll add that.

> > + update_rq_clock(rq);
> > +
> > + current->flags |= PF_MEMSTALL;
> > + psi_task_change(current, rq_clock(rq), 0, TSK_MEMSTALL);
> > +
> > + rq_unpin_lock(rq, &rf);
> > + raw_spin_unlock(&rq->lock);
> > + local_irq_enable();
>
> That's called rq_unlock_irq().

I'll use that. This code was first written against a kernel that
didn't have 8a8c69c32778 ("sched/core: Add rq->lock wrappers.") yet ;)