Re: [PATCH v2 3/4] iommu/iova: Extend rbtree node caching

From: Robin Murphy
Date: Tue Sep 19 2017 - 06:07:18 EST


On 19/09/17 10:42, Leizhen (ThunderTown) wrote:
[...]
>>>> static void
>>>> __cached_rbnode_delete_update(struct iova_domain *iovad, struct iova
>>>> *free)
>>>> {
>>>> struct iova *cached_iova;
>>>> - struct rb_node *curr;
>>>> + struct rb_node **curr = NULL;
>>>> - if (!iovad->cached32_node)
>>>> - return;
>>>> - curr = iovad->cached32_node;
>>>> - cached_iova = rb_entry(curr, struct iova, node);
>
> -----------------------------
>>>> + if (free->pfn_hi < iovad->dma_32bit_pfn)
>>>> + curr = &iovad->cached32_node;
>>>> + if (!curr)
>>>> + curr = &iovad->cached_node;
>>
>> + if (!*curr)
>> + return;
> Is it necessary for us to try the following adjustment?
> + if (free->pfn_hi < iovad->dma_32bit_pfn)
> + curr = &iovad->cached32_node;
> + else
> + curr = &iovad->cached_node;
> +
> + if (!*curr) {
> + *curr = rb_next(&free->node);
> + return;
> + }

Yeah, I spotted that this looked a bit wonky after I posted it. It's
already cleaned up in v3, which I'll be posting shortly after I write up
some cover letters.

Thanks,
Robin.