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: Wed, 29 May 2024 11:32:03 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Ankur Arora <ankur.a.arora@...cle.com>
Cc: linux-kernel@...r.kernel.org, tglx@...utronix.de,
	torvalds@...ux-foundation.org, paulmck@...nel.org,
	rostedt@...dmis.org, mark.rutland@....com, juri.lelli@...hat.com,
	joel@...lfernandes.org, raghavendra.kt@....com,
	sshegde@...ux.ibm.com, boris.ostrovsky@...cle.com,
	konrad.wilk@...cle.com, Ingo Molnar <mingo@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>
Subject: Re: [PATCH v2 21/35] sched: prepare for lazy rescheduling in
 resched_curr()

On Mon, May 27, 2024 at 05:35:07PM -0700, Ankur Arora wrote:

> @@ -1041,25 +1041,34 @@ void wake_up_q(struct wake_q_head *head)
>  void resched_curr(struct rq *rq)
>  {
>  	struct task_struct *curr = rq->curr;
> +	resched_t rs = RESCHED_NOW;
>  	int cpu;
>  
>  	lockdep_assert_rq_held(rq);
>  
> -	if (__test_tsk_need_resched(curr, RESCHED_NOW))
> +	/*
> +	 * TIF_NEED_RESCHED is the higher priority bit, so if it is already
> +	 * set, nothing more to be done.
> +	 */
> +	if (__test_tsk_need_resched(curr, RESCHED_NOW) ||
> +	    (rs == RESCHED_LAZY && __test_tsk_need_resched(curr, RESCHED_LAZY)))
>  		return;
>  
>  	cpu = cpu_of(rq);
>  
>  	if (cpu == smp_processor_id()) {
> -		__set_tsk_need_resched(curr, RESCHED_NOW);
> -		set_preempt_need_resched();
> +		__set_tsk_need_resched(curr, rs);
> +		if (rs == RESCHED_NOW)
> +			set_preempt_need_resched();
>  		return;
>  	}
>  
> -	if (set_nr_and_not_polling(curr))
> -		smp_send_reschedule(cpu);
> -	else
> +	if (set_nr_and_not_polling(curr, rs)) {
> +		if (rs == RESCHED_NOW)
> +			smp_send_reschedule(cpu);

I'm thinking this wants at least something like:

		WARN_ON_ONCE(rs == RESCHED_LAZY && is_idle_task(curr));


> +	} else {
>  		trace_sched_wake_idle_without_ipi(cpu);
> +	}
>  }
>  
>  void resched_cpu(int cpu)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ