From patchwork Wed Jan 11 04:21:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13096003 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 00711C677F1 for ; Wed, 11 Jan 2023 04:22:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E278F94000C; Tue, 10 Jan 2023 23:22:42 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DD78C94000E; Tue, 10 Jan 2023 23:22:42 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C7B2894000C; Tue, 10 Jan 2023 23:22:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id A631894000E for ; Tue, 10 Jan 2023 23:22:42 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8DB971604FA for ; Wed, 11 Jan 2023 04:22:42 +0000 (UTC) X-FDA: 80341222164.29.AF5BC64 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf30.hostedemail.com (Postfix) with ESMTP id 15A258000B for ; Wed, 11 Jan 2023 04:22:40 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=u6UqEDOX; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673410961; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=ccAV47NGyzUKHaLwSknHK+4sPU0V4c7X6TXLSvHsxhw=; b=o6jlJvgBk4sh5jzHuuYhjJqaUK03vidsvfcqBkcH1SkI+MECnDNzcCf1A5+fX2PcN6M8MO 9o5268FItKMeF8pvKuyxj6PTSpweYVUP7+fl4MvrGNJIwC82YCh68qIs2IogkpgmM/5uVg Si6Y57sFujel6SHgarsLNAZKUkW21GQ= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=u6UqEDOX; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673410961; a=rsa-sha256; cv=none; b=oP39Bi8g9TjO9NdElntCGQvAgCxv7TG2ZbXmnI7JqbLlyiHoxIuKZqGDpDyW1x3Vx5g9Hv 4v3FSzt8m9g1ihoZIMI06aCk7dcaOgzDpr4o65PmdkI/gx8j9VRNvu9JCZsBVsvVe4N0NH m0fZqoc1aFwRcnVG506tUIk18UKpGH0= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=ccAV47NGyzUKHaLwSknHK+4sPU0V4c7X6TXLSvHsxhw=; b=u6UqEDOXVSQEhy0PFpvN1BjT65 VRd3zaSADszmGctqM8BVv2VeH4OFJfGVoAf1jfkgXa2jTsSMJamaRnhllD//2pYsKfV8vq2PGAXO9 6HzigS86/bXNxbCc1uRROKLX7PMeyNHjT0GYP0QuvxsoBr1qhDgd5WT7w/uwIq71LUAR05/5s+gr2 unG3VwVesKOex+n2TR3ozXIexpkKX7xvmCmWwIQCmKRWENEM6UsMtUP/VtxadTzCmDbD1KlLImmVg fnXLhg+T7QTl19EaH3Gf5A8YAAJLhInuNPPBS4MFouYOAKGz27zvPAxucDprEwfxTqHTVDzWTZa6O CjaCKHkQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pFScy-003nxg-4N; Wed, 11 Jan 2023 04:22:16 +0000 From: "Matthew Wilcox (Oracle)" To: Jesper Dangaard Brouer , Ilias Apalodimas Cc: "Matthew Wilcox (Oracle)" , netdev@vger.kernel.org, linux-mm@kvack.org, Shakeel Butt Subject: [PATCH v3 00/26] Split netmem from struct page Date: Wed, 11 Jan 2023 04:21:48 +0000 Message-Id: <20230111042214.907030-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 15A258000B X-Stat-Signature: 458kdaw8c6bkmeq4azbdgj59m5frer7p X-Rspam-User: X-HE-Tag: 1673410960-12423 X-HE-Meta: U2FsdGVkX1/P30iE0xrIh7Kp96D23Dq8mvknvFiJwY6vu8oj6iN64fE+9BM4cbCSChIKBHgJbYcd8NYUE0nC9TCDBMCoZFyGk1CMbX3ZvMNwPZF/04wRg1FCB0Whj1wdUFC3WooJZzSsd+iDn/OTQDw1hwi9R8lTqIZnXca5PYkPqWeVqWhdx2Cpy21YtD9EciSfWFHYiQZzXgSGyr3LYvckJE6kwK2m10LbMMDgsSaBVPzdgjRJ4opp2++Y/MfYXqAGE0pQpgy5M1EV2ZU67UGgXbiRhcFq+7exO0UOOzN6+K41ij4Naiv0SJBTtL+yVBP6Kwvn+fDBhg8RGOnnCMOcNgxsWh2DzjMn9U/kVR2NtQOMC0/366hXOfhplcs4VIYw6FB7u0636HPS4zMnnQ90YOyBUI+CUEZDIvOvw98Osg+Rlzidf7RM6pQOE9zBH3bzZDLw0Pb5gQTKaK5Oi87x+hcArdX39zuy+19T7ksFA9CYYCzrpaCob7v17WUMStz7BKjkoNgMb3wVkx2hNskPou96idPQvL3lxE7w1YGhVgdfEVGGftQr3ZJVrbCCpYuzdcSCpADabKmJ7xh+OvuT/9Sa+trJiBiwMmu8R2lMBjCK2bxbahsEmOwsr+0LBX7COEhaibQBMpb5kAEQFqGNHaktD22GzVra9UvH4uCtx+PvhlHyE3HdB2pE1J35FgoWeLKK/Ys6DlhYhWJB9M6sMc4rky8IePKv8vFmyocQZ3qeP52ZKGDExdevCd8x4uVF2XXDf1DJ4brVwjrdWNurGMQXxIEjjIUz1g3443OnlWXi1mD8TIXkKF9mqbqw9Mc0Yx7s72db4V/jR7NbTcyLbKkhsh2EL7AzAPYlKca2N1NOCeARWAPp8P9ZUw/Z 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: The MM subsystem is trying to reduce struct page to a single pointer. The first step towards that is splitting struct page by its individual users, as has already been done with folio and slab. This patchset does that for netmem which is used for page pools. There are some relatively significant reductions in kernel text size from these changes. They don't appear to affect performance at all, but it's nice to save a bit of memory. v3: - Rebase to next-20230110 - Add received Acked-by and Reviewed-by tags (thanks!) - Mark compat functions in page_pool.h (Ilias) - Correct a patch title - Convert hns3 driver (and page_pool_dev_alloc_frag()) - Make page_pool_recycle_direct() accept a netmem or page pointer Matthew Wilcox (Oracle) (26): netmem: Create new type netmem: Add utility functions page_pool: Add netmem_set_dma_addr() and netmem_get_dma_addr() page_pool: Convert page_pool_release_page() to page_pool_release_netmem() page_pool: Start using netmem in allocation path. page_pool: Convert page_pool_return_page() to page_pool_return_netmem() page_pool: Convert __page_pool_put_page() to __page_pool_put_netmem() page_pool: Convert pp_alloc_cache to contain netmem page_pool: Convert page_pool_defrag_page() to page_pool_defrag_netmem() page_pool: Convert page_pool_put_defragged_page() to netmem page_pool: Convert page_pool_empty_ring() to use netmem page_pool: Convert page_pool_alloc_pages() to page_pool_alloc_netmem() page_pool: Convert page_pool_dma_sync_for_device() to take a netmem page_pool: Convert page_pool_recycle_in_cache() to netmem page_pool: Remove __page_pool_put_page() page_pool: Use netmem in page_pool_drain_frag() page_pool: Convert page_pool_return_skb_page() to use netmem page_pool: Allow page_pool_recycle_direct() to take a netmem or a page page_pool: Convert frag_page to frag_nmem xdp: Convert to netmem mm: Remove page pool members from struct page page_pool: Pass a netmem to init_callback() net: Add support for netmem in skb_frag mvneta: Convert to netmem mlx5: Convert to netmem hns3: Convert to netmem Documentation/networking/page_pool.rst | 5 + .../net/ethernet/hisilicon/hns3/hns3_enet.c | 16 +- drivers/net/ethernet/marvell/mvneta.c | 48 +-- drivers/net/ethernet/mellanox/mlx5/core/en.h | 10 +- .../net/ethernet/mellanox/mlx5/core/en/txrx.h | 4 +- .../net/ethernet/mellanox/mlx5/core/en/xdp.c | 24 +- .../net/ethernet/mellanox/mlx5/core/en/xdp.h | 2 +- .../net/ethernet/mellanox/mlx5/core/en_main.c | 12 +- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 130 +++++---- include/linux/mm_types.h | 22 -- include/linux/skbuff.h | 11 + include/net/page_pool.h | 228 ++++++++++++--- include/trace/events/page_pool.h | 28 +- net/bpf/test_run.c | 4 +- net/core/page_pool.c | 274 +++++++++--------- net/core/xdp.c | 7 +- 16 files changed, 493 insertions(+), 332 deletions(-)