aboutsummaryrefslogtreecommitdiffstats
path: root/mm/page_io.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2006-09-26 02:32:42 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-26 11:48:58 -0400
commitab954160350c91c77ae03740ef90458c3ad5412c (patch)
tree28f99d765c2c6d497a1f5543b1867875cd6102a5 /mm/page_io.c
parent3a4f7577c9ef393ca80c783f02ffbc125de771c7 (diff)
[PATCH] swsusp: write speedup
Switch the swsusp writeout code from 4k-at-a-time to 4MB-at-a-time. Crufty old PIII testbox: 12.9 MB/s -> 20.9 MB/s Sony Vaio: 14.7 MB/s -> 26.5 MB/s The implementation is crude. A better one would use larger BIOs, but wouldn't gain any performance. The memcpys will be mostly pipelined with the IO and basically come for free. The ENOMEM path has not been tested. It should be. Cc: Pavel Machek <pavel@ucw.cz> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/page_io.c')
-rw-r--r--mm/page_io.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/mm/page_io.c b/mm/page_io.c
index d2f0a5783370..f46a9862b7ef 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -156,10 +156,12 @@ out:
156 * We use end_swap_bio_read() even for writes, because it happens to do what 156 * We use end_swap_bio_read() even for writes, because it happens to do what
157 * we want. 157 * we want.
158 */ 158 */
159int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page) 159int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page,
160 struct bio **bio_chain)
160{ 161{
161 struct bio *bio; 162 struct bio *bio;
162 int ret = 0; 163 int ret = 0;
164 int bio_rw;
163 165
164 lock_page(page); 166 lock_page(page);
165 167
@@ -170,11 +172,22 @@ int rw_swap_page_sync(int rw, swp_entry_t entry, struct page *page)
170 goto out; 172 goto out;
171 } 173 }
172 174
173 submit_bio(rw | (1 << BIO_RW_SYNC), bio); 175 bio_rw = rw;
174 wait_on_page_locked(page); 176 if (!bio_chain)
175 177 bio_rw |= (1 << BIO_RW_SYNC);
176 if (!PageUptodate(page) || PageError(page)) 178 if (bio_chain)
177 ret = -EIO; 179 bio_get(bio);
180 submit_bio(bio_rw, bio);
181 if (bio_chain == NULL) {
182 wait_on_page_locked(page);
183
184 if (!PageUptodate(page) || PageError(page))
185 ret = -EIO;
186 }
187 if (bio_chain) {
188 bio->bi_private = *bio_chain;
189 *bio_chain = bio;
190 }
178out: 191out:
179 return ret; 192 return ret;
180} 193}