Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp179286pxa; Fri, 21 Aug 2020 04:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzINTmx1N4QCqHXJlHSCoQrgciKh+H39DNlZsasKXwJ7LJ/d2noQNiWJ+r82GeZxPu7tedd X-Received: by 2002:a17:906:36c2:: with SMTP id b2mr2390242ejc.238.1598009944769; Fri, 21 Aug 2020 04:39:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598009944; cv=none; d=google.com; s=arc-20160816; b=vFe1VRwIxGAMu0aCKgjQmAmkzWTtea/h/645iz/JoaalVXSrdLSq9lrQ022qk/edtg EZRAn0N6O9TV0l2k5bY9XD/e37XATCqinqj/stfAxyBFsfK5EUkdsyZ5FcT+yqd2y+3N 9UsEczOFWC9dibRxF0U+5zTo5JBWdwZJNODsla90ZC82yQCW5adOe2ZiWE88AaFKf37n RxwI7p1VikJW5jalXw17/aK9wlPdRFKWkq8V+8xo437Ql5hUoc/2blhYKhV9oP4HkM6q JMzwsqZOf19sedc9Pxu4VFMaVxf5fi9b5haVTxYHEOEiM6cUZ8/sVm3i+x7wANeVI61y tUPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZaG9HwJyvciBuDXXh6xGzJYNy7MVqK84lKzVuvpH/MI=; b=pj8lFBFAzpbXzCeqZpASkVcJxfjqPyZTbRVFtNQTfmM3DwwhQd60dhtJ55AW0GasPS uRqIjjk1v0oBJRrWhvl1ri+zVEhl1TO9ZgA78Gv+cKFQDtQxkRK5r6da9/U7ikK2I7UZ lHWdQGfrK92GMSZTgqhKF9F4uS1m46RWnj15gkATSYJAF20JDNdV96anFz/76fEs4WyA FqEHFp1zLQZYpbvNybunt4lkQ6iiSN7Rk1FWJg5GWcf+z/IQ4Zwhhjs2zYD2t25hBX0J dbRDHgiEK3kmvEdsNMUgTNVdqICutK7BoLbq5s3iOKkGmwDNQkFjWplJRyCHz9BjM81K WgFQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f9si942607edj.83.2020.08.21.04.38.41; Fri, 21 Aug 2020 04:39:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727106AbgHULhk (ORCPT + 99 others); Fri, 21 Aug 2020 07:37:40 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:10301 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727979AbgHULhH (ORCPT ); Fri, 21 Aug 2020 07:37:07 -0400 Received: from DGGEMS406-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 768E13884C03F44F2888; Fri, 21 Aug 2020 19:37:04 +0800 (CST) Received: from SWX921481.china.huawei.com (10.126.200.129) by DGGEMS406-HUB.china.huawei.com (10.3.19.206) with Microsoft SMTP Server id 14.3.487.0; Fri, 21 Aug 2020 19:36:54 +0800 From: Barry Song To: , , , , , , CC: , , , , , , Barry Song , Nicolas Saenz Julienne , Steve Capper , Mike Rapoport Subject: [PATCH v7 2/3] arm64: mm: reserve per-numa CMA to localize coherent dma buffers Date: Fri, 21 Aug 2020 23:33:54 +1200 Message-ID: <20200821113355.6140-3-song.bao.hua@hisilicon.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200821113355.6140-1-song.bao.hua@hisilicon.com> References: <20200821113355.6140-1-song.bao.hua@hisilicon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.126.200.129] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Right now, smmu is using dma_alloc_coherent() to get memory to save queues and tables. Typically, on ARM64 server, there is a default CMA located at node0, which could be far away from node2, node3 etc. with this patch, smmu will get memory from local numa node to save command queues and page tables. that means dma_unmap latency will be shrunk much. Meanwhile, when iommu.passthrough is on, device drivers which call dma_ alloc_coherent() will also get local memory and avoid the travel between numa nodes. Acked-by: Will Deacon Cc: Christoph Hellwig Cc: Marek Szyprowski Cc: Robin Murphy Cc: Ganapatrao Kulkarni Cc: Catalin Marinas Cc: Nicolas Saenz Julienne Cc: Steve Capper Cc: Andrew Morton Cc: Mike Rapoport Signed-off-by: Barry Song --- -v7: add Will's acked-by arch/arm64/mm/init.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 481d22c32a2e..f1c75957ff3c 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -429,6 +429,8 @@ void __init bootmem_init(void) arm64_hugetlb_cma_reserve(); #endif + dma_pernuma_cma_reserve(); + /* * sparse_init() tries to allocate memory from memblock, so must be * done after the fixed reservations -- 2.27.0