[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20121004094349.GA2163@thinkpad>
Date: Thu, 4 Oct 2012 11:43:49 +0200
From: Andrea Righi <andrea@...terlinux.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Paul Menage <paul@...lmenage.org>, Ingo Molnar <mingo@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH RFC 1/3] sched: introduce distinct per-cpu load average
On Thu, Oct 04, 2012 at 10:59:46AM +0200, Peter Zijlstra wrote:
> On Thu, 2012-10-04 at 01:05 +0200, Andrea Righi wrote:
> > +++ b/kernel/sched/core.c
> > @@ -727,15 +727,17 @@ static void dequeue_task(struct rq *rq, struct task_struct *p, int flags)
> > void activate_task(struct rq *rq, struct task_struct *p, int flags)
> > {
> > if (task_contributes_to_load(p))
> > - rq->nr_uninterruptible--;
> > + cpu_rq(p->on_cpu_uninterruptible)->nr_uninterruptible--;
> >
> > enqueue_task(rq, p, flags);
> > }
>
> That's completely broken, you cannot do non-atomic cross-cpu
> modifications like that. Also, adding an atomic op to the wakeup/sleep
> paths isn't going to be popular at all.
Right, the update must be atomic to have a coherent nr_uninterruptible
value. And AFAICS the only way to account a coherent nr_uninterruptible
value per-cpu is to go with atomic ops... mmh... I'll think more on
this.
>
> > void deactivate_task(struct rq *rq, struct task_struct *p, int flags)
> > {
> > - if (task_contributes_to_load(p))
> > - rq->nr_uninterruptible++;
> > + if (task_contributes_to_load(p)) {
> > + task_rq(p)->nr_uninterruptible++;
> > + p->on_cpu_uninterruptible = task_cpu(p);
> > + }
> >
> > dequeue_task(rq, p, flags);
> > }
>
> This looks pointless, at deactivate time task_rq() had better be rq or
> something is terribly broken.
Correct, I didn't realize that, sorry.
Many thanks for your review, Peter.
-Andrea
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists