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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC53DC3600B for ; Thu, 27 Mar 2025 07:21:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5E1E2800C7; Thu, 27 Mar 2025 03:21:33 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0C842800A5; Thu, 27 Mar 2025 03:21:33 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9D3A52800C7; Thu, 27 Mar 2025 03:21:33 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 7E66D2800A5 for ; Thu, 27 Mar 2025 03:21:33 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id D49EE120683 for ; Thu, 27 Mar 2025 07:21:33 +0000 (UTC) X-FDA: 83266485666.19.E859B04 Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf20.hostedemail.com (Postfix) with ESMTP id 12DF61C0009 for ; Thu, 27 Mar 2025 07:21:29 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743060091; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R6jJCbGz2b1x6VxdGic6z1KzeEGF4qrBCEPwzKyjVKc=; b=GKEK0jMrM2PtvgdKsDAp6zrWaaJdqIcMC52k68M6epcNK0IZdLwtJeWDvJExJkOvLv5C7q Is5Pov4PgXtr27SvRTC8oKqvm26X4a9HJmYVH4dQyyj5k4oTjP5oKcuRqJTgwODYoF92nq x9qzi5Aa5NKmS4Gqeg8sAyW7GYFomq8= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf20.hostedemail.com: domain of linyunsheng@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=linyunsheng@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743060091; a=rsa-sha256; cv=none; b=n1Ate0Enie8O7veTmibflqn2brCDC7tp+CjLCcWHiTucb4aAK2ls/5qU4MltgMJQCVg+Xy Muagngi4CtYhi41xXssuMjVHXr6LMuuZmRNcN0k2t5kN5ldefQjx2ttJLYE7eEpLGYUuYf CgL2eQaMWwZUrB/AGE6R+Yqx5d6Qahg= Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4ZNZkQ1vLdz2CdVr; Thu, 27 Mar 2025 15:18:06 +0800 (CST) Received: from dggpemf200006.china.huawei.com (unknown [7.185.36.61]) by mail.maildlp.com (Postfix) with ESMTPS id 9FA111800B3; Thu, 27 Mar 2025 15:21:23 +0800 (CST) Received: from [10.67.120.129] (10.67.120.129) by dggpemf200006.china.huawei.com (7.185.36.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 27 Mar 2025 15:21:23 +0800 Message-ID: <77cd9e2d-da66-4e8f-831d-87915465f98a@huawei.com> Date: Thu, 27 Mar 2025 15:21:22 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v2 3/3] page_pool: Track DMA-mapped pages and unmap them when destroying the pool To: Mina Almasry CC: Saeed Mahameed , =?UTF-8?Q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , Leon Romanovsky , Tariq Toukan , Andrew Lunn , Eric Dumazet , Paolo Abeni , Ilias Apalodimas , Simon Horman , Andrew Morton , Yonglong Liu , Pavel Begunkov , Matthew Wilcox , , , , , Qiuling Ren , Yuying Ma References: <20250325-page-pool-track-dma-v2-0-113ebc1946f3@redhat.com> <20250325-page-pool-track-dma-v2-3-113ebc1946f3@redhat.com> Content-Language: en-US From: Yunsheng Lin In-Reply-To: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.120.129] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemf200006.china.huawei.com (7.185.36.61) X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 12DF61C0009 X-Stat-Signature: diyhiprjuz88easg9ngkwrniqeycty9p X-HE-Tag: 1743060089-935764 X-HE-Meta: U2FsdGVkX19z3maxC7fEz2iV8A5eCqXP7fYKAL4LRWg+CyzeS+j/F0SZNI3+pYthxAMzl7sm/A+s5XEBOOzgu4cmLpMDskZSDuyxBXpVRkAUnZwM6Vb0/mszMTZQjS1Nsc6Y3GXS+KppAFrITB5qxbhF062kzJq5Vv+o3qToxi6tdoHaQjwX7164ukMZ2S+34/kbqs0qXFL5CNrpZ3sD7c2UVb68t6cKZP4CMzWsw8HQ0p6dc24e2P/SVFb+nLWgY2v2wQ7Bpt/yVvCkI1eatoGwY3NJZxUTci9mKvjb5FjJLYln1EDBlooNdRM1rAm/rzKgXgaF7SW4aagc9j/rLD6W2Eh2Bop8sfnyY39wE1Ezfp46dLC3L6DTNbZmxCFaVO1Wje64Lz6pkWCD/CIeozgUPmutlLnEf45hZ9zef9OSZaGl2QKM4rfUPgyh2M7OQ0cC/ycgg8nBGm5lZsv0Epo3JQrEOy/xp2Ki14l2t+974wF3yOnnqrzsspdTUZed3+Mvdv0QzBtXEyw6I+fVZ45HxkUhK093f2ofFMOG45v+9jCp3fiWf7RUdTkWlcaw7M1OwUr9+r77B/xrUHkdb1HXiTI6SXdlL2Cz6HFQ2rAjq3Dz312ShlURTzPoSGPhcK2TvqBzyXdy7H2kaZNUJHkJvrOywEAfLCOo1AqCYoQTJ8In+vgo/nLug2pfKdSP/4vlORjRpnVPQFQqGg1C7UvlnRAfbdc6bZU5OFfZyuw4AJEO/NLHa1XMxSvZodUEqcA75oNZZerauGk6IakJf+SL8vuHMeNPn5dX1HhajFsbNskyHHsp+Us9gWNGC1dGJ9jXT79ebC4INjSMDgBeF0nw4ppbkvuk9DBl95mrF4cn6x+eJ7rfvCZYgD2uGigDr+0vkn2oeirhBNmA2iuK3KzDrYourVTYm8/YLDBxeF3Q001tLTyrQno6lVFA2jVjXJn+Et1Lxizpzia6CNk biTYufG+ 6y/Wi8IFINL/1ruviLXxGuNVb9+rwNX4tKar6yo4/AFf0jvgU9wORMoxE6grJR+SAm3oNYKzse5aqtmLnv6zWSPJKUlly7xrisBkLXi4QIre/paVTRiZ2as+1gzKc7XtpL8SJYv+ySHtx87Z37+SBAwFX6BRI1DYsHHePkgJTDQz6Oa75xhlE7vFTEuuKsSAbMYZiJDw+F5gL0+rO4dOIW/WS62w+ThVpbUDAdgQB1Cm0agVaHxKZKsSTR6jbftvoclpLIjH3T0IdMshRqfK8ynFPBcNK6g7s2XLY9rts4NaaoBeEH/V40OeKtx8JtFVCXtUQzEOvWODZ0leYv2qeZEd1UidJ35acMO1a X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2025/3/27 12:59, Mina Almasry wrote: > On Wed, Mar 26, 2025 at 8:54 PM Yunsheng Lin wrote: >>>> >>>> Since all the tracking added in this patch is performed on DMA >>>> map/unmap, no additional code is needed in the fast path, meaning the >>>> performance overhead of this tracking is negligible there. A >>>> micro-benchmark shows that the total overhead of the tracking itself is >>>> about 400 ns (39 cycles(tsc) 395.218 ns; sum for both map and unmap[2]). >>>> Since this cost is only paid on DMA map and unmap, it seems like an >>>> acceptable cost to fix the late unmap issue. Further optimisation can >>>> narrow the cases where this cost is paid (for instance by eliding the >>>> tracking when DMA map/unmap is a no-op). See the above statement, and note the above optimisation was also discussed before and it seemed unfeasible too. > > what time_bench_page_pool03_slow actually does each iteration: > - Allocates a page *from the fast path* > - Frees a page to through the slow path (recycling disabled). > > Notably it doesn't do anything in the slow path that I imagine is > actually expensive: alloc_page, dma_map_page, & dma_unmap_page. As above, for most arches, the DMA map/unmap seems to be almost no-op when page_pool is created with PP_FLAG_DMA_MAP flag without IOMMU/swiotlb behind the DMA MAPPING. > > We do not have an existing benchmark case that actually tests the full > cost of the slow path (i.e full cost of page_pool_alloc from slow path > with dma-mapping and page_pool_put_page to the slow path with > dma-unmapping). That test case would have given us the full picture in > terms of % regression. > > This is partly why I want to upstream the benchmark. Such cases can be > added after it is upstreamed. Why not add it now when you seemed to be arguing that exercising the code path of dma_map_page() and dma_unmap_page() may change the full picture here.