public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	npiggin@suse.de, fengguang.wu@intel.com, Jan Kara <jack@suse.cz>
Subject: [PATCH 3/3] mm: Debugging of new livelock avoidance
Date: Fri, 12 Feb 2010 00:06:24 +0100	[thread overview]
Message-ID: <1265929584-5080-4-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1265929584-5080-1-git-send-email-jack@suse.cz>

Make some paranoic checks to verify that code does what it's expected to do.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 mm/page-writeback.c |   39 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 39 insertions(+), 0 deletions(-)

diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index f37cbc2..a389feb 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -822,6 +822,45 @@ void tag_pages_for_writeback(struct address_space *mapping,
 	spin_lock_irq(&mapping->tree_lock);
 	radix_tree_gang_tag_if_tagged(&mapping->page_tree, start, end,
 				PAGECACHE_TAG_DIRTY, PAGECACHE_TAG_TOWRITE);
+	/* Debugging aid */
+	{
+	int i;
+	pgoff_t index;
+	unsigned int nr_pages;
+	struct pagevec pvec;
+
+	index = start;
+	do {
+		nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
+			      PAGECACHE_TAG_DIRTY,
+			      min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
+		for (i = 0; i < nr_pages; i++) {
+			if (pvec.pages[i]->index > end) {
+				nr_pages = 0;
+				break;
+			}
+			if (!radix_tree_tag_get(&mapping->page_tree, pvec.pages[i]->index, PAGECACHE_TAG_TOWRITE))
+				printk("Seeing DIRTY !TOWRITE page %lu, state %lu\n", pvec.pages[i]->index, pvec.pages[i]->flags);
+		}
+		pagevec_release(&pvec);
+	} while (nr_pages);
+
+	index = start;
+	do {
+		nr_pages = pagevec_lookup_tag(&pvec, mapping, &index,
+			      PAGECACHE_TAG_TOWRITE,
+			      min(end - index, (pgoff_t)PAGEVEC_SIZE-1) + 1);
+		for (i = 0; i < nr_pages; i++) {
+			if (pvec.pages[i]->index > end) {
+				nr_pages = 0;
+				break;
+			}
+			if (!radix_tree_tag_get(&mapping->page_tree, pvec.pages[i]->index, PAGECACHE_TAG_DIRTY))
+				printk("Seeing !DIRTY TOWRITE page %lu, state %lu\n", pvec.pages[i]->index, pvec.pages[i]->flags);
+		}
+		pagevec_release(&pvec);
+	} while (nr_pages);
+	}
 	spin_unlock_irq(&mapping->tree_lock);
 }
 EXPORT_SYMBOL(tag_pages_for_writeback);
-- 
1.6.4.2


      parent reply	other threads:[~2010-02-11 23:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 23:06 [RFC] [PATCH 0/3] Writeback livelock avoidance using page tags (v2) Jan Kara
2010-02-11 23:06 ` [PATCH 1/3] radix-tree: Implement function radix_tree_gang_tag_if_tagged Jan Kara
2010-02-15 16:01   ` Nick Piggin
2010-02-11 23:06 ` [PATCH 2/3] mm: Implement writeback livelock avoidance using page tagging Jan Kara
2010-02-12 19:39   ` Andrew Morton
2010-02-15 15:47     ` Jan Kara
2010-02-15 16:21       ` Nick Piggin
2010-02-15 16:24         ` Christoph Hellwig
2010-02-15 16:37           ` Nick Piggin
2010-02-15 19:57         ` Jan Kara
2010-02-16 14:19           ` Nick Piggin
2010-02-11 23:06 ` Jan Kara [this message]

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=1265929584-5080-4-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    /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