lkml.org 
[lkml]   [2024]   [Feb]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH 1/2] sched/core: switch struct rq->nr_iowait to an unsigned int
From
On 2/27/24 4:05 PM, David Wei wrote:
>> @@ -4354,8 +4354,13 @@ int try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
>> cpu = select_task_rq(p, p->wake_cpu, wake_flags | WF_TTWU);
>> if (task_cpu(p) != cpu) {
>> if (p->in_iowait) {
>> + struct rq *rq = task_rq(p);
>> + struct rq_flags rf;
>> +
>> + rq_lock(rq, &rf);
>> + task_rq(p)->nr_iowait--;
>
> Could this use rq directly, or does it not matter?

It certainly could, I'll make that edit. Same thing, but may as well use
the variable as defined. Also makes it clear we're modifying the one
we've locked.

>> @@ -10029,7 +10034,7 @@ void __init sched_init(void)
>> #endif
>> #endif /* CONFIG_SMP */
>> hrtick_rq_init(rq);
>> - atomic_set(&rq->nr_iowait, 0);
>> + rq->nr_iowait = 0;
>
> I checked that both ttwu_do_activate() and __schedule() have the rq lock
> held, but I couldn't find it for this. Is it under the assumption that
> the rq is in a pre-init state (maybe because scheduler_running = 0?) so
> no lock is needed?

This is run at boot time (it's __init), so it's before anything is
running.

--
Jens Axboe


\
 
 \ /
  Last update: 2024-05-27 15:25    [W:0.050 / U:0.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site