From: clameter@sgi.com
To: linux-mm@kvack.org
Cc: Mel Gorman <mel@skynet.ie>,
William Lee Irwin III <wli@holomorphy.com>,
Adam Litke <aglitke@gmail.com>, David Chinner <dgc@sgi.com>,
Jens Axboe <jens.axboe@oracle.com>, Avi Kivity <avi@argo.co.il>,
Dave Hansen <hansendc@us.ibm.com>,
Badari Pulavarty <pbadari@gmail.com>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [RFC 06/16] Variable Page Cache: Add VM_BUG_ONs to check for correct page order
Date: Sun, 22 Apr 2007 23:21:13 -0700 [thread overview]
Message-ID: <20070423062129.967621050@sgi.com> (raw)
In-Reply-To: <20070423062107.843307112@sgi.com>
[-- Attachment #1: var_pc_guards --]
[-- Type: text/plain, Size: 3583 bytes --]
Before we start changing the page order we better get some debugging
in there that trips us up whenever a wrong order page shows up in a
mapping. This will be helpful for converting new filesystems to
utilize higher orders.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
mm/filemap.c | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
Index: linux-2.6.21-rc7/mm/filemap.c
===================================================================
--- linux-2.6.21-rc7.orig/mm/filemap.c 2007-04-22 21:54:00.000000000 -0700
+++ linux-2.6.21-rc7/mm/filemap.c 2007-04-22 21:59:15.000000000 -0700
@@ -127,6 +127,7 @@ void remove_from_page_cache(struct page
struct address_space *mapping = page->mapping;
BUG_ON(!PageLocked(page));
+ VM_BUG_ON(mapping->order != compound_order(page));
write_lock_irq(&mapping->tree_lock);
__remove_from_page_cache(page);
@@ -268,6 +269,7 @@ int wait_on_page_writeback_range(struct
if (page->index > end)
continue;
+ VM_BUG_ON(mapping->order != compound_order(page));
wait_on_page_writeback(page);
if (PageError(page))
ret = -EIO;
@@ -439,6 +441,7 @@ int add_to_page_cache(struct page *page,
{
int error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
+ VM_BUG_ON(mapping->order != compound_order(page));
if (error == 0) {
write_lock_irq(&mapping->tree_lock);
error = radix_tree_insert(&mapping->page_tree, offset, page);
@@ -598,8 +601,10 @@ struct page * find_get_page(struct addre
read_lock_irq(&mapping->tree_lock);
page = radix_tree_lookup(&mapping->page_tree, offset);
- if (page)
+ if (page) {
+ VM_BUG_ON(mapping->order != compound_order(page));
page_cache_get(page);
+ }
read_unlock_irq(&mapping->tree_lock);
return page;
}
@@ -624,6 +629,7 @@ struct page *find_lock_page(struct addre
repeat:
page = radix_tree_lookup(&mapping->page_tree, offset);
if (page) {
+ VM_BUG_ON(mapping->order != compound_order(page));
page_cache_get(page);
if (TestSetPageLocked(page)) {
read_unlock_irq(&mapping->tree_lock);
@@ -683,6 +689,7 @@ repeat:
} else if (err == -EEXIST)
goto repeat;
}
+ VM_BUG_ON(mapping->order != compound_order(page));
if (cached_page)
page_cache_release(cached_page);
return page;
@@ -714,8 +721,10 @@ unsigned find_get_pages(struct address_s
read_lock_irq(&mapping->tree_lock);
ret = radix_tree_gang_lookup(&mapping->page_tree,
(void **)pages, start, nr_pages);
- for (i = 0; i < ret; i++)
+ for (i = 0; i < ret; i++) {
+ VM_BUG_ON(mapping->order != compound_order(pages[i]));
page_cache_get(pages[i]);
+ }
read_unlock_irq(&mapping->tree_lock);
return ret;
}
@@ -745,6 +754,7 @@ unsigned find_get_pages_contig(struct ad
if (pages[i]->mapping == NULL || pages[i]->index != index)
break;
+ VM_BUG_ON(mapping->order != compound_order(pages[i]));
page_cache_get(pages[i]);
index++;
}
@@ -772,8 +782,10 @@ unsigned find_get_pages_tag(struct addre
read_lock_irq(&mapping->tree_lock);
ret = radix_tree_gang_lookup_tag(&mapping->page_tree,
(void **)pages, *index, nr_pages, tag);
- for (i = 0; i < ret; i++)
+ for (i = 0; i < ret; i++) {
+ VM_BUG_ON(mapping->order != compound_order(pages[i]));
page_cache_get(pages[i]);
+ }
if (ret)
*index = pages[ret - 1]->index + 1;
read_unlock_irq(&mapping->tree_lock);
@@ -2454,6 +2466,7 @@ int try_to_release_page(struct page *pag
struct address_space * const mapping = page->mapping;
BUG_ON(!PageLocked(page));
+ VM_BUG_ON(mapping->order != compound_order(page));
if (PageWriteback(page))
return 0;
--
next prev parent reply other threads:[~2007-04-23 6:21 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-23 6:21 [RFC 00/16] Variable Order Page Cache Patchset V2 clameter
2007-04-23 6:21 ` [RFC 01/16] Free up page->private for compound pages clameter
2007-04-23 6:21 ` [RFC 02/16] vmstat.c: Support accounting " clameter
2007-04-23 6:21 ` [RFC 03/16] Variable Order Page Cache: Add order field in mapping clameter
2007-04-23 6:21 ` [RFC 04/16] Variable Order Page Cache: Add basic allocation functions clameter
2007-04-23 6:21 ` [RFC 05/16] Variable Order Page Cache: Add functions to establish sizes clameter
2007-04-23 6:21 ` clameter [this message]
2007-04-23 6:21 ` [RFC 07/16] Variable Order Page Cache: Add clearing and flushing function clameter
2007-04-23 6:21 ` [RFC 08/16] Variable Order Page Cache: Fixup fallback functions clameter
2007-04-23 6:21 ` [RFC 09/16] Variable Order Page Cache: Fix up mm/filemap.c clameter
2007-04-23 6:21 ` [RFC 10/16] Variable Order Page Cache: Readahead fixups clameter
2007-04-23 6:21 ` [RFC 11/16] Variable Page Cache Size: Fix up reclaim counters clameter
2007-04-23 6:21 ` [RFC 12/16] Variable Order Page Cache: Fix up the writeback logic clameter
2007-04-23 6:21 ` [RFC 13/16] Variable Order Page Cache: Fixed to block layer clameter
2007-04-23 6:21 ` [RFC 14/16] Variable Order Page Cache: Add support to ramfs clameter
2007-04-23 6:21 ` [RFC 15/16] ext2: Add variable page size support clameter
2007-04-23 6:21 ` [RFC 16/16] Variable Order Page Cache: Alternate implementation of page cache macros clameter
2007-04-23 6:48 [RFC 00/16] Variable Order Page Cache Patchset V2 Christoph Lameter
2007-04-23 6:49 ` [RFC 06/16] Variable Page Cache: Add VM_BUG_ONs to check for correct page order Christoph Lameter
2007-04-25 11:22 ` Mel Gorman
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=20070423062129.967621050@sgi.com \
--to=clameter@sgi.com \
--cc=aglitke@gmail.com \
--cc=avi@argo.co.il \
--cc=dgc@sgi.com \
--cc=hansendc@us.ibm.com \
--cc=jens.axboe@oracle.com \
--cc=linux-mm@kvack.org \
--cc=maximlevitsky@gmail.com \
--cc=mel@skynet.ie \
--cc=pbadari@gmail.com \
--cc=wli@holomorphy.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