提交 cabb7f89 编写于 作者: J Jan Beulich 提交者: Juergen Gross

swiotlb-xen: limit init retries

Due to the use of max(1024, ...) there's no point retrying (and issuing
bogus log messages) when the number of slabs is already no larger than
this minimum value.
Signed-off-by: NJan Beulich <jbeulich@suse.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>

Link: https://lore.kernel.org/r/984fa426-2b7b-4b77-5ce8-766619575b7f@suse.comSigned-off-by: NJuergen Gross <jgross@suse.com>
上级 79ca5f77
...@@ -207,7 +207,7 @@ int __ref xen_swiotlb_init(void) ...@@ -207,7 +207,7 @@ int __ref xen_swiotlb_init(void)
swiotlb_set_max_segment(PAGE_SIZE); swiotlb_set_max_segment(PAGE_SIZE);
return 0; return 0;
error: error:
if (repeat--) { if (nslabs > 1024 && repeat--) {
/* Min is 2MB */ /* Min is 2MB */
nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE)); nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE));
bytes = nslabs << IO_TLB_SHIFT; bytes = nslabs << IO_TLB_SHIFT;
...@@ -243,7 +243,7 @@ void __init xen_swiotlb_init_early(void) ...@@ -243,7 +243,7 @@ void __init xen_swiotlb_init_early(void)
rc = xen_swiotlb_fixup(start, nslabs); rc = xen_swiotlb_fixup(start, nslabs);
if (rc) { if (rc) {
memblock_free(__pa(start), PAGE_ALIGN(bytes)); memblock_free(__pa(start), PAGE_ALIGN(bytes));
if (repeat--) { if (nslabs > 1024 && repeat--) {
/* Min is 2MB */ /* Min is 2MB */
nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE)); nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE));
bytes = nslabs << IO_TLB_SHIFT; bytes = nslabs << IO_TLB_SHIFT;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册