Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp985797rdg; Fri, 11 Aug 2023 06:29:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEgtachoeM6CNfI6qX6FUf6l33vx26ojQEG6yetubOhLiKFW6150pijP7fxif+/iIBh38g2 X-Received: by 2002:a05:6808:1144:b0:3a7:20a9:ae8e with SMTP id u4-20020a056808114400b003a720a9ae8emr2495517oiu.21.1691760571081; Fri, 11 Aug 2023 06:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691760571; cv=none; d=google.com; s=arc-20160816; b=sOs8oKTQvvPXW7KYd7sAJ4FjdPc36VVOdYA5/4v8bfKGDVoxTh6LlmrXmtCbk3+q2Z b3AoWtyOVxVttH9U996IeCWi7E7VFBwo987gy4CvYHKqz/0WhcqXnw35luOFXHUsACQx 79nH16PMM4kGn2oaNYnlYW64Z+/iY/GAu0vZu/a54JnFbMzqrmb86I8e5E0gHV4SGb+O JOJQM+RO7BJ8CZdP+5pjs5Mw0LOvXEtOwtcICZWfG2GrxN7bXqdO33Bwo0YHcmeV+vF1 PEx6skWzQJvEtjtuY/mUwJPdo2SrLHjyta1nRvFda2H6EeNEg5p7nECQLybJQoKDW+wT u13Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=V0edV215TDlgsCIikl5qZ14rf8XKnZIyHPB8nTiN150=; fh=j+d8Qji3Kd78Y5wikuIe56W4rxsMj0I3YfL77K4ftaQ=; b=CTwT73enf8fEB06SPUpJJw8hO0kkGfrO2xRXoUyYnM+J/pIoWcUZCykLhptXmufi1B TZ0itjOvndrzbj8DDCFDasDQyCMfDCCdtRlRiu9Cch0iXJF1NJrDgPptUXUq92Yc3ofx cq3qYHr0MZzyJZbFiUecpRxgQcLMJZGGtYK45fpgbQDYmTbfCz1UHwtOEAHUcSYJ+390 NhEiEsk9P1zPt+4oEierP6L1j58KW5V+BxZcazpfrjsb/crz5VL4dUFAlzqHmxdxLQ33 GPCxtv4bKdrfxhbRLNGdeBRj/v5EANda9ruXu115uUDZwOHuLIPZDn3PYKtrhMkgNJWI xvDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a11-20020a63d20b000000b005653310b042si3313554pgg.285.2023.08.11.06.29.18; Fri, 11 Aug 2023 06:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232875AbjHKNLR (ORCPT + 99 others); Fri, 11 Aug 2023 09:11:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229927AbjHKNLL (ORCPT ); Fri, 11 Aug 2023 09:11:11 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43543119 for ; Fri, 11 Aug 2023 06:11:09 -0700 (PDT) Received: from kwepemi500019.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RMkfS02syzrSbH; Fri, 11 Aug 2023 21:09:51 +0800 (CST) Received: from huawei.com (10.175.112.208) by kwepemi500019.china.huawei.com (7.221.188.117) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 11 Aug 2023 21:11:05 +0800 From: Zhang Zekun To: , , CC: , , , , , , Subject: [RESEND PATCH 0/2] iommu/iova: optimize the iova rcache Date: Fri, 11 Aug 2023 21:02:44 +0800 Message-ID: <20230811130246.42719-1-zhangzekun11@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.112.208] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemi500019.china.huawei.com (7.221.188.117) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The number of iova_cpu_rcache can grow with the number of cpus in iova_rcache, but the size of rcache->depot will not. The deeper of rcache->depot can help iova_rcache cache more iovas, and can help iova_rcache better dealing with senarios in which drivers allocating and free iovas on different cpu cores. We only let the size of rcache->depot to grow with the number of cpus which is larger than 32 to avoid potential performance decrease on machines which don't have much cpus. Also, it is unsafe to directly free cpu rcache magazines in free_iova_rcaches, add check before freeing it. Zhang Zekun (2): iommu/iova: Add check for cpu_rcache in free_iova_rcaches iommu/iova: allocate iova_rcache->depot dynamicly drivers/iommu/iova.c | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) -- 2.17.1