From: Jens Axboe <axboe@kernel.dk>
To: David Wei <dw@davidwei.uk>, linux-kernel@vger.kernel.org
Cc: peterz@infradead.org, mingo@redhat.com
Subject: Re: [PATCH 1/2] sched/core: switch struct rq->nr_iowait to an unsigned int
Date: Tue, 27 Feb 2024 16:17:32 -0700 [thread overview]
Message-ID: <a02799bd-d8e8-488f-952f-2c507bd26261@kernel.dk> (raw)
In-Reply-To: <14d4705c-48a8-4d38-8132-7b849286137c@davidwei.uk>
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
next prev parent reply other threads:[~2024-02-27 23:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 21:06 [PATCHSET v2 0/2] Split iowait into two states Jens Axboe
2024-02-27 21:06 ` [PATCH 1/2] sched/core: switch struct rq->nr_iowait to an unsigned int Jens Axboe
2024-02-27 23:05 ` David Wei
2024-02-27 23:17 ` Jens Axboe [this message]
2024-02-27 21:06 ` [PATCH 2/2] sched/core: split iowait state into two states Jens Axboe
2024-02-28 2:21 ` [PATCHSET v2 0/2] Split iowait " Jens Axboe
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=a02799bd-d8e8-488f-952f-2c507bd26261@kernel.dk \
--to=axboe@kernel.dk \
--cc=dw@davidwei.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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