mm: rotate_reclaimable_page() cleanup

Clean up messy conditional calling of test_clear_page_writeback() from both
rotate_reclaimable_page() and end_page_writeback().

The only user of rotate_reclaimable_page() is end_page_writeback() so this is
OK.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Miklos Szeredi
2008-04-28 02:12:38 -07:00
committed by Linus Torvalds
parent f05111f501
commit ac6aadb24b
3 changed files with 19 additions and 30 deletions

View File

@@ -177,7 +177,7 @@ extern void activate_page(struct page *);
extern void mark_page_accessed(struct page *); extern void mark_page_accessed(struct page *);
extern void lru_add_drain(void); extern void lru_add_drain(void);
extern int lru_add_drain_all(void); extern int lru_add_drain_all(void);
extern int rotate_reclaimable_page(struct page *page); extern void rotate_reclaimable_page(struct page *page);
extern void swap_setup(void); extern void swap_setup(void);
/* linux/mm/vmscan.c */ /* linux/mm/vmscan.c */

View File

@@ -576,10 +576,12 @@ EXPORT_SYMBOL(unlock_page);
*/ */
void end_page_writeback(struct page *page) void end_page_writeback(struct page *page)
{ {
if (!TestClearPageReclaim(page) || rotate_reclaimable_page(page)) { if (TestClearPageReclaim(page))
if (!test_clear_page_writeback(page)) rotate_reclaimable_page(page);
BUG();
} if (!test_clear_page_writeback(page))
BUG();
smp_mb__after_clear_bit(); smp_mb__after_clear_bit();
wake_up_page(page, PG_writeback); wake_up_page(page, PG_writeback);
} }

View File

@@ -132,34 +132,21 @@ static void pagevec_move_tail(struct pagevec *pvec)
* Writeback is about to end against a page which has been marked for immediate * Writeback is about to end against a page which has been marked for immediate
* reclaim. If it still appears to be reclaimable, move it to the tail of the * reclaim. If it still appears to be reclaimable, move it to the tail of the
* inactive list. * inactive list.
*
* Returns zero if it cleared PG_writeback.
*/ */
int rotate_reclaimable_page(struct page *page) void rotate_reclaimable_page(struct page *page)
{ {
struct pagevec *pvec; if (!PageLocked(page) && !PageDirty(page) && !PageActive(page) &&
unsigned long flags; PageLRU(page)) {
struct pagevec *pvec;
unsigned long flags;
if (PageLocked(page)) page_cache_get(page);
return 1; local_irq_save(flags);
if (PageDirty(page)) pvec = &__get_cpu_var(lru_rotate_pvecs);
return 1; if (!pagevec_add(pvec, page))
if (PageActive(page)) pagevec_move_tail(pvec);
return 1; local_irq_restore(flags);
if (!PageLRU(page)) }
return 1;
page_cache_get(page);
local_irq_save(flags);
pvec = &__get_cpu_var(lru_rotate_pvecs);
if (!pagevec_add(pvec, page))
pagevec_move_tail(pvec);
local_irq_restore(flags);
if (!test_clear_page_writeback(page))
BUG();
return 0;
} }
/* /*