All of lore.kernel.org
 help / color / mirror / Atom feed
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 11/12] lockdep: lock_page: use per fs-type lock_page class
Date: Tue, 17 Jul 2007 19:34:39 +0200	[thread overview]
Message-ID: <20070717173759.299149000@chello.nl> (raw)
In-Reply-To: 20070717173428.355522000@chello.nl

[-- Attachment #1: lockdep-fs-map.patch --]
[-- Type: text/plain, Size: 2951 bytes --]

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> 
---
 include/linux/pagemap.h |   55 +++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 45 insertions(+), 10 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,14 +357,44 @@ extern void FASTCALL(unlock_page_nocheck
 
 extern struct lockdep_map page_lockdep_map;
 
-static inline void __lock_page_acquire(int try, unsigned long ip)
+static inline struct lockdep_map *page_map(struct page *page)
 {
-	lock_acquire(&page_lockdep_map, 0, try, 0, 2, ip);
+	struct address_space *mapping;
+	struct inode *inode;
+	struct super_block *sb;
+	struct file_system_type *type;
+	struct lockdep_map *map = &page_lockdep_map;
+
+	mapping = page_mapping(page);
+	if (!mapping)
+		goto out;
+
+	inode = mapping->host;
+	if (!inode)
+		goto out;
+
+	sb = inode->i_sb;
+	if (!sb)
+		goto out;
+
+	type = sb->s_type;
+	if (type)
+		map = &type->s_mapping_map;
+
+out:
+	return map;
 }
 
-static inline void __unlock_page_release(unsigned long ip)
+static inline void __lock_page_acquire(struct page *page, int try, unsigned long ip)
 {
-	lock_release(&page_lockdep_map, 1, ip);
+	struct lockdep_map *map = page_map(page);
+	lock_acquire(map, 0, try, 0, 2, ip);
+}
+
+static inline void __unlock_page_release(struct page *page, unsigned long ip)
+{
+	struct lockdep_map *map = page_map(page);
+	lock_release(map, 1, ip);
 }
 
 /*
@@ -373,22 +403,27 @@ static inline void __unlock_page_release
 static inline void lock_page(struct page *page)
 {
 	might_sleep();
-	__lock_page_acquire(0, _RET_IP_);
+	__lock_page_acquire(page, 0, _RET_IP_);
 	if (TestSetPageLocked(page))
 		__lock_page(page);
 }
 
+static inline void __lock_page_check(struct page *page)
+{
+	__lock_page_acquire(page, 0, _RET_IP_);
+}
+
 static inline int trylock_page(struct page *page)
 {
 	int ret = !TestSetPageLocked(page);
 	if (ret)
-		__lock_page_acquire(1, _RET_IP_);
+		__lock_page_acquire(page, 1, _RET_IP_);
 	return ret;
 }
 
 static inline void __unlock_page_check(struct page *page)
 {
-	__unlock_page_release(_RET_IP_);
+	__unlock_page_release(page, _RET_IP_);
 }
 
 static inline void unlock_page(struct page *page)
@@ -404,7 +439,7 @@ static inline void unlock_page(struct pa
 static inline void lock_page_nosync(struct page *page)
 {
 	might_sleep();
-	__lock_page_acquire(0, _RET_IP_);
+	__lock_page_acquire(page, 0, _RET_IP_);
 	if (TestSetPageLocked(page))
 		__lock_page_nosync(page);
 }
@@ -424,10 +459,10 @@ extern void FASTCALL(wait_on_page_bit(st
  */
 static inline void wait_on_page_locked(struct page *page)
 {
-	__lock_page_acquire(0, _RET_IP_);
+	__lock_page_acquire(page, 0, _RET_IP_);
 	if (PageLocked(page))
 		wait_on_page_bit(page, PG_locked);
-	__unlock_page_release(_RET_IP_);
+	__unlock_page_release(page, _RET_IP_);
 }
 
 /* 

--


  parent reply	other threads:[~2007-07-17 15:44 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 ` [RFC/T PATCH 08/12] lockdep: lock_page: recursion Peter Zijlstra
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 ` Peter Zijlstra [this message]
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=20070717173759.299149000@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.