[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878r12dkw8.fsf@oracle.com>
Date: Wed, 24 Apr 2024 23:19:35 -0700
From: Ankur Arora <ankur.a.arora@...cle.com>
To: Sean Christopherson <seanjc@...gle.com>
Cc: Jonathan Corbet <corbet@....net>, Ingo Molnar <mingo@...hat.com>,
Peter
Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Will Deacon
<will@...nel.org>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org,
Valentin Schneider
<valentin.schneider@....com>,
Marco Elver <elver@...gle.com>,
Frederic
Weisbecker <frederic@...nel.org>,
David Matlack <dmatlack@...gle.com>,
Friedrich Weber <f.weber@...xmox.com>,
Ankur Arora
<ankur.a.arora@...cle.com>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v2 1/2] sched/core: Move preempt_model_*() helpers from
sched.h to preempt.h
Sean Christopherson <seanjc@...gle.com> writes:
> Move the declarations and inlined implementations of the preempt_model_*()
> helpers to preempt.h so that they can be referenced in spinlock.h without
> creating a potential circular dependency between spinlock.h and sched.h.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Ankur Arora <ankur.a.arora@...cle.com>
Ankur
> ---
> include/linux/preempt.h | 41 +++++++++++++++++++++++++++++++++++++++++
> include/linux/sched.h | 41 -----------------------------------------
> 2 files changed, 41 insertions(+), 41 deletions(-)
>
> diff --git a/include/linux/preempt.h b/include/linux/preempt.h
> index 7233e9cf1bab..ce76f1a45722 100644
> --- a/include/linux/preempt.h
> +++ b/include/linux/preempt.h
> @@ -481,4 +481,45 @@ DEFINE_LOCK_GUARD_0(preempt, preempt_disable(), preempt_enable())
> DEFINE_LOCK_GUARD_0(preempt_notrace, preempt_disable_notrace(), preempt_enable_notrace())
> DEFINE_LOCK_GUARD_0(migrate, migrate_disable(), migrate_enable())
>
> +#ifdef CONFIG_PREEMPT_DYNAMIC
> +
> +extern bool preempt_model_none(void);
> +extern bool preempt_model_voluntary(void);
> +extern bool preempt_model_full(void);
> +
> +#else
> +
> +static inline bool preempt_model_none(void)
> +{
> + return IS_ENABLED(CONFIG_PREEMPT_NONE);
> +}
> +static inline bool preempt_model_voluntary(void)
> +{
> + return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY);
> +}
> +static inline bool preempt_model_full(void)
> +{
> + return IS_ENABLED(CONFIG_PREEMPT);
> +}
> +
> +#endif
> +
> +static inline bool preempt_model_rt(void)
> +{
> + return IS_ENABLED(CONFIG_PREEMPT_RT);
> +}
> +
> +/*
> + * Does the preemption model allow non-cooperative preemption?
> + *
> + * For !CONFIG_PREEMPT_DYNAMIC kernels this is an exact match with
> + * CONFIG_PREEMPTION; for CONFIG_PREEMPT_DYNAMIC this doesn't work as the
> + * kernel is *built* with CONFIG_PREEMPTION=y but may run with e.g. the
> + * PREEMPT_NONE model.
> + */
> +static inline bool preempt_model_preemptible(void)
> +{
> + return preempt_model_full() || preempt_model_rt();
> +}
> +
> #endif /* __LINUX_PREEMPT_H */
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index 17cb0761ff65..e9dc10f7a463 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -2058,47 +2058,6 @@ extern int __cond_resched_rwlock_write(rwlock_t *lock);
> __cond_resched_rwlock_write(lock); \
> })
>
> -#ifdef CONFIG_PREEMPT_DYNAMIC
> -
> -extern bool preempt_model_none(void);
> -extern bool preempt_model_voluntary(void);
> -extern bool preempt_model_full(void);
> -
> -#else
> -
> -static inline bool preempt_model_none(void)
> -{
> - return IS_ENABLED(CONFIG_PREEMPT_NONE);
> -}
> -static inline bool preempt_model_voluntary(void)
> -{
> - return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY);
> -}
> -static inline bool preempt_model_full(void)
> -{
> - return IS_ENABLED(CONFIG_PREEMPT);
> -}
> -
> -#endif
> -
> -static inline bool preempt_model_rt(void)
> -{
> - return IS_ENABLED(CONFIG_PREEMPT_RT);
> -}
> -
> -/*
> - * Does the preemption model allow non-cooperative preemption?
> - *
> - * For !CONFIG_PREEMPT_DYNAMIC kernels this is an exact match with
> - * CONFIG_PREEMPTION; for CONFIG_PREEMPT_DYNAMIC this doesn't work as the
> - * kernel is *built* with CONFIG_PREEMPTION=y but may run with e.g. the
> - * PREEMPT_NONE model.
> - */
> -static inline bool preempt_model_preemptible(void)
> -{
> - return preempt_model_full() || preempt_model_rt();
> -}
> -
> static __always_inline bool need_resched(void)
> {
> return unlikely(tif_need_resched());
Powered by blists - more mailing lists