* [Patch] rcu: remove dead code in include/linux/pagemap.h
@ 2011-01-31 6:27 Amerigo Wang
2011-01-31 7:40 ` Paul E. McKenney
0 siblings, 1 reply; 2+ messages in thread
From: Amerigo Wang @ 2011-01-31 6:27 UTC (permalink / raw)
To: linux-kernel
Cc: WANG Cong, Paul E. McKenney, Andrew Morton, Andi Kleen,
Wu Fengguang, Mel Gorman, Rik van Riel
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.
Remove these dead code.
Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---
diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
index 9c66e99..e2bbbe3 100644
--- a/include/linux/pagemap.h
+++ b/include/linux/pagemap.h
@@ -133,23 +133,6 @@ 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
- VM_BUG_ON(!in_atomic());
-# endif
- /*
- * Preempt must be disabled here - we rely on rcu_read_lock doing
- * this for us.
- *
- * Pagecache won't be truncated from interrupt context, so if we have
- * found a page in the radix tree here, we have pinned its refcount by
- * disabling preempt, and hence no need for the "speculative get" that
- * SMP requires.
- */
- VM_BUG_ON(page_count(page) == 0);
- atomic_inc(&page->_count);
-
-#else
if (unlikely(!get_page_unless_zero(page))) {
/*
* Either the page has been freed, or will be freed.
@@ -158,7 +141,6 @@ static inline int page_cache_get_speculative(struct page *page)
*/
return 0;
}
-#endif
VM_BUG_ON(PageTail(page));
return 1;
@@ -171,17 +153,9 @@ 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
- VM_BUG_ON(!in_atomic());
-# endif
- VM_BUG_ON(page_count(page) == 0);
- atomic_add(count, &page->_count);
-
-#else
if (unlikely(!atomic_add_unless(&page->_count, count, 0)))
return 0;
-#endif
+
VM_BUG_ON(PageCompound(page) && page != compound_head(page));
return 1;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch] rcu: remove dead code in include/linux/pagemap.h
2011-01-31 6:27 [Patch] rcu: remove dead code in include/linux/pagemap.h Amerigo Wang
@ 2011-01-31 7:40 ` Paul E. McKenney
0 siblings, 0 replies; 2+ messages in thread
From: Paul E. McKenney @ 2011-01-31 7:40 UTC (permalink / raw)
To: Amerigo Wang
Cc: linux-kernel, Andrew Morton, Andi Kleen, Wu Fengguang, Mel Gorman,
Rik van Riel
On Mon, Jan 31, 2011 at 02:27:04PM +0800, Amerigo Wang wrote:
> 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.
The relationship between these configuration parameters has indeed
changed. But I am wondering if rather than removing these, the
conditions need to be updated as shown below.
Thanx, Paul
> Remove these dead code.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
>
> ---
> diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
> index 9c66e99..e2bbbe3 100644
> --- a/include/linux/pagemap.h
> +++ b/include/linux/pagemap.h
> @@ -133,23 +133,6 @@ static inline int page_cache_get_speculative(struct page *page)
> {
> VM_BUG_ON(in_interrupt());
>
> -#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_RCU)
#if !defined(CONFIG_SMP) && defined(CONFIG_TREE_PREEMPT_RCU)
/* Must have CONFIG_PREEMPT here, implied by CONFIG_TREE_PREEMPT_RCU. */
> -# ifdef CONFIG_PREEMPT
VM_BUG_ON(!in_atomic());
> -# endif
/*
* Preempt must be disabled here - we rely on rcu_read_lock doing
* this for us.
*
* Pagecache won't be truncated from interrupt context, so if we have
* found a page in the radix tree here, we have pinned its refcount by
* disabling preempt, and hence no need for the "speculative get" that
* SMP requires.
*/
VM_BUG_ON(page_count(page) == 0);
atomic_inc(&page->_count);
#else
if (unlikely(!get_page_unless_zero(page))) {
/*
* Either the page has been freed, or will be freed.
> @@ -158,7 +141,6 @@ static inline int page_cache_get_speculative(struct page *page)
*/
return 0;
}
#endif
> VM_BUG_ON(PageTail(page));
>
> return 1;
> @@ -171,17 +153,9 @@ 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
> - VM_BUG_ON(!in_atomic());
> -# endif
> - VM_BUG_ON(page_count(page) == 0);
> - atomic_add(count, &page->_count);
> -
> -#else
> if (unlikely(!atomic_add_unless(&page->_count, count, 0)))
> return 0;
> -#endif
> +
> VM_BUG_ON(PageCompound(page) && page != compound_head(page));
>
> return 1;
> --
> 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/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-31 7:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-31 6:27 [Patch] rcu: remove dead code in include/linux/pagemap.h Amerigo Wang
2011-01-31 7:40 ` Paul E. McKenney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox