From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F523C433DB for ; Tue, 2 Mar 2021 14:11:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BA0764F04 for ; Tue, 2 Mar 2021 14:11:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1578300AbhCBOJi (ORCPT ); Tue, 2 Mar 2021 09:09:38 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:2617 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443708AbhCBMdc (ORCPT ); Tue, 2 Mar 2021 07:33:32 -0500 Received: from fraeml711-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4DqbtX75nlz67rNr; Tue, 2 Mar 2021 20:25:08 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml711-chm.china.huawei.com (10.206.15.60) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 2 Mar 2021 13:32:47 +0100 Received: from [10.47.2.166] (10.47.2.166) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 2 Mar 2021 12:32:45 +0000 Subject: Re: [PATCH 1/1] Revert "iommu/iova: Retry from last rb tree node if iova search fails" From: John Garry To: Robin Murphy , "Leizhen (ThunderTown)" , Will Deacon , Joerg Roedel , iommu , linux-kernel CC: Vijayanand Jitta , Linuxarm , chenxiang References: <20210129092120.1482-1-thunder.leizhen@huawei.com> <5505b1e5-2450-d5c4-6d77-5bb21fd0b6a1@huawei.com> <7e18829a-3e7e-cc82-9d33-366cf2025624@huawei.com> <4c634a22-7168-b51c-a012-2009fc03e6c3@arm.com> Message-ID: <0cb64d74-0ec1-2284-f67a-b1619a3eb138@huawei.com> Date: Tue, 2 Mar 2021 12:30:51 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.2.166] X-ClientProxiedBy: lhreml745-chm.china.huawei.com (10.201.108.195) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/03/2021 15:48, John Garry wrote: >> >> While max32_alloc_size indirectly tracks the largest*contiguous* >> available space, one of the ideas from which it grew was to simply keep >> count of the total number of free PFNs. If you're really spending >> significant time determining that the tree is full, as opposed to just >> taking longer to eventually succeed, then it might be relatively >> innocuous to tack on that semi-redundant extra accounting as a >> self-contained quick fix for that worst case. >> >>> Anyway, we see ~50% throughput regression, which is intolerable. As seen >>> in [0], I put this down to the fact that we have so many IOVA requests >>> which exceed the rcache size limit, which means many RB tree accesses >>> for non-cacheble IOVAs, which are now slower. > > I will attempt to prove this by increasing RCACHE RANGE, such that all > IOVA sizes may be cached. About this one, as expected, we restore performance by increasing the RCACHE RANGE. Some figures: Baseline v5.12-rc1 strict mode: 600K IOPs Revert "iommu/iova: Retry from last rb tree node if iova search fails": 1215K Increase IOVA RCACHE range 6 -> 10 (All IOVAs size requests now cacheable for this experiment): 1400K Reduce LLDD max SGE count 124 -> 16: 1288K non-strict mode 1650K So ideally we can work towards something for which IOVAs of all size could be cached. Cheers, John