From: Amerigo Wang <amwang@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: WANG Cong <amwang@redhat.com>,
"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@linux.intel.com>,
Wu Fengguang <fengguang.wu@intel.com>, Mel Gorman <mel@csn.ul.ie>,
Rik van Riel <riel@redhat.com>
Subject: [Patch] rcu: remove dead code in include/linux/pagemap.h
Date: Mon, 31 Jan 2011 14:27:04 +0800 [thread overview]
Message-ID: <1296455224-14065-1-git-send-email-amwang@redhat.com> (raw)
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;
next reply other threads:[~2011-01-31 6:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-31 6:27 Amerigo Wang [this message]
2011-01-31 7:40 ` [Patch] rcu: remove dead code in include/linux/pagemap.h Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1296455224-14065-1-git-send-email-amwang@redhat.com \
--to=amwang@redhat.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=fengguang.wu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mel@csn.ul.ie \
--cc=paulmck@linux.vnet.ibm.com \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox