<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 31, 2024 at 1:57 AM Andy Shevchenko <<a href="mailto:andriy.shevchenko@linux.intel.com">andriy.shevchenko@linux.intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Thu, May 30, 2024 at 10:36:57PM -0700, Chia-I Wu wrote:<br>
> We can skip children resources when the parent resource does not cover<br>
> the range.<br>
> <br>
> This should help vmf_insert_* users on x86, such as several DRM drivers.<br>
> On my AMD Ryzen 5 7520C, when streaming data from cpu memory into amdgpu<br>
> bo, the throughput goes from 5.1GB/s to 6.6GB/s. perf report says<br>
> <br>
> 34.69%--__do_fault<br>
> 34.60%--amdgpu_gem_fault<br>
> 34.00%--ttm_bo_vm_fault_reserved<br>
> 32.95%--vmf_insert_pfn_prot<br>
> 25.89%--track_pfn_insert<br>
> 24.35%--lookup_memtype<br>
> 21.77%--pat_pagerange_is_ram<br>
> 20.80%--walk_system_ram_range<br>
> 17.42%--find_next_iomem_res<br>
> <br>
> before this change, and<br>
> <br>
> 26.67%--__do_fault<br>
> 26.57%--amdgpu_gem_fault<br>
> 25.83%--ttm_bo_vm_fault_reserved<br>
> 24.40%--vmf_insert_pfn_prot<br>
> 14.30%--track_pfn_insert<br>
> 12.20%--lookup_memtype<br>
> 9.34%--pat_pagerange_is_ram<br>
> 8.22%--walk_system_ram_range<br>
> 5.09%--find_next_iomem_res<br>
> <br>
> after.<br>
<br>
Is there any documentation that explicitly says that the children resources<br>
must not overlap parent's one? Do we have some test cases? (Either way they<br>
needs to be added / expanded).<br></blockquote><div>I think it's the opposite. The assumption here is that a child is always a subset of its parent. Thus, if the range to be checked is not covered by a parent, we can skip the children.</div><div><br></div><div>That's guaranteed by __request_resource. I am less sure about __insert_resource but it appears to be the case too. FWIW, resource_is_exclusive has the same assumption already.</div><div> <br></div><div>It looks like I need to do some refactoring to add tests.<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
P.S> I'm not so sure about this change. It needs a thoroughly testing, esp.<br>
in PCI case. Cc'ing to Ilpo.<br></blockquote><div>What's special about PCI?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
-- <br>
With Best Regards,<br>
Andy Shevchenko<br>
<br>
<br>
</blockquote></div></div>