qubes-linux-kernel/patches.xen/xen-swiotlb-heuristics

33 lines
1.1 KiB
Plaintext
Raw Normal View History

From: jbeulich@novell.com
Subject: adjust Xen's swiotlb default size setting
Patch-mainline: obsolete
2011-04-19 20:09:59 +00:00
--- head-2010-08-24.orig/lib/swiotlb-xen.c 2010-08-24 16:49:11.000000000 +0200
+++ head-2010-08-24/lib/swiotlb-xen.c 2010-08-25 14:41:33.000000000 +0200
@@ -228,8 +228,8 @@ swiotlb_init_with_default_size(size_t de
void __init
swiotlb_init(int verbose)
{
- long ram_end;
- size_t defsz = 64 * (1 << 20); /* 64MB default size */
+ unsigned long ram_end;
+ size_t defsz = 64 << 20; /* 64MB default size */
if (swiotlb_force == 1) {
swiotlb = 1;
2011-04-19 20:09:59 +00:00
@@ -238,8 +238,12 @@ swiotlb_init(int verbose)
is_initial_xendomain()) {
/* Domain 0 always has a swiotlb. */
ram_end = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
- if (ram_end <= 0x7ffff)
- defsz = 2 * (1 << 20); /* 2MB on <2GB on systems. */
+ if (ram_end <= 0x1ffff)
+ defsz = 2 << 20; /* 2MB on <512MB systems. */
+ else if (ram_end <= 0x3ffff)
+ defsz = 4 << 20; /* 4MB on <1GB systems. */
+ else if (ram_end <= 0x7ffff)
+ defsz = 8 << 20; /* 8MB on <2GB systems. */
swiotlb = 1;
}