From: Nick Piggin <npiggin@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Hugh Dickins <hugh@veritas.com>
Cc: Linux Memory Management List <linux-mm@kvack.org>
Subject: [patch 6/6] mm: speculative refcount debug
Date: Sun, 11 Nov 2007 09:52:21 +0100 [thread overview]
Message-ID: <20071111085221.GI19816@wotan.suse.de> (raw)
In-Reply-To: <20071111084556.GC19816@wotan.suse.de>
Add some debugging for lockless pagecache.
Signed-off-by: Nick Piggin <npiggin@suse.de>
---
Index: linux-2.6/include/linux/mm.h
===================================================================
--- linux-2.6.orig/include/linux/mm.h
+++ linux-2.6/include/linux/mm.h
@@ -236,9 +236,30 @@ static inline struct page *compound_head
return page;
}
+#ifdef CONFIG_DEBUG_VM
+extern int ll_counter;
+#endif
+
static inline int page_count(struct page *page)
{
+#ifndef CONFIG_DEBUG_VM
return atomic_read(&compound_head(page)->_count);
+#else
+
+ int count;
+ /*
+ * debug testing for lockless pagecache. add a random value to
+ * page_count every now and then, to simulate speculative references
+ * to it.
+ */
+ count = atomic_read(&compound_head(page)->_count);
+ if (count) {
+ ll_counter++;
+ if (ll_counter % 5 == 0 || ll_counter % 7 == 0)
+ count += ll_counter % 11;
+ }
+ return count;
+#endif
}
static inline void get_page(struct page *page)
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -173,6 +173,8 @@ static void set_pageblock_migratetype(st
}
#ifdef CONFIG_DEBUG_VM
+int ll_counter; /* used in include/linux/mm.h, for lockless pagecache */
+EXPORT_SYMBOL(ll_counter);
static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
{
int ret = 0;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2007-11-11 8:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-11 8:45 [patch 0/6] lockless pagecache Nick Piggin
2007-11-11 8:47 ` [patch 1/6] mm: readahead scan lockless Nick Piggin
2007-11-11 8:49 ` [patch 2/6] radix-tree: gang_lookup_slot Nick Piggin
2007-11-11 8:50 ` [patch 3/6] mm: speculative get page Nick Piggin
2007-11-12 20:21 ` Christoph Lameter
2007-11-13 0:35 ` Nick Piggin
2007-11-13 0:37 ` Christoph Lameter
2007-11-13 0:51 ` Nick Piggin
2007-11-11 8:51 ` [patch 4/6] mm: lockless pagecache lookups Nick Piggin
2007-11-11 8:51 ` [patch 5/6] mm: spinlock tree_lock Nick Piggin
2007-11-11 8:52 ` Nick Piggin [this message]
2007-11-17 9:48 ` [patch 0/6] lockless pagecache Peter Zijlstra
2007-11-17 20:16 ` Hugh Dickins
2007-11-19 22:58 ` Nick Piggin
2008-01-09 15:45 ` 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=20071111085221.GI19816@wotan.suse.de \
--to=npiggin@suse.de \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.org \
--cc=torvalds@linux-foundation.org \
/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.