Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1513624

Re: [RFC v3 2/6] Improve the tracking of active utilisation

From luca abeni <luca.abeni@unitn.it>
Newsgroups linux.kernel
Subject Re: [RFC v3 2/6] Improve the tracking of active utilisation
Date 2016-11-02 03:40 +0100
Message-ID <syTD3-be-5@gated-at.bofh.it> (permalink)
References <svO6S-ak-7@gated-at.bofh.it> <svO6S-ak-31@gated-at.bofh.it> <syKq6-2Hy-33@gated-at.bofh.it> <syP6p-5GB-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, 1 Nov 2016 22:46:33 +0100
luca abeni <luca.abeni@unitn.it> wrote:
[...]
> > > @@ -1074,6 +1161,14 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags)
> > >  	}
> > >  	rcu_read_unlock();
> > >  
> > > +	rq = task_rq(p);
> > > +	raw_spin_lock(&rq->lock);
> > > +	if (hrtimer_active(&p->dl.inactive_timer)) {
> > > +		sub_running_bw(&p->dl, &rq->dl);
> > > +		hrtimer_try_to_cancel(&p->dl.inactive_timer);    
> > 
> > Can't we subtract twice if it happens that after we grabbed rq_lock the timer
> > fired, so it's now waiting for that lock and it goes ahead and sub_running_bw
> > again after we release the lock?  
> Uhm... I somehow convinced myself that this could not happen, but I do not
> remember the details, sorry :(
I think I remember the answer now: pi_lock is acquired before invoking select_task_rq
and is released after invoking enqueue_task... So, if there is a pending inactive
timer, its handler will be executed after the task is enqueued... It will see the task
as RUNNING, and will not decrease the active utilisation.

Does this make sense?



				Luca

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [RFC v3 2/6] Improve the tracking of active utilisation Juri Lelli <juri.lelli@arm.com> - 2016-11-01 17:50 +0100
  Re: [RFC v3 2/6] Improve the tracking of active utilisation luca abeni <luca.abeni@unitn.it> - 2016-11-01 22:50 +0100
    Re: [RFC v3 2/6] Improve the tracking of active utilisation luca abeni <luca.abeni@unitn.it> - 2016-11-02 03:40 +0100
      Re: [RFC v3 2/6] Improve the tracking of active utilisation Juri Lelli <juri.lelli@arm.com> - 2016-11-10 11:10 +0100
        Re: [RFC v3 2/6] Improve the tracking of active utilisation Juri Lelli <juri.lelli@arm.com> - 2016-11-10 13:00 +0100
          Re: [RFC v3 2/6] Improve the tracking of active utilisation luca abeni <luca.abeni@unitn.it> - 2016-11-10 13:20 +0100
            Re: [RFC v3 2/6] Improve the tracking of active utilisation Juri Lelli <juri.lelli@arm.com> - 2016-11-10 13:40 +0100
              Re: [RFC v3 2/6] Improve the tracking of active utilisation luca abeni <luca.abeni@unitn.it> - 2016-11-10 13:50 +0100

csiph-web