[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cd1b1ea6-7b5f-0468-1512-eaabba77a98a@arm.com>
Date: Fri, 1 Feb 2019 08:45:30 +0000
From: Julien Thierry <julien.thierry@....com>
To: Valentin Schneider <valentin.schneider@....com>,
linux-kernel@...r.kernel.org
Cc: Jonathan Corbet <corbet@....net>, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, linux-doc@...r.kernel.org
Subject: Re: [RFC PATCH 3/3] sched/Documentation: Point out use of
preempt_schedule_irq()
Hi Valentin,
On 31/01/2019 18:23, Valentin Schneider wrote:
> Since there are a few archs out there that call preempt_schedule_irq()
> within a need_resched() loop, point out that it's not needed.
>
> Signed-off-by: Valentin Schneider <valentin.schneider@....com>
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Julien Thierry <julien.thierry@....com>
> Cc: linux-doc@...r.kernel.org
> ---
> Documentation/scheduler/sched-arch.txt | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/scheduler/sched-arch.txt b/Documentation/scheduler/sched-arch.txt
> index a2f27bbf2cba..ae41a94da700 100644
> --- a/Documentation/scheduler/sched-arch.txt
> +++ b/Documentation/scheduler/sched-arch.txt
> @@ -59,6 +59,16 @@ Your cpu_idle routines need to obey the following rules:
> arch/x86/kernel/process.c has examples of both polling and
> sleeping idle functions.
>
> +Kernel preemption
> +=================
> +When returning from interrupt context, you should call either of
> +preempt_schedule() or preempt_schedule_irq() if preemption is enabled
> +and need_resched() is true.
> +
I don't think preempt_schedule() is really an option for a return from
interrupt. First thing preempt_schedule() does is:
if (likely(!preemptible()))
return;
And preemptible() is:
preempt_count() == 0 && !irqs_disabled()
Generally on return from interrupt context interrupts are disabled, so
we would never be preemptible() and preempt_schedule() would just do
nothing.
Unless I'm missing something.
Cheers,
--
Julien Thierry
Powered by blists - more mailing lists