From: Peter Zijlstra <a.p.zijlstra@chello.nl> To: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org>, Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>, "H. Peter Anvin" <hpa@zytor.com>, Russell King <rmk@arm.linux.org.uk>, David Howells <dhowells@redhat.com>, Ralf Baechle <ralf@linux-mips.org>, David Miller <davem@davemloft.net>, Paul Mackerras <paulus@samba.org>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Hugh Dickins <hughd@google.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Peter Zijlstra <a.p.zijlstra@chello.nl> Subject: [RFC][PATCH 1/6] mm: strictly nested kmap_atomic Date: Thu, 19 Aug 2010 22:13:18 +0200 [thread overview] Message-ID: <20100819202753.595997973@chello.nl> (raw) In-Reply-To: 20100819201317.673172547@chello.nl [-- Attachment #1: kmap-2.patch --] [-- Type: text/plain, Size: 3691 bytes --] Ensure kmap_atomic usage is strictly nested Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> --- crypto/async_tx/async_memcpy.c | 2 +- crypto/blkcipher.c | 2 +- drivers/block/loop.c | 4 ++-- include/linux/highmem.h | 4 ++-- kernel/power/snapshot.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) Index: linux-2.6/crypto/async_tx/async_memcpy.c =================================================================== --- linux-2.6.orig/crypto/async_tx/async_memcpy.c +++ linux-2.6/crypto/async_tx/async_memcpy.c @@ -83,8 +83,8 @@ async_memcpy(struct page *dest, struct p memcpy(dest_buf, src_buf, len); - kunmap_atomic(dest_buf, KM_USER0); kunmap_atomic(src_buf, KM_USER1); + kunmap_atomic(dest_buf, KM_USER0); async_tx_sync_epilog(submit); } Index: linux-2.6/crypto/blkcipher.c =================================================================== --- linux-2.6.orig/crypto/blkcipher.c +++ linux-2.6/crypto/blkcipher.c @@ -89,9 +89,9 @@ static inline unsigned int blkcipher_don memcpy(walk->dst.virt.addr, walk->page, n); blkcipher_unmap_dst(walk); } else if (!(walk->flags & BLKCIPHER_WALK_PHYS)) { - blkcipher_unmap_src(walk); if (walk->flags & BLKCIPHER_WALK_DIFF) blkcipher_unmap_dst(walk); + blkcipher_unmap_src(walk); } scatterwalk_advance(&walk->in, n); Index: linux-2.6/drivers/block/loop.c =================================================================== --- linux-2.6.orig/drivers/block/loop.c +++ linux-2.6/drivers/block/loop.c @@ -99,8 +99,8 @@ static int transfer_none(struct loop_dev else memcpy(raw_buf, loop_buf, size); - kunmap_atomic(raw_buf, KM_USER0); kunmap_atomic(loop_buf, KM_USER1); + kunmap_atomic(raw_buf, KM_USER0); cond_resched(); return 0; } @@ -128,8 +128,8 @@ static int transfer_xor(struct loop_devi for (i = 0; i < size; i++) *out++ = *in++ ^ key[(i & 511) % keysize]; - kunmap_atomic(raw_buf, KM_USER0); kunmap_atomic(loop_buf, KM_USER1); + kunmap_atomic(raw_buf, KM_USER0); cond_resched(); return 0; } Index: linux-2.6/include/linux/highmem.h =================================================================== --- linux-2.6.orig/include/linux/highmem.h +++ linux-2.6/include/linux/highmem.h @@ -191,8 +191,8 @@ static inline void copy_user_highpage(st vfrom = kmap_atomic(from, KM_USER0); vto = kmap_atomic(to, KM_USER1); copy_user_page(vto, vfrom, vaddr, to); - kunmap_atomic(vfrom, KM_USER0); kunmap_atomic(vto, KM_USER1); + kunmap_atomic(vfrom, KM_USER0); } #endif @@ -204,8 +204,8 @@ static inline void copy_highpage(struct vfrom = kmap_atomic(from, KM_USER0); vto = kmap_atomic(to, KM_USER1); copy_page(vto, vfrom); - kunmap_atomic(vfrom, KM_USER0); kunmap_atomic(vto, KM_USER1); + kunmap_atomic(vfrom, KM_USER0); } #endif /* _LINUX_HIGHMEM_H */ Index: linux-2.6/kernel/power/snapshot.c =================================================================== --- linux-2.6.orig/kernel/power/snapshot.c +++ linux-2.6/kernel/power/snapshot.c @@ -978,8 +978,8 @@ static void copy_data_page(unsigned long src = kmap_atomic(s_page, KM_USER0); dst = kmap_atomic(d_page, KM_USER1); do_copy_page(dst, src); - kunmap_atomic(src, KM_USER0); kunmap_atomic(dst, KM_USER1); + kunmap_atomic(src, KM_USER0); } else { if (PageHighMem(d_page)) { /* Page pointed to by src may contain some kernel @@ -2253,8 +2253,8 @@ swap_two_pages_data(struct page *p1, str memcpy(buf, kaddr1, PAGE_SIZE); memcpy(kaddr1, kaddr2, PAGE_SIZE); memcpy(kaddr2, buf, PAGE_SIZE); - kunmap_atomic(kaddr1, KM_USER0); kunmap_atomic(kaddr2, KM_USER1); + kunmap_atomic(kaddr1, KM_USER0); } /**
WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <a.p.zijlstra@chello.nl> To: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org>, Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>, "H. Peter Anvin" <hpa@zytor.com>, Russell King <rmk@arm.linux.org.uk>, David Howells <dhowells@redhat.com>, Ralf Baechle <ralf@linux-mips.org>, David Miller <davem@davemloft.net>, Paul Mackerras <paulus@samba.org>, Benjamin Herrenschmidt <benh@kernel.crashing.org>, Hugh Dickins <hughd@google.com>, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, Peter Zijlstra <a.p.zijlstra@chello.nl> Subject: [RFC][PATCH 1/6] mm: strictly nested kmap_atomic Date: Thu, 19 Aug 2010 22:13:18 +0200 [thread overview] Message-ID: <20100819202753.595997973@chello.nl> (raw) In-Reply-To: 20100819201317.673172547@chello.nl [-- Attachment #1: kmap-2.patch --] [-- Type: text/plain, Size: 3916 bytes --] Ensure kmap_atomic usage is strictly nested Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl> --- crypto/async_tx/async_memcpy.c | 2 +- crypto/blkcipher.c | 2 +- drivers/block/loop.c | 4 ++-- include/linux/highmem.h | 4 ++-- kernel/power/snapshot.c | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) Index: linux-2.6/crypto/async_tx/async_memcpy.c =================================================================== --- linux-2.6.orig/crypto/async_tx/async_memcpy.c +++ linux-2.6/crypto/async_tx/async_memcpy.c @@ -83,8 +83,8 @@ async_memcpy(struct page *dest, struct p memcpy(dest_buf, src_buf, len); - kunmap_atomic(dest_buf, KM_USER0); kunmap_atomic(src_buf, KM_USER1); + kunmap_atomic(dest_buf, KM_USER0); async_tx_sync_epilog(submit); } Index: linux-2.6/crypto/blkcipher.c =================================================================== --- linux-2.6.orig/crypto/blkcipher.c +++ linux-2.6/crypto/blkcipher.c @@ -89,9 +89,9 @@ static inline unsigned int blkcipher_don memcpy(walk->dst.virt.addr, walk->page, n); blkcipher_unmap_dst(walk); } else if (!(walk->flags & BLKCIPHER_WALK_PHYS)) { - blkcipher_unmap_src(walk); if (walk->flags & BLKCIPHER_WALK_DIFF) blkcipher_unmap_dst(walk); + blkcipher_unmap_src(walk); } scatterwalk_advance(&walk->in, n); Index: linux-2.6/drivers/block/loop.c =================================================================== --- linux-2.6.orig/drivers/block/loop.c +++ linux-2.6/drivers/block/loop.c @@ -99,8 +99,8 @@ static int transfer_none(struct loop_dev else memcpy(raw_buf, loop_buf, size); - kunmap_atomic(raw_buf, KM_USER0); kunmap_atomic(loop_buf, KM_USER1); + kunmap_atomic(raw_buf, KM_USER0); cond_resched(); return 0; } @@ -128,8 +128,8 @@ static int transfer_xor(struct loop_devi for (i = 0; i < size; i++) *out++ = *in++ ^ key[(i & 511) % keysize]; - kunmap_atomic(raw_buf, KM_USER0); kunmap_atomic(loop_buf, KM_USER1); + kunmap_atomic(raw_buf, KM_USER0); cond_resched(); return 0; } Index: linux-2.6/include/linux/highmem.h =================================================================== --- linux-2.6.orig/include/linux/highmem.h +++ linux-2.6/include/linux/highmem.h @@ -191,8 +191,8 @@ static inline void copy_user_highpage(st vfrom = kmap_atomic(from, KM_USER0); vto = kmap_atomic(to, KM_USER1); copy_user_page(vto, vfrom, vaddr, to); - kunmap_atomic(vfrom, KM_USER0); kunmap_atomic(vto, KM_USER1); + kunmap_atomic(vfrom, KM_USER0); } #endif @@ -204,8 +204,8 @@ static inline void copy_highpage(struct vfrom = kmap_atomic(from, KM_USER0); vto = kmap_atomic(to, KM_USER1); copy_page(vto, vfrom); - kunmap_atomic(vfrom, KM_USER0); kunmap_atomic(vto, KM_USER1); + kunmap_atomic(vfrom, KM_USER0); } #endif /* _LINUX_HIGHMEM_H */ Index: linux-2.6/kernel/power/snapshot.c =================================================================== --- linux-2.6.orig/kernel/power/snapshot.c +++ linux-2.6/kernel/power/snapshot.c @@ -978,8 +978,8 @@ static void copy_data_page(unsigned long src = kmap_atomic(s_page, KM_USER0); dst = kmap_atomic(d_page, KM_USER1); do_copy_page(dst, src); - kunmap_atomic(src, KM_USER0); kunmap_atomic(dst, KM_USER1); + kunmap_atomic(src, KM_USER0); } else { if (PageHighMem(d_page)) { /* Page pointed to by src may contain some kernel @@ -2253,8 +2253,8 @@ swap_two_pages_data(struct page *p1, str memcpy(buf, kaddr1, PAGE_SIZE); memcpy(kaddr1, kaddr2, PAGE_SIZE); memcpy(kaddr2, buf, PAGE_SIZE); - kunmap_atomic(kaddr1, KM_USER0); kunmap_atomic(kaddr2, KM_USER1); + kunmap_atomic(kaddr1, KM_USER0); } /** -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-08-19 20:31 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-08-19 20:13 [RFC][PATCH 0/6] mm, highmem: kmap_atomic rework Peter Zijlstra 2010-08-19 20:13 ` Peter Zijlstra 2010-08-19 20:13 ` Peter Zijlstra [this message] 2010-08-19 20:13 ` [RFC][PATCH 1/6] mm: strictly nested kmap_atomic Peter Zijlstra 2010-08-20 20:50 ` Rik van Riel 2010-08-20 20:50 ` Rik van Riel 2010-08-24 7:09 ` KAMEZAWA Hiroyuki 2010-08-24 7:09 ` KAMEZAWA Hiroyuki 2010-08-19 20:13 ` [RFC][PATCH 2/6] mm: stack based kmap_atomic Peter Zijlstra 2010-08-19 20:13 ` Peter Zijlstra 2010-08-20 21:34 ` Rik van Riel 2010-08-20 21:34 ` Rik van Riel 2010-08-24 7:24 ` KAMEZAWA Hiroyuki 2010-08-24 7:24 ` KAMEZAWA Hiroyuki 2010-08-24 7:35 ` KAMEZAWA Hiroyuki 2010-08-24 8:04 ` Peter Zijlstra 2010-08-19 20:13 ` [RFC][PATCH 3/6] mm, frv: Out-of-line kmap-atomic Peter Zijlstra 2010-08-19 20:13 ` Peter Zijlstra 2010-08-20 21:48 ` Rik van Riel 2010-08-20 21:48 ` Rik van Riel 2010-08-19 20:13 ` [RFC][PATCH 4/6] mm: Remove all KM_type arguments Peter Zijlstra 2010-08-19 20:13 ` Peter Zijlstra 2010-08-20 21:44 ` Rik van Riel 2010-08-20 21:44 ` Rik van Riel 2010-08-19 20:13 ` [RFC][PATCH 5/6] mm: Fix up KM_type argument removal fallout Peter Zijlstra 2010-08-19 20:13 ` Peter Zijlstra 2010-08-20 21:45 ` Rik van Riel 2010-08-20 21:45 ` Rik van Riel 2010-08-19 20:13 ` [RFC][PATCH 6/6] mm: Remove pte_*map_nested() Peter Zijlstra 2010-08-19 20:13 ` Peter Zijlstra 2010-08-20 21:47 ` Rik van Riel 2010-08-20 21:47 ` Rik van Riel 2010-08-19 21:31 ` [RFC][PATCH 0/6] mm, highmem: kmap_atomic rework Andrew Morton 2010-08-19 21:31 ` Andrew Morton 2010-08-20 14:38 ` Peter Zijlstra 2010-08-20 14:38 ` Peter Zijlstra
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20100819202753.595997973@chello.nl \ --to=a.p.zijlstra@chello.nl \ --cc=akpm@linux-foundation.org \ --cc=benh@kernel.crashing.org \ --cc=davem@davemloft.net \ --cc=dhowells@redhat.com \ --cc=hpa@zytor.com \ --cc=hughd@google.com \ --cc=linux-arch@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-mm@kvack.org \ --cc=mingo@elte.hu \ --cc=paulus@samba.org \ --cc=ralf@linux-mips.org \ --cc=rmk@arm.linux.org.uk \ --cc=tglx@linutronix.de \ --cc=torvalds@linux-foundation.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.