Skip to contentSkip to conversation

sched/debug: correct printing for rq->nr_uninterruptible

PATCH Applied 晏艳(采苓) 2 participants 2 messages May 6, 2023 – May 10, 2023 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 sched/debug: correct printing for rq->nr_uninterruptible

Commit e6fe3f422be1 ("sched: Make multiple runqueue task counters 32-bit") changed the type for rq->nr_uninterruptible from "unsigned long" to "unsigned int", but left wrong cast print to /sys/kernel/debug/sched/debug and to the console.

For example, nr_uninterruptible's value is fffffff7 with type "unsigned int", (long)nr_uninterruptible shows 4294967287 while (int)nr_uninterruptible prints -9. So using int cast fixes wrong printing.

---
 kernel/sched/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/debug.c +1 -1
index 667876da8382..ac6684cd4ae4 100644
@@ -730,7 +730,7 @@ static void print_cpu(struct seq_file *m, int cpu)
 #define P(x)								\
 do {									\
 	if (sizeof(rq->x) == 4)						\
-		SEQ_printf(m, "  .%-30s: %ld\n", #x, (long)(rq->x));	\
+		SEQ_printf(m, "  .%-30s: %d\n", #x, (int)(rq->x));	\
 	else								\
 		SEQ_printf(m, "  .%-30s: %Ld\n", #x, (long long)(rq->x));\
 } while (0)
Signature · 1 line
2.32.0.3.g01195cf9f
merge bot Applied
#1 lore raw

[tip: sched/core] sched/debug: Correct printing for rq->nr_uninterruptible

The following commit has been merged into the sched/core branch of tip:

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     a6fcdd8d95f7486150b3faadfea119fc3dfc3b74
Gitweb:        https://git.kernel.org/tip/a6fcdd8d95f7486150b3faadfea119fc3dfc3b74
Author:        晏艳(采苓) <[email protected]>
AuthorDate:    Sat, 06 May 2023 15:42:53 +08:00
Committer:     Peter Zijlstra <[email protected]>
CommitterDate: Mon, 08 May 2023 10:58:39 +02:00

sched/debug: Correct printing for rq->nr_uninterruptible

Commit e6fe3f422be1 ("sched: Make multiple runqueue task counters 32-bit") changed the type for rq->nr_uninterruptible from "unsigned long" to "unsigned int", but left wrong cast print to /sys/kernel/debug/sched/debug and to the console.

For example, nr_uninterruptible's value is fffffff7 with type "unsigned int", (long)nr_uninterruptible shows 4294967287 while (int)nr_uninterruptible prints -9. So using int cast fixes wrong printing.

---
 kernel/sched/debug.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/sched/debug.c +1 -1
index 0b2340a..066ff1c 100644
@@ -777,7 +777,7 @@ static void print_cpu(struct seq_file *m, int cpu)
 #define P(x)								\
 do {									\
 	if (sizeof(rq->x) == 4)						\
-		SEQ_printf(m, "  .%-30s: %ld\n", #x, (long)(rq->x));	\
+		SEQ_printf(m, "  .%-30s: %d\n", #x, (int)(rq->x));	\
 	else								\
 		SEQ_printf(m, "  .%-30s: %Ld\n", #x, (long long)(rq->x));\
 } while (0)