lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 27 Feb 2024 16:17:32 -0700
From: Jens Axboe <axboe@...nel.dk>
To: David Wei <dw@...idwei.uk>, linux-kernel@...r.kernel.org
Cc: peterz@...radead.org, mingo@...hat.com
Subject: Re: [PATCH 1/2] sched/core: switch struct rq->nr_iowait to an
 unsigned int

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ