RE: [RFC 1/1] swiotlb: Reduce calls to swiotlb_find_pool()

Michael Kelley
2024-06-27T14:59:05Z

From: Petr Tesařík <petr@tesarici.cz> Sent: Wednesday, June 26, 2024 11:52 PM
>
> Oh, right. The idea is good, but I was not able to reply immediately
> and then forgot about it.
>
> For the record, I considered an alternative: Call swiotlb_* functions
> unconditionally and bail out early if the pool is NULL. But it's no
> good, because is_swiotlb_buffer() can be inlined, so this approach
> would replace a quick check with a function call. And then there's also
> swiotlb_tbl_unmap_single()...
>
> I have only a very minor suggestion: Could is_swiotlb_buffer() be
> renamed now that it no longer returns a bool? OTOH I have no good
> immediate idea myself.
>

Conceptually, it's still being used as a boolean function based on
whether the return value is NULL. Renaming it to swiotlb_get_pool()
more accurately describes the return value, but obscures the
intent of determining if it is a swiotlb buffer. I'll think about it.
Suggestions are welcome.

Michael