From: Nick Piggin <npiggin@suse.de>
To: Hugh Dickins <hugh@veritas.com>
Cc: Linux Memory Management <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [rfc] rename page_count for lockless pagecache
Date: Sat, 14 Apr 2007 04:24:07 +0200 [thread overview]
Message-ID: <20070414022407.GC14544@wotan.suse.de> (raw)
In-Reply-To: <20070413121347.GC966@wotan.suse.de>
On Fri, Apr 13, 2007 at 02:13:47PM +0200, Nick Piggin wrote:
> On Fri, Apr 13, 2007 at 12:53:05PM +0100, Hugh Dickins wrote:
> > Might it be more profitable for a DEBUG mode to inject random
> > variations into page_count?
>
> I think that's a very fine idea, and much more suitable for an
> everyday kernel than my test threads. Doesn't help if they use the
> field somehow without the accessors, but we must discourage that.
> Thanks, I'll add such a debug mode.
Something like this boots and survives some stress testing here.
I guess it should be under something other than CONFIG_DEBUG_VM,
because it could harm performance and scalability significantly on
bigger boxes... or maybe it should use per-cpu counters? ;)
--
Add some debugging for lockless pagecache as suggested by Hugh.
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
@@ -267,10 +267,29 @@ static inline int get_page_unless_zero(s
return atomic_inc_not_zero(&page->_count);
}
+#ifdef CONFIG_DEBUG_VM
+extern int ll_counter;
+#endif
static inline int page_count(struct page *page)
{
if (unlikely(PageCompound(page)))
page = (struct page *)page_private(page);
+#ifdef CONFIG_DEBUG_VM
+ /*
+ * debug testing for lockless pagecache. add a random value to
+ * page_count every now and then, to simulate speculative references
+ * to it.
+ */
+ {
+ int count = atomic_read(&page->_count);
+ if (count) {
+ ll_counter++;
+ if (ll_counter % 5 == 0 || ll_counter % 7 == 0)
+ count += ll_counter % 11;
+ }
+ return count;
+ }
+#endif
return atomic_read(&page->_count);
}
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -137,6 +137,8 @@ static unsigned long __initdata dma_rese
#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
#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-04-14 2:24 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-12 12:44 [patch 0/9] lockless pagecache for 2.6.21-rc6 Nick Piggin
2007-04-12 12:44 ` [patch 1/9] mm: prep find_lock_page Nick Piggin
2007-04-12 12:45 ` [patch 2/9] radix-tree: use indirect bit Nick Piggin
2007-04-12 12:45 ` [patch 3/9] radix-tree: gang slot lookups Nick Piggin
2007-06-01 10:31 ` Peter Zijlstra
2007-04-12 12:45 ` [patch 4/9] mm: __add_to_swap_cache stuff Nick Piggin
2007-04-12 12:45 ` [patch 5/9] mm: lockless probe Nick Piggin
2007-04-12 12:45 ` [patch 6/9] mm: speculative get page Nick Piggin
2007-04-16 18:54 ` Hugh Dickins
2007-04-17 3:09 ` Nick Piggin
2007-04-12 12:45 ` [patch 7/9] mm: lockless pagecache lookups Nick Piggin
2007-04-12 12:46 ` [patch 8/9] mm: spinlock tree_lock Nick Piggin
2007-04-12 12:46 ` [patch 9/9] mm: lockless test threads Nick Piggin
2007-04-13 16:54 ` Hugh Dickins
2007-04-13 23:31 ` Nick Piggin
2007-04-12 12:46 ` [rfc] rename page_count for lockless pagecache Nick Piggin
2007-04-12 17:03 ` Peter Zijlstra
2007-04-12 23:27 ` Nick Piggin
2007-04-13 11:53 ` Hugh Dickins
2007-04-13 12:13 ` Nick Piggin
2007-04-14 2:24 ` Nick Piggin [this message]
2007-04-16 18:28 ` Hugh Dickins
2007-04-17 3:07 ` Nick Piggin
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=20070414022407.GC14544@wotan.suse.de \
--to=npiggin@suse.de \
--cc=akpm@linux-foundation.org \
--cc=hugh@veritas.com \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox