Skip to content

Commit 4855fea

Browse files
committed
sched: Change nr_uninterruptible type to unsigned long
JIRA: https://issues.redhat.com/browse/RHEL-107437 Conflicts: Minor context diff in sched.h. commit 3656978 Author: Aruna Ramakrishna <[email protected]> Date: Wed Jul 9 17:33:28 2025 +0000 sched: Change nr_uninterruptible type to unsigned long The commit e6fe3f4 ("sched: Make multiple runqueue task counters 32-bit") changed nr_uninterruptible to an unsigned int. But the nr_uninterruptible values for each of the CPU runqueues can grow to large numbers, sometimes exceeding INT_MAX. This is valid, if, over time, a large number of tasks are migrated off of one CPU after going into an uninterruptible state. Only the sum of all nr_interruptible values across all CPUs yields the correct result, as explained in a comment in kernel/sched/loadavg.c. Change the type of nr_uninterruptible back to unsigned long to prevent overflows, and thus the miscalculation of load average. Fixes: e6fe3f4 ("sched: Make multiple runqueue task counters 32-bit") Signed-off-by: Aruna Ramakrishna <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Phil Auld <[email protected]>
1 parent 5896001 commit 4855fea

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

kernel/sched/loadavg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ long calc_load_fold_active(struct rq *this_rq, long adjust)
8080
long nr_active, delta = 0;
8181

8282
nr_active = this_rq->nr_running - adjust;
83-
nr_active += (int)this_rq->nr_uninterruptible;
83+
nr_active += (long)this_rq->nr_uninterruptible;
8484

8585
if (nr_active != this_rq->calc_load_active) {
8686
delta = nr_active - this_rq->calc_load_active;

kernel/sched/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ struct rq {
10791079
* one CPU and if it got migrated afterwards it may decrease
10801080
* it on another CPU. Always updated under the runqueue lock:
10811081
*/
1082-
unsigned int nr_uninterruptible;
1082+
unsigned long nr_uninterruptible;
10831083

10841084
struct task_struct __rcu *curr;
10851085
struct task_struct *idle;

0 commit comments

Comments
 (0)