Skip to contentSkip to conversation

x86: copy_oldmem_page using cached addressing

PATCH Applied Cliff Wickman 4 participants 5 messages Sep 8, 2010 – Sep 9, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: copy_oldmem_page using cached addressing

From: Cliff Wickman <[email protected]>

The copy of /proc/vmcore to a user buffer proceeds much faster if the kernel addresses memory as cached.

With this patch we have seen an increase in transfer rate from less than 15MB/s to 80-460MB/s, depending on size of the transfer. This makes a big difference in time needed to save a system dump.

(Does anyone know of a reason why copy_oldmem_page() would need
to use uncached addresses?)

Diffed against 2.6.36-rc3

---
 arch/x86/kernel/crash_dump_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/crash_dump_64.c +1 -1
Index: linus.current/arch/x86/kernel/crash_dump_64.c
===================================================================
@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long p
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
 	if (!vaddr)
 		return -ENOMEM;
 
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Cliff Wickman

From: Cliff Wickman <[email protected]>

The copy of /proc/vmcore to a user buffer proceeds much faster if the kernel addresses memory as cached.

Quoted 8 lines

With this patch we have seen an increase in transfer rate from less than 15MB/s to 80-460MB/s, depending on size of the transfer. This makes a big difference in time needed to save a system dump.

(Does anyone know of a reason why copy_oldmem_page() would need
to use uncached addresses?)

Diffed against 2.6.36-rc3

I believe this code simply predates being able to specify the caching attributes at ioremap time. Being cached in this case actually looks more correct, as that is the default for RAM and we are talking about RAM.

Ultimately either there is another cpu running wild with these pages mapped with some random set of attributes, and we cannot get the permissions right or we have captured all of the cpus and this is the only mapping so it doesn't matter.

Quoted 24 lines
---
 arch/x86/kernel/crash_dump_64.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linus.current/arch/x86/kernel/crash_dump_64.c
===================================================================

arch/x86/kernel/crash_dump_64.c +1 -1
@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long p
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
 	if (!vaddr)
 		return -ENOMEM;
 

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

Applied
#2 lore raw
Quoted 21 lines · Eric W. Biederman
Quoted 5 lines · Cliff Wickman

From: Cliff Wickman <[email protected]>

The copy of /proc/vmcore to a user buffer proceeds much faster if the kernel addresses memory as cached.

Quoted 8 lines

With this patch we have seen an increase in transfer rate from less than 15MB/s to 80-460MB/s, depending on size of the transfer. This makes a big difference in time needed to save a system dump.

(Does anyone know of a reason why copy_oldmem_page() would need
to use uncached addresses?)

Diffed against 2.6.36-rc3

I believe this code simply predates being able to specify the caching attributes at ioremap time. Being cached in this case actually looks more correct, as that is the default for RAM and we are talking about RAM.

Quoted 6 lines

Ultimately either there is another cpu running wild with these pages mapped with some random set of attributes, and we cannot get the permissions right or we have captured all of the cpus and this is the only mapping so it doesn't matter.

Applied, thanks guys. Note, i also added a -stable tag, as kdump is typically used with enterprise setups and we want this (low-risk, high-impact) improvement to be propagated far back the -stable series.

Thanks,

Ingo

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec

#3 lore raw
In reply to Cliff Wickman
Quoted 5 lines · Cliff Wickman

From: Cliff Wickman <cpw-sJ/[email protected]>

The copy of /proc/vmcore to a user buffer proceeds much faster if the kernel addresses memory as cached.

Quoted 8 lines

With this patch we have seen an increase in transfer rate from less than 15MB/s to 80-460MB/s, depending on size of the transfer. This makes a big difference in time needed to save a system dump.

(Does anyone know of a reason why copy_oldmem_page() would need
to use uncached addresses?)

Diffed against 2.6.36-rc3

I had a similar patch somewhere in my private kernels, yes it's a big win. I think it was simply a bug that was added when ioremap was changed to default to uncached.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#4 lore raw

[tip:x86/mm] x86, kdump: Change copy_oldmem_page() to use cached addressing

In reply to Cliff Wickman
Commit-ID:  37a2f9f30a360fb03522d15c85c78265ccd80287
Gitweb:     http://git.kernel.org/tip/37a2f9f30a360fb03522d15c85c78265ccd80287
Author:     Cliff Wickman <[email protected]>
AuthorDate: Wed, 8 Sep 2010 10:14:27 -0500
Committer:  Ingo Molnar <[email protected]>
CommitDate: Thu, 9 Sep 2010 09:46:23 +0200

x86, kdump: Change copy_oldmem_page() to use cached addressing

The copy of /proc/vmcore to a user buffer proceeds much faster if the kernel addresses memory as cached.

With this patch we have seen an increase in transfer rate from less than 15MB/s to 80-460MB/s, depending on size of the transfer. This makes a big difference in time needed to save a system dump.

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/crash_dump_64.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/crash_dump_64.c +1 -1
index 045b36c..bf43188 100644
@@ -34,7 +34,7 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
 	if (!csize)
 		return 0;
 
-	vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
+	vaddr = ioremap_cache(pfn << PAGE_SHIFT, PAGE_SIZE);
 	if (!vaddr)
 		return -ENOMEM;