diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2008-04-28 05:12:38 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-28 11:58:20 -0400 |
commit | ac6aadb24b7d4f0e54246732e221c102073412bf (patch) | |
tree | 1936c3e847fca977b8c0d650416c66655f7633ad /mm | |
parent | f05111f50105ac479a008cf85749cf9c956453ea (diff) |
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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/filemap.c | 10 | ||||
-rw-r--r-- | mm/swap.c | 37 |
2 files changed, 18 insertions, 29 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 07e9d9258b48..239d36163bbe 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -576,10 +576,12 @@ EXPORT_SYMBOL(unlock_page); | |||
576 | */ | 576 | */ |
577 | void end_page_writeback(struct page *page) | 577 | void end_page_writeback(struct page *page) |
578 | { | 578 | { |
579 | if (!TestClearPageReclaim(page) || rotate_reclaimable_page(page)) { | 579 | if (TestClearPageReclaim(page)) |
580 | if (!test_clear_page_writeback(page)) | 580 | rotate_reclaimable_page(page); |
581 | BUG(); | 581 | |
582 | } | 582 | if (!test_clear_page_writeback(page)) |
583 | BUG(); | ||
584 | |||
583 | smp_mb__after_clear_bit(); | 585 | smp_mb__after_clear_bit(); |
584 | wake_up_page(page, PG_writeback); | 586 | wake_up_page(page, PG_writeback); |
585 | } | 587 | } |
@@ -132,34 +132,21 @@ static void pagevec_move_tail(struct pagevec *pvec) | |||
132 | * Writeback is about to end against a page which has been marked for immediate | 132 | * Writeback is about to end against a page which has been marked for immediate |
133 | * reclaim. If it still appears to be reclaimable, move it to the tail of the | 133 | * reclaim. If it still appears to be reclaimable, move it to the tail of the |
134 | * inactive list. | 134 | * inactive list. |
135 | * | ||
136 | * Returns zero if it cleared PG_writeback. | ||
137 | */ | 135 | */ |
138 | int rotate_reclaimable_page(struct page *page) | 136 | void rotate_reclaimable_page(struct page *page) |
139 | { | 137 | { |
140 | struct pagevec *pvec; | 138 | if (!PageLocked(page) && !PageDirty(page) && !PageActive(page) && |
141 | unsigned long flags; | 139 | PageLRU(page)) { |
142 | 140 | struct pagevec *pvec; | |
143 | if (PageLocked(page)) | 141 | unsigned long flags; |
144 | return 1; | ||
145 | if (PageDirty(page)) | ||
146 | return 1; | ||
147 | if (PageActive(page)) | ||
148 | return 1; | ||
149 | if (!PageLRU(page)) | ||
150 | return 1; | ||
151 | |||
152 | page_cache_get(page); | ||
153 | local_irq_save(flags); | ||
154 | pvec = &__get_cpu_var(lru_rotate_pvecs); | ||
155 | if (!pagevec_add(pvec, page)) | ||
156 | pagevec_move_tail(pvec); | ||
157 | local_irq_restore(flags); | ||
158 | |||
159 | if (!test_clear_page_writeback(page)) | ||
160 | BUG(); | ||
161 | 142 | ||
162 | return 0; | 143 | page_cache_get(page); |
144 | local_irq_save(flags); | ||
145 | pvec = &__get_cpu_var(lru_rotate_pvecs); | ||
146 | if (!pagevec_add(pvec, page)) | ||
147 | pagevec_move_tail(pvec); | ||
148 | local_irq_restore(flags); | ||
149 | } | ||
163 | } | 150 | } |
164 | 151 | ||
165 | /* | 152 | /* |