From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, Zach Brown <zach.brown@oracle.com>,
Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [RFC/T PATCH 08/12] lockdep: lock_page: recursion
Date: Tue, 17 Jul 2007 19:34:36 +0200 [thread overview]
Message-ID: <20070717173758.525668000@chello.nl> (raw)
In-Reply-To: 20070717173428.355522000@chello.nl
[-- Attachment #1: lockdep-page-recursion.patch --]
[-- Type: text/plain, Size: 2151 bytes --]
avoid the need to annotate lock_page nestings (which are abundant)
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
include/linux/pagemap.h | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
Index: linux-2.6/include/linux/pagemap.h
===================================================================
--- linux-2.6.orig/include/linux/pagemap.h
+++ linux-2.6/include/linux/pagemap.h
@@ -357,13 +357,23 @@ extern void FASTCALL(unlock_page_nocheck
extern struct lockdep_map page_lockdep_map;
+static inline void __lock_page_acquire(int try, unsigned long ip)
+{
+ lock_acquire(&page_lockdep_map, 0, try, 0, 2, ip);
+}
+
+static inline void __unlock_page_release(unsigned long ip)
+{
+ lock_release(&page_lockdep_map, 1, ip);
+}
+
/*
* lock_page may only be called if we have the page's inode pinned.
*/
static inline void lock_page(struct page *page)
{
might_sleep();
- spin_acquire(&page_lockdep_map, 0, 0, _RET_IP_);
+ __lock_page_acquire(0, _RET_IP_);
if (TestSetPageLocked(page))
__lock_page(page);
}
@@ -372,13 +382,13 @@ static inline int trylock_page(struct pa
{
int ret = !TestSetPageLocked(page);
if (ret)
- spin_acquire(&page_lockdep_map, 0, 1, _RET_IP_);
+ __lock_page_acquire(1, _RET_IP_);
return ret;
}
static inline void __unlock_page_check(struct page *page)
{
- spin_release(&page_lockdep_map, 1, _RET_IP_);
+ __unlock_page_release(_RET_IP_);
}
static inline void unlock_page(struct page *page)
@@ -394,7 +404,7 @@ static inline void unlock_page(struct pa
static inline void lock_page_nosync(struct page *page)
{
might_sleep();
- spin_acquire(&page_lockdep_map, 0, 0, _RET_IP_);
+ __lock_page_acquire(0, _RET_IP_);
if (TestSetPageLocked(page))
__lock_page_nosync(page);
}
@@ -414,10 +424,10 @@ extern void FASTCALL(wait_on_page_bit(st
*/
static inline void wait_on_page_locked(struct page *page)
{
- spin_acquire(&page_lockdep_map, 0, 0, _RET_IP_);
+ __lock_page_acquire(0, _RET_IP_);
if (PageLocked(page))
wait_on_page_bit(page, PG_locked);
- spin_release(&page_lockdep_map, 1, _RET_IP_);
+ __unlock_page_release(_RET_IP_);
}
/*
--
next prev parent reply other threads:[~2007-07-17 15:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 17:34 [RFC/T PATCH 00/12] lockdep: annotate lock_page Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 01/12] lockdep: annotate journal_start() Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 02/12] mm: trylock_page Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 03/12] mm: remove raw SetPageLocked() usage Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 04/12] mm: remove raw ClearPageLocked() usage Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 05/12] lockdep: add initial lockdep support for lock_page Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 06/12] lockdep: lock_page: handle IO-completions Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 07/12] lockdep: non-recursive validation Peter Zijlstra
2007-07-17 17:34 ` Peter Zijlstra [this message]
2007-07-17 17:34 ` [RFC/T PATCH 09/12] lockdep: increase MAX_LOCK_DEPTH Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 10/12] lockdep: fs: per file-system type lock_page class Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 11/12] lockdep: lock_page: use per fs-type " Peter Zijlstra
2007-07-17 17:34 ` [RFC/T PATCH 12/12] mm: set_page_mapping() Peter Zijlstra
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=20070717173758.525668000@chello.nl \
--to=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=zach.brown@oracle.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