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-next>] [day] [month] [year] [list]
Date:   Thu, 22 Sep 2016 14:25:01 -0400 (EDT)
From:   Mikulas Patocka <mpatocka@...hat.com>
To:     hpa@...or.com, paulmck@...ux.vnet.ibm.com, josh@...htriplett.org,
        rostedt@...dmis.org, mathieu.desnoyers@...icios.com,
        jiangshanlai@...il.com, torvalds@...ux-foundation.org,
        mingo@...nel.org, tglx@...utronix.de, peterz@...radead.org,
        linux-kernel@...r.kernel.org, oleg@...hat.com
cc:     linux-tip-commits@...r.kernel.org
Subject: Re: [tip:sched/core] sched/core: Avoid _cond_resched() for
 PREEMPT=y

I've found a document that says that cond_resched() is needed on
preemptible kernels to mark RCU quiescent states:

https://lwn.net/Articles/603252/

Paul, is cond_resched() still needed on current RCU implementation? Or not?

Mikulas



On Thu, 22 Sep 2016, tip-bot for Peter Zijlstra wrote:

> Commit-ID:  35a773a07926a22bf19d77ee00024522279c4e68
> Gitweb:     http://git.kernel.org/tip/35a773a07926a22bf19d77ee00024522279c4e68
> Author:     Peter Zijlstra <peterz@...radead.org>
> AuthorDate: Mon, 19 Sep 2016 12:57:53 +0200
> Committer:  Ingo Molnar <mingo@...nel.org>
> CommitDate: Thu, 22 Sep 2016 14:53:46 +0200
> 
> sched/core: Avoid _cond_resched() for PREEMPT=y
> 
> On fully preemptible kernels _cond_resched() is pointless, so avoid
> emitting any code for it.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Mikulas Patocka <mpatocka@...hat.com>
> Cc: Oleg Nesterov <oleg@...hat.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: linux-kernel@...r.kernel.org
> Signed-off-by: Ingo Molnar <mingo@...nel.org>
> ---
>  include/linux/sched.h | 4 ++++
>  kernel/sched/core.c   | 2 ++
>  2 files changed, 6 insertions(+)
> 
> diff --git a/include/linux/sched.h b/include/linux/sched.h
> index f00ee8e..b99fcd1 100644
> --- a/include/linux/sched.h
> +++ b/include/linux/sched.h
> @@ -3209,7 +3209,11 @@ static inline int signal_pending_state(long state, struct task_struct *p)
>   * cond_resched_lock() will drop the spinlock before scheduling,
>   * cond_resched_softirq() will enable bhs before scheduling.
>   */
> +#ifndef CONFIG_PREEMPT
>  extern int _cond_resched(void);
> +#else
> +static inline int _cond_resched(void) { return 0; }
> +#endif
>  
>  #define cond_resched() ({			\
>  	___might_sleep(__FILE__, __LINE__, 0);	\
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index b2ec53c..d7babcc 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4883,6 +4883,7 @@ SYSCALL_DEFINE0(sched_yield)
>  	return 0;
>  }
>  
> +#ifndef CONFIG_PREEMPT
>  int __sched _cond_resched(void)
>  {
>  	if (should_resched(0)) {
> @@ -4892,6 +4893,7 @@ int __sched _cond_resched(void)
>  	return 0;
>  }
>  EXPORT_SYMBOL(_cond_resched);
> +#endif
>  
>  /*
>   * __cond_resched_lock() - if a reschedule is pending, drop the given lock,
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ