All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Andrea Righi <andrea@betterlinux.com>
Cc: Paul Menage <paul@paulmenage.org>, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 1/3] sched: introduce distinct per-cpu load average
Date: Thu, 04 Oct 2012 10:59:46 +0200	[thread overview]
Message-ID: <1349341186.4438.1.camel@twins> (raw)
In-Reply-To: <1349305512-3428-2-git-send-email-andrea@betterlinux.com>

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.

>  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.

  reply	other threads:[~2012-10-04  9:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-03 23:05 [PATCH RFC 0/3] per cpuset load average Andrea Righi
2012-10-03 23:05 ` [PATCH RFC 1/3] sched: introduce distinct per-cpu " Andrea Righi
2012-10-04  8:59   ` Peter Zijlstra [this message]
2012-10-04  9:43     ` Andrea Righi
2012-10-04 12:12       ` Peter Zijlstra
2012-10-04 17:19         ` Andrea Righi
2012-10-03 23:05 ` [PATCH RFC 2/3] cpusets: add load avgerage interface Andrea Righi
2012-10-03 23:05 ` [PATCH RFC 3/3] cpusets: add documentation of the loadavg file Andrea Righi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349341186.4438.1.camel@twins \
    --to=peterz@infradead.org \
    --cc=andrea@betterlinux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paul@paulmenage.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.