From patchwork Wed Nov 30 22:07:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13060512 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 44FE1C352A1 for ; Wed, 30 Nov 2022 22:08:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A7A966B0087; Wed, 30 Nov 2022 17:08:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8C69F6B0085; Wed, 30 Nov 2022 17:08:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 741C16B0083; Wed, 30 Nov 2022 17:08:08 -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 507A66B0075 for ; Wed, 30 Nov 2022 17:08:08 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 15C0A80BAA for ; Wed, 30 Nov 2022 22:08:08 +0000 (UTC) X-FDA: 80191497456.07.2597308 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id 3530A40013 for ; Wed, 30 Nov 2022 22:08:05 +0000 (UTC) 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=KVwdkzfVnP5EP4tQZn9lMmK56vptL30ngyKIzYXqTBI=; b=McjGfY4gNhzYVbnp5nZaYeOHTG KAeKPIAHwtc5vQ9bJv4C+uoAID2SsyNsIytkpGeYfaDQBCJAdE80IvHsUDwBMdW1ZdfxzNfJMOpLB 0TzuD4+fDsm2liDEQcamnSahCyq094YpB4BzZapJPFAn1jACSW3SXBsrt0JmuiOwvq8P3m92CTWCD G3E0o6O4eELmJU+PHTaaVmIS8zstljPRWT8Cq7wYScE6xX/bgr535fkrUMcSqWUoYoMAH2SQ2tZf2 M4kdf4aPA6FK7BmMZYNdvyNqi9N8CK5yP3fO1UInC08czIdYLrTQ9JKD6PJlICZSHgqWbupN7aCbn pjUDl75w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1p0VFM-00FLUr-IL; Wed, 30 Nov 2022 22:08:04 +0000 From: "Matthew Wilcox (Oracle)" To: Jesper Dangaard Brouer , Ilias Apalodimas Cc: "Matthew Wilcox (Oracle)" , netdev@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 00/24] Split page pools from struct page Date: Wed, 30 Nov 2022 22:07:39 +0000 Message-Id: <20221130220803.3657490-1-willy@infradead.org> X-Mailer: git-send-email 2.37.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669846086; a=rsa-sha256; cv=none; b=mwddFMVPv9bcc9pDqfkwAlgWNaV/Fdm9giyNv9PARMWep6WLAV7XY0+Wm2dxTflpPNS2uh KPno5L9+hj6ustn8xbEiSY/rU4uJgcd7yHGvC+waIxbnHPycGtOWchxlqWfTPusZhmLXZ/ SWWCmOhpFVKBNK4PQUN2u3GGhpz9J54= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=McjGfY4g; dmarc=none; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669846086; 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=KVwdkzfVnP5EP4tQZn9lMmK56vptL30ngyKIzYXqTBI=; b=pIjLe/j/YhSp3dxjzBe63qZLQK8HCEb2AZD5QlDChto7HN3W1dw52KXnY8drtT6QcKLOJh mY5Ssw4QCUGuPHjit3YKd96VfXCR/R1KlswdYXZZCq9FhmNuXf91qdiwvz4qCB8EtP75Bs simQldFpGKRxDG7NN8LekxDvMx1jOu0= X-Stat-Signature: xn3cpew9rm8he8iany7etozq5wjuhhzg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 3530A40013 Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=McjGfY4g; dmarc=none; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-Rspam-User: X-HE-Tag: 1669846085-890230 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 attempt chooses 'netmem' as a name, but I am not even slightly committed to that name, and will happily use another. There are some relatively significant reductions in kernel text size from these changes. I'm not qualified to judge how they might affect performance, but every call to put_page() includes a call to compound_head(), which is now rather more complex than it once was (at least in a distro config which enables CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP). I've only converted one user of the page_pool APIs to use the new netmem APIs, all the others continue to use the page based ones. Uh, I see I left netmem_to_virt() as its own commit instead of squashing it into "netmem: Add utility functions". I'll fix that in the next version, because I'm sure you'll want some changes anyway. Happy to answer questions. Matthew Wilcox (Oracle) (24): 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_defrag_page() page_pool: Use netmem in page_pool_drain_frag() page_pool: Convert page_pool_return_skb_page() to use netmem page_pool: Convert frag_page to frag_nmem xdp: Convert to netmem mm: Remove page pool members from struct page netmem_to_virt page_pool: Pass a netmem to init_callback() net: Add support for netmem in skb_frag mvneta: Convert to netmem drivers/net/ethernet/marvell/mvneta.c | 48 ++--- include/linux/mm_types.h | 22 --- include/linux/skbuff.h | 11 ++ include/net/page_pool.h | 181 ++++++++++++++--- include/trace/events/page_pool.h | 28 +-- net/bpf/test_run.c | 4 +- net/core/page_pool.c | 274 +++++++++++++------------- net/core/xdp.c | 7 +- 8 files changed, 344 insertions(+), 231 deletions(-) base-commit: 13ee7ef407cfcf63f4f047460ac5bb6ba5a3447d