[RFC 5/9] Save irqflags on taking the mapping lock

Christoph Lameter
2007-08-14T15:36:31Z

[-- Attachment #1: vmscan_mapping_irqsave --]
[-- Type: text/plain, Size: 1403 bytes --]

Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
mm/vmscan.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)

Index: linux-2.6/mm/vmscan.c
===================================================================
--- linux-2.6.orig/mm/vmscan.c 2007-08-14 07:34:55.000000000 -0700
+++ linux-2.6/mm/vmscan.c 2007-08-14 08:21:58.000000000 -0700
@@ -381,10 +381,12 @@ static pageout_t pageout(struct page *pa
*/
int remove_mapping(struct address_space *mapping, struct page *page)
{
+ unsigned long flags;
+
BUG_ON(!PageLocked(page));
BUG_ON(mapping != page_mapping(page));

- write_lock_irq(&mapping->tree_lock);
+ write_lock_irqsave(&mapping->tree_lock, flags);
/*
* The non racy check for a busy page.
*
@@ -419,19 +421,19 @@ int remove_mapping(struct address_space
if (PageSwapCache(page)) {
swp_entry_t swap = { .val = page_private(page) };
__delete_from_swap_cache(page);
- write_unlock_irq(&mapping->tree_lock);
+ write_unlock_irqrestore(&mapping->tree_lock, flags);
swap_free(swap);
__put_page(page); /* The pagecache ref */
return 1;
}

__remove_from_page_cache(page);
- write_unlock_irq(&mapping->tree_lock);
+ write_unlock_irqrestore(&mapping->tree_lock, flags);
__put_page(page);
return 1;

cannot_free:
- write_unlock_irq(&mapping->tree_lock);
+ write_unlock_irqrestore(&mapping->tree_lock, flags);
return 0;
}

--