aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@novell.com>2010-10-26 17:22:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-26 19:52:13 -0400
commit3ecb01df3261d3b1f02ccfcf8384e2a255d2a1d0 (patch)
tree1fe91114d8829a511db48d757c787cfede3b929c /kernel/power
parentb6472776816af1ed52848c93d26e3edb3b17adab (diff)
use clear_page()/copy_page() in favor of memset()/memcpy() on whole pages
After all that's what they are intended for. Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Miklos Szeredi <miklos@szeredi.hu> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: "Rafael J. Wysocki" <rjw@sisk.pl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/snapshot.c14
-rw-r--r--kernel/power/swap.c6
2 files changed, 10 insertions, 10 deletions
diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c
index 9e3581f4619a..0dac75ea4456 100644
--- a/kernel/power/snapshot.c
+++ b/kernel/power/snapshot.c
@@ -993,7 +993,7 @@ static void copy_data_page(unsigned long dst_pfn, unsigned long src_pfn)
993 */ 993 */
994 safe_copy_page(buffer, s_page); 994 safe_copy_page(buffer, s_page);
995 dst = kmap_atomic(d_page, KM_USER0); 995 dst = kmap_atomic(d_page, KM_USER0);
996 memcpy(dst, buffer, PAGE_SIZE); 996 copy_page(dst, buffer);
997 kunmap_atomic(dst, KM_USER0); 997 kunmap_atomic(dst, KM_USER0);
998 } else { 998 } else {
999 safe_copy_page(page_address(d_page), s_page); 999 safe_copy_page(page_address(d_page), s_page);
@@ -1687,7 +1687,7 @@ int snapshot_read_next(struct snapshot_handle *handle)
1687 memory_bm_position_reset(&orig_bm); 1687 memory_bm_position_reset(&orig_bm);
1688 memory_bm_position_reset(&copy_bm); 1688 memory_bm_position_reset(&copy_bm);
1689 } else if (handle->cur <= nr_meta_pages) { 1689 } else if (handle->cur <= nr_meta_pages) {
1690 memset(buffer, 0, PAGE_SIZE); 1690 clear_page(buffer);
1691 pack_pfns(buffer, &orig_bm); 1691 pack_pfns(buffer, &orig_bm);
1692 } else { 1692 } else {
1693 struct page *page; 1693 struct page *page;
@@ -1701,7 +1701,7 @@ int snapshot_read_next(struct snapshot_handle *handle)
1701 void *kaddr; 1701 void *kaddr;
1702 1702
1703 kaddr = kmap_atomic(page, KM_USER0); 1703 kaddr = kmap_atomic(page, KM_USER0);
1704 memcpy(buffer, kaddr, PAGE_SIZE); 1704 copy_page(buffer, kaddr);
1705 kunmap_atomic(kaddr, KM_USER0); 1705 kunmap_atomic(kaddr, KM_USER0);
1706 handle->buffer = buffer; 1706 handle->buffer = buffer;
1707 } else { 1707 } else {
@@ -1984,7 +1984,7 @@ static void copy_last_highmem_page(void)
1984 void *dst; 1984 void *dst;
1985 1985
1986 dst = kmap_atomic(last_highmem_page, KM_USER0); 1986 dst = kmap_atomic(last_highmem_page, KM_USER0);
1987 memcpy(dst, buffer, PAGE_SIZE); 1987 copy_page(dst, buffer);
1988 kunmap_atomic(dst, KM_USER0); 1988 kunmap_atomic(dst, KM_USER0);
1989 last_highmem_page = NULL; 1989 last_highmem_page = NULL;
1990 } 1990 }
@@ -2270,9 +2270,9 @@ swap_two_pages_data(struct page *p1, struct page *p2, void *buf)
2270 2270
2271 kaddr1 = kmap_atomic(p1, KM_USER0); 2271 kaddr1 = kmap_atomic(p1, KM_USER0);
2272 kaddr2 = kmap_atomic(p2, KM_USER1); 2272 kaddr2 = kmap_atomic(p2, KM_USER1);
2273 memcpy(buf, kaddr1, PAGE_SIZE); 2273 copy_page(buf, kaddr1);
2274 memcpy(kaddr1, kaddr2, PAGE_SIZE); 2274 copy_page(kaddr1, kaddr2);
2275 memcpy(kaddr2, buf, PAGE_SIZE); 2275 copy_page(kaddr2, buf);
2276 kunmap_atomic(kaddr2, KM_USER1); 2276 kunmap_atomic(kaddr2, KM_USER1);
2277 kunmap_atomic(kaddr1, KM_USER0); 2277 kunmap_atomic(kaddr1, KM_USER0);
2278} 2278}
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 916eaa790399..a0e4a86ccf94 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -251,7 +251,7 @@ static int write_page(void *buf, sector_t offset, struct bio **bio_chain)
251 if (bio_chain) { 251 if (bio_chain) {
252 src = (void *)__get_free_page(__GFP_WAIT | __GFP_HIGH); 252 src = (void *)__get_free_page(__GFP_WAIT | __GFP_HIGH);
253 if (src) { 253 if (src) {
254 memcpy(src, buf, PAGE_SIZE); 254 copy_page(src, buf);
255 } else { 255 } else {
256 WARN_ON_ONCE(1); 256 WARN_ON_ONCE(1);
257 bio_chain = NULL; /* Go synchronous */ 257 bio_chain = NULL; /* Go synchronous */
@@ -325,7 +325,7 @@ static int swap_write_page(struct swap_map_handle *handle, void *buf,
325 error = write_page(handle->cur, handle->cur_swap, NULL); 325 error = write_page(handle->cur, handle->cur_swap, NULL);
326 if (error) 326 if (error)
327 goto out; 327 goto out;
328 memset(handle->cur, 0, PAGE_SIZE); 328 clear_page(handle->cur);
329 handle->cur_swap = offset; 329 handle->cur_swap = offset;
330 handle->k = 0; 330 handle->k = 0;
331 } 331 }
@@ -910,7 +910,7 @@ int swsusp_check(void)
910 hib_resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ); 910 hib_resume_bdev = open_by_devnum(swsusp_resume_device, FMODE_READ);
911 if (!IS_ERR(hib_resume_bdev)) { 911 if (!IS_ERR(hib_resume_bdev)) {
912 set_blocksize(hib_resume_bdev, PAGE_SIZE); 912 set_blocksize(hib_resume_bdev, PAGE_SIZE);
913 memset(swsusp_header, 0, PAGE_SIZE); 913 clear_page(swsusp_header);
914 error = hib_bio_read_page(swsusp_resume_block, 914 error = hib_bio_read_page(swsusp_resume_block,
915 swsusp_header, NULL); 915 swsusp_header, NULL);
916 if (error) 916 if (error)