Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3117558pxb; Sun, 31 Jan 2021 04:59:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJyJwtSNDN+TtELCFtC119M0YMR4UmNrdoANwRV7cm1motRcXBZ3UUj84Ab5UWYM3ERUkKT2 X-Received: by 2002:a17:907:2da0:: with SMTP id gt32mr5515267ejc.78.1612097997543; Sun, 31 Jan 2021 04:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612097997; cv=none; d=google.com; s=arc-20160816; b=CLH/p6VLzZVr+JuiEcN562BYpSHfGQzFg4xm7wA8yqxKSlJO7uA/9Shkh2ntTJ6pSY z2yFiL3jR6zptxmLQsDDWZXNr4kN9MT7LQZSnJlafCVUPK8M7r5phi7q8mpazKRpgMS+ 40Ws16wWyVCMpPn82EitIOVTcfhxBKDDJa6TxkqlIoYnNXn40EdIs+jcXtkDd1LaRg2G 2WmrnriSpo/9XzDKKUMKJ10gjv+m7l9K8nZJs8Hgo+kD8hYQpLhvk68CHTn4ks4sLSdZ Np54unq+yb5AZOgh5DNWtt1lActUjhibDYdv41taXWuXQw7rnQu79UP2dl2kDVYBw5DS tl1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:subject:reply-to:cc:from:to:dkim-signature:date; bh=UgDjgoVLBQ5QvhbrrxrVkP5g25w6zEO2qmnNokB4rbc=; b=PPlLeRj6Cl8XWoRihYtYtVmwpIYIi1CmpM5p+1JchqAc5OIS11dLbyLRSvfWVaPD+q r+6CsG3RHhOIRNc9Vno7Fq6Ihw1T5MhZGLuhB+w7fdrizFleQh3lUlL2sZwutDUlmGGf BBTrs4cPh0SDGe8BjfDu6rgWxyMAHcw/kzONBy/BsEv16mo9i0E0NqIoHkuYfNDpEz8h +3wWqmnc8MnYAs8S0edzuFbJHGlPyS/Wm9nJxi/FvfkONewd3T6cjvqip5iugGkLixPw x5L6+lmkLqDlEFd00Y2BrJ42pF9sm1dGv6p9+R4WEpjv+rLkanEVyB6oAbw6X4xkJWc4 6zPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=bqLcq9Jt; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si8634624edv.129.2021.01.31.04.59.33; Sun, 31 Jan 2021 04:59:57 -0800 (PST) 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; dkim=pass header.i=@pm.me header.s=protonmail header.b=bqLcq9Jt; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232263AbhAaM6j (ORCPT + 99 others); Sun, 31 Jan 2021 07:58:39 -0500 Received: from mail1.protonmail.ch ([185.70.40.18]:46493 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231622AbhAaMME (ORCPT ); Sun, 31 Jan 2021 07:12:04 -0500 Date: Sun, 31 Jan 2021 12:11:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1612095079; bh=UgDjgoVLBQ5QvhbrrxrVkP5g25w6zEO2qmnNokB4rbc=; h=Date:To:From:Cc:Reply-To:Subject:From; b=bqLcq9JtEVjdh3VBEpo+n/tXONeb/+LSo4o8qMEmOIQ5edNtjK8uw/fTJMkv33Eus tsiaI/Uoo1nrXrDkPvbnkn6LDWQD8DThK+N5FX6yrzs1qcRrPMy42I2Yk9b4JZTBv1 VTAPa/frEgM91243oVWT0DF4y6JJlG4+O/ocmYkxgH3efdCkUPiDPada0ii5Cnx3UT nHRXnkAt7+48CMmPjnQcEnjjICfYv92AUiw3/XEmDOh571E32SvJdE4Pyy1pU36R1A lKmid+7bovtDtubw/x8tjI+6lk1Gp73gIo91Of1m4xEKb3Xxyp5bUtOIy+0/Je1aZm CC2tXcxUVKbvw== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: John Hubbard , David Rientjes , Yisen Zhuang , Salil Mehta , Jesse Brandeburg , Tony Nguyen , Saeed Mahameed , Leon Romanovsky , Andrew Morton , Jesper Dangaard Brouer , Ilias Apalodimas , Jonathan Lemon , Willem de Bruijn , Randy Dunlap , Pablo Neira Ayuso , Dexuan Cui , Jakub Sitnicki , Marco Elver , Paolo Abeni , Alexander Lobakin , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org, linux-mm@kvack.org Reply-To: Alexander Lobakin Subject: [PATCH v3 net-next 0/5] net: consolidate page_is_pfmemalloc() usage Message-ID: <20210131120844.7529-1-alobakin@pm.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org page_is_pfmemalloc() is used mostly by networking drivers to test if a page can be considered for reusing/recycling. It doesn't write anything to the struct page itself, so its sole argument can be constified, as well as the first argument of skb_propagate_pfmemalloc(). In Page Pool core code, it can be simply inlined instead. Most of the callers from NIC drivers were just doppelgangers of the same condition tests. Derive them into a new common function do deduplicate the code. Since v2 [1]: - use more intuitive name for the new inline function since there's nothing "reserved" in remote pages (Jakub Kicinski, John Hubbard); - fold likely() inside the helper itself to make driver code a bit fancier (Jakub Kicinski); - split function introduction and using into two separate commits; - collect some more tags (Jesse Brandeburg, David Rientjes). Since v1 [0]: - new: reduce code duplication by introducing a new common function to test if a page can be reused/recycled (David Rientjes); - collect autographs for Page Pool bits (Jesper Dangaard Brouer, Ilias Apalodimas). [0] https://lore.kernel.org/netdev/20210125164612.243838-1-alobakin@pm.me [1] https://lore.kernel.org/netdev/20210127201031.98544-1-alobakin@pm.me Alexander Lobakin (5): mm: constify page_is_pfmemalloc() argument skbuff: constify skb_propagate_pfmemalloc() "page" argument net: introduce common dev_page_is_reusable() net: use the new dev_page_is_reusable() instead of private versions net: page_pool: simplify page recycling condition tests .../net/ethernet/hisilicon/hns3/hns3_enet.c | 17 ++++++---------- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 13 ++++-------- drivers/net/ethernet/intel/i40e/i40e_txrx.c | 15 +------------- drivers/net/ethernet/intel/iavf/iavf_txrx.c | 15 +------------- drivers/net/ethernet/intel/ice/ice_txrx.c | 13 ++---------- drivers/net/ethernet/intel/igb/igb_main.c | 9 ++------- drivers/net/ethernet/intel/igc/igc_main.c | 9 ++------- drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 ++------- .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 9 ++------- .../net/ethernet/mellanox/mlx5/core/en_rx.c | 7 +------ include/linux/mm.h | 2 +- include/linux/skbuff.h | 20 +++++++++++++++++-- net/core/page_pool.c | 14 ++++--------- 13 files changed, 46 insertions(+), 106 deletions(-) --=20 2.30.0