Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1234923 > unrolled thread

[RFC][PATCH 08/11] sched: Simplify preempt_count tests

Started byPeter Zijlstra <peterz@infradead.org>
First post2015-09-29 11:50 +0200
Last post2015-09-29 17:50 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [RFC][PATCH 08/11] sched: Simplify preempt_count tests Peter Zijlstra <peterz@infradead.org> - 2015-09-29 11:50 +0200
    Re: [RFC][PATCH 08/11] sched: Simplify preempt_count tests Steven Rostedt <rostedt@goodmis.org> - 2015-09-29 17:50 +0200

#1234923 — [RFC][PATCH 08/11] sched: Simplify preempt_count tests

FromPeter Zijlstra <peterz@infradead.org>
Date2015-09-29 11:50 +0200
Subject[RFC][PATCH 08/11] sched: Simplify preempt_count tests
Message-ID<qdZHQ-2IS-21@gated-at.bofh.it>
Since we stopped setting PREEMPT_ACTIVE, there is no need to mask it
out of preempt_count() tests.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 include/linux/preempt.h |    3 +--
 kernel/sched/core.c     |    2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -126,8 +126,7 @@
  * Check whether we were atomic before we did preempt_disable():
  * (used by the scheduler)
  */
-#define in_atomic_preempt_off() \
-		((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_DISABLE_OFFSET)
+#define in_atomic_preempt_off() (preempt_count() != PREEMPT_DISABLE_OFFSET)
 
 #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
 extern void preempt_count_add(int val);
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7472,7 +7472,7 @@ void __init sched_init(void)
 #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
 static inline int preempt_count_equals(int preempt_offset)
 {
-	int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
+	int nested = preempt_count() + rcu_preempt_depth();
 
 	return (nested == preempt_offset);
 }


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1235309

FromSteven Rostedt <rostedt@goodmis.org>
Date2015-09-29 17:50 +0200
Message-ID<qe5ke-2lV-11@gated-at.bofh.it>
In reply to#1234923
On Tue, 29 Sep 2015 11:28:33 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> Since we stopped setting PREEMPT_ACTIVE, there is no need to mask it
> out of preempt_count() tests.
> 
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---

Reviewed-by: Steven Rostedt <rostedt@goodmis.org>

-- Steve

>  include/linux/preempt.h |    3 +--
>  kernel/sched/core.c     |    2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 
> --- a/include/linux/preempt.h
> +++ b/include/linux/preempt.h
> @@ -126,8 +126,7 @@
>   * Check whether we were atomic before we did preempt_disable():
>   * (used by the scheduler)
>   */
> -#define in_atomic_preempt_off() \
> -		((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_DISABLE_OFFSET)
> +#define in_atomic_preempt_off() (preempt_count() != PREEMPT_DISABLE_OFFSET)
>  
>  #if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
>  extern void preempt_count_add(int val);
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -7472,7 +7472,7 @@ void __init sched_init(void)
>  #ifdef CONFIG_DEBUG_ATOMIC_SLEEP
>  static inline int preempt_count_equals(int preempt_offset)
>  {
> -	int nested = (preempt_count() & ~PREEMPT_ACTIVE) + rcu_preempt_depth();
> +	int nested = preempt_count() + rcu_preempt_depth();
>  
>  	return (nested == preempt_offset);
>  }
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web