Skip to contentSkip to conversation

rcu: update the CONFIG logic in include/linux/pagemap.h

PATCH In review Amerigo Wang 2 participants 2 messages Apr 6, 2011 – Apr 8, 2011 Page cache

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 rcu: update the CONFIG logic in include/linux/pagemap.h

TREE_RCU depends on !PREEMPT && SMP, when !CONFIG_SMP is true, CONFIG_TREE_RCU will be false, thus "!defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)" is always false.

Paul suggested to update the logic to !defined(CONFIG_SMP) && defined(CONFIG_TREE_PREEMPT_RCU).

Cc Paul E. McKenney <[email protected]>
---
 include/linux/pagemap.h |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
include/linux/pagemap.h +3 -6
index c119506..a296d7c 100644
@@ -133,10 +133,9 @@ static inline int page_cache_get_speculative(struct page *page)
 {
 	VM_BUG_ON(in_interrupt());
 
-#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
-# ifdef CONFIG_PREEMPT
+#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_PREEMPT_RCU)
+	/* Must have CONFIG_PREEMPT here, implied by CONFIG_TREE_PREEMPT_RCU. */
 	VM_BUG_ON(!in_atomic());
-# endif
 	/*
 	 * Preempt must be disabled here - we rely on rcu_read_lock doing
 	 * this for us.
@@ -171,10 +170,8 @@ static inline int page_cache_add_speculative(struct page *page, int count)
 {
 	VM_BUG_ON(in_interrupt());
 
-#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
-# ifdef CONFIG_PREEMPT
+#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_PREEMPT_RCU)
 	VM_BUG_ON(!in_atomic());
-# endif
 	VM_BUG_ON(page_count(page) == 0);
 	atomic_add(count, &page->_count);
 
#1 lore raw
Quoted 6 lines · Amerigo Wang

TREE_RCU depends on !PREEMPT && SMP, when !CONFIG_SMP is true, CONFIG_TREE_RCU will be false, thus "!defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)" is always false.

Paul suggested to update the logic to !defined(CONFIG_SMP) && defined(CONFIG_TREE_PREEMPT_RCU).

Hello, Amerigo,

Thank you for keeping on top of this one!

But how does this patch handle the #else clauses?

Thanx, Paul

Quoted 36 lines
Cc Paul E. McKenney <[email protected]>
---
 include/linux/pagemap.h |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
include/linux/pagemap.h +3 -6
index c119506..a296d7c 100644
@@ -133,10 +133,9 @@ static inline int page_cache_get_speculative(struct page *page)
 {
 	VM_BUG_ON(in_interrupt());
 
-#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
-# ifdef CONFIG_PREEMPT
+#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_PREEMPT_RCU)
+	/* Must have CONFIG_PREEMPT here, implied by CONFIG_TREE_PREEMPT_RCU. */
 	VM_BUG_ON(!in_atomic());
-# endif
 	/*
 	 * Preempt must be disabled here - we rely on rcu_read_lock doing
 	 * this for us.
@@ -171,10 +170,8 @@ static inline int page_cache_add_speculative(struct page *page, int count)
 {
 	VM_BUG_ON(in_interrupt());
 
-#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
-# ifdef CONFIG_PREEMPT
+#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_PREEMPT_RCU)
 	VM_BUG_ON(!in_atomic());
-# endif
 	VM_BUG_ON(page_count(page) == 0);
 	atomic_add(count, &page->_count);