Skip to contentSkip to conversation

linux: don't round up swiotlb slab count

PATCH New Jan Beulich 1 participant 1 message Aug 29, 2008 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux: don't round up swiotlb slab count

This has been unnecessary for a long time, as xen_create_contiguous_region() is no longer called on the whole area at once, and the rounding can (under certain circumstances) prevent the kernel from successfully booting when a larger than the default size is needed.

As usual, written and tested on 2.6.27-rc4 and made apply to the 2.6.18 tree without further testing.

lib/swiotlb-xen.c +0 -6
Index: head-2008-08-22/lib/swiotlb-xen.c
===================================================================
@@ -114,9 +114,6 @@ setup_io_tlb_npages(char *str)
 		iotlb_nslabs = simple_strtoul(str, &str, 0) <<
 			(20 - IO_TLB_SHIFT);
 		iotlb_nslabs = ALIGN(iotlb_nslabs, IO_TLB_SEGSIZE);
-		/* Round up to power of two (xen_create_contiguous_region). */
-		while (iotlb_nslabs & (iotlb_nslabs-1))
-			iotlb_nslabs += iotlb_nslabs & ~(iotlb_nslabs-1);
 	}
 	if (*str == ',')
 		++str;
@@ -147,9 +144,6 @@ swiotlb_init_with_default_size(size_t de
 	if (!iotlb_nslabs) {
 		iotlb_nslabs = (default_size >> IO_TLB_SHIFT);
 		iotlb_nslabs = ALIGN(iotlb_nslabs, IO_TLB_SEGSIZE);
-		/* Round up to power of two (xen_create_contiguous_region). */
-		while (iotlb_nslabs & (iotlb_nslabs-1))
-			iotlb_nslabs += iotlb_nslabs & ~(iotlb_nslabs-1);
 	}
 
 	bytes = iotlb_nslabs * (1UL << IO_TLB_SHIFT);