[lkml]   [2012]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
SubjectRe: [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.

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)
- P(nr_uninterruptible);
+ P((signed long)nr_uninterruptible);

 \ /
  Last update: 2012-05-09 11:02    [W:0.143 / U:1.676 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site