public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Wang <wangyun@linux.vnet.ibm.com>
To: Diwakar Tundlam <dtundlam@nvidia.com>
Cc: "'Peter Zijlstra'" <peterz@infradead.org>,
	"'Ingo Molnar'" <mingo@kernel.org>,
	"'David Rientjes'" <rientjes@google.com>,
	"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
	Peter De Schrijver <pdeschrijver@nvidia.com>
Subject: Re: [PATCH] sched: Make nr_uninterruptible count a signed value
Date: Thu, 10 May 2012 12:46:16 +0800	[thread overview]
Message-ID: <4FAB4818.6070005@linux.vnet.ibm.com> (raw)
In-Reply-To: <1DD7BFEDD3147247B1355BEFEFE46652379C3DF117@HQMAIL04.nvidia.com>

On 05/10/2012 02:55 AM, Diwakar Tundlam wrote:

>>> -       P(nr_uninterruptible);
>>> +       P((signed long)nr_uninterruptible);
> 
> I thought of it too, but it won't compile because the P macro expands to dereferencing rq->nr_uninterruptible, so with your change, it will show up as rq->(signed long)nr_uninterruptible which is a syntax error.
> 

oh, I see, so looks like it's a little hard to avoid some ugly change...

--Michael Wang

> --Diwakar.
> 
> -----Original Message-----
> From: Michael Wang [mailto:wangyun@linux.vnet.ibm.com] 
> Sent: Wednesday, May 09, 2012 12:49 AM
> To: Diwakar Tundlam
> Cc: 'Peter Zijlstra'; 'Ingo Molnar'; 'David Rientjes'; 'linux-kernel@vger.kernel.org'; Peter De Schrijver
> Subject: Re: [PATCH] sched: Make nr_uninterruptible count a signed value
> 
> On 05/09/2012 06:46 AM, Diwakar Tundlam wrote:
> 
>>> No that's right. nr_uninterruptible counts the number of tasks in 
>>> uninterruptible sleep, so deactivate_task puts a task to sleep, so we 
>>> need to increment the number of sleeping tasks, activate_task wakes a 
>>> task up so we need to decrement the number of sleeping tasks.
>>
>> Yep, I looked at the code for task_contributes_to_load() and I understand what it is all about.
>> The ++ and -- are correct, I see it now.
>>
>> On the -ve values, strangely inspite of %Ld in the print statement, in my kernel, I see high unsigned values instead of -ve values for nr_uninterruptible.
>>
>> But the sum is always 0, though.
>>
>> Maybe it is an artifact of 32-bit machine displaying 64-bit print format.
>> An (unsigned long)(-24) promoted to (signed long long) ends up as 4294967272.
>> As seen in my output of sched_debug.
> 
> 
> This may do some help.
> 
> Regards,
> Michael Wang
> ---
>  kernel/sched/debug.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index 09acaa1..ab9d53f 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -270,7 +270,7 @@ static void print_cpu(struct seq_file *m, int cpu)
>                    rq->load.weight);
>         P(nr_switches);
>         P(nr_load_updates);
> -       P(nr_uninterruptible);
> +       P((signed long)nr_uninterruptible);
>         PN(next_balance);
>         P(curr->pid);
>         PN(clock);
> --
> 1.7.4.1
> 



  reply	other threads:[~2012-05-10 14:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-08 21:39 [PATCH] sched: Make nr_uninterruptible count a signed value Diwakar Tundlam
2012-05-08 21:56 ` Peter Zijlstra
2012-05-08 22:14   ` Diwakar Tundlam
2012-05-08 22:27     ` Peter Zijlstra
2012-05-08 22:29       ` Peter Zijlstra
2012-05-08 22:46         ` Diwakar Tundlam
2012-05-09  7:49           ` Michael Wang
2012-05-09 18:55             ` Diwakar Tundlam
2012-05-10  4:46               ` Michael Wang [this message]
2012-05-09  8:11           ` Peter Zijlstra
2012-05-09 19:04             ` Diwakar Tundlam
2012-05-10  3:41             ` Michael Wang
2012-05-10  9:46               ` Peter Zijlstra
2012-05-11  2:19                 ` Michael Wang

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=4FAB4818.6070005@linux.vnet.ibm.com \
    --to=wangyun@linux.vnet.ibm.com \
    --cc=dtundlam@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=pdeschrijver@nvidia.com \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox