From patchwork Wed Jan 27 20:10:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 12050959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FCE0C433E0 for ; Wed, 27 Jan 2021 20:11:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 308CB64DA4 for ; Wed, 27 Jan 2021 20:11:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 308CB64DA4 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=pm.me Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 37E606B0006; Wed, 27 Jan 2021 15:11:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3303D6B006C; Wed, 27 Jan 2021 15:11:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1F6E76B006E; Wed, 27 Jan 2021 15:11:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0082.hostedemail.com [216.40.44.82]) by kanga.kvack.org (Postfix) with ESMTP id 06ECD6B0006 for ; Wed, 27 Jan 2021 15:11:01 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BD43B8249980 for ; Wed, 27 Jan 2021 20:11:00 +0000 (UTC) X-FDA: 77752648680.09.coat30_26130ba27599 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin09.hostedemail.com (Postfix) with ESMTP id A5493180AD81D for ; Wed, 27 Jan 2021 20:11:00 +0000 (UTC) X-HE-Tag: coat30_26130ba27599 X-Filterd-Recvd-Size: 4295 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by imf41.hostedemail.com (Postfix) with ESMTP for ; Wed, 27 Jan 2021 20:10:59 +0000 (UTC) Date: Wed, 27 Jan 2021 20:10:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail; t=1611778257; bh=VdLcOnTLbHfFNHFlN/XjYPHtoWTcOg+AoFdHQrfr7jE=; h=Date:To:From:Cc:Reply-To:Subject:From; b=Xk5AAUW2hzwHMulLeDd1o8jFMxpHFcNn5Lvyslpc98CPdmGW4hNZNh3OaAbwjkSWF oRIUWJF6XzV3pvfkbhNTHAgvLjD1kCMdekHFzEH3aT3J99QoFSDjRqhaxPk0zkda4E t6ZOnF3hrDrAuzwJf3UsUBN+qukP/a/neSV503kp2b969Qcxk+IxK556S/wA6rijux fPvxxFUbr0ObBC1OXrkGd3Xpr4RzPPRCNiBQ0Gpc3V0F6+CioAvlmc8HKKlahZTVif Lf2ETDXjkBX+TWCVy0ex1AB8YM/aUks2vTia/rjzIUxIRVi1U+zeOL7SuD+exMYml9 xhEDv9ixZi3hA== To: "David S. Miller" , Jakub Kicinski From: Alexander Lobakin Cc: 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 v2 net-next 0/4] net: consolidate page_is_pfmemalloc() usage Message-ID: <20210127201031.98544-1-alobakin@pm.me> MIME-Version: 1.0 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: 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 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 Alexander Lobakin (4): mm: constify page_is_pfmemalloc() argument skbuff: constify skb_propagate_pfmemalloc() "page" argument net: introduce common dev_page_is_reserved() net: page_pool: simplify page recycling condition tests .../net/ethernet/hisilicon/hns3/hns3_enet.c | 10 ++-------- drivers/net/ethernet/intel/fm10k/fm10k_main.c | 9 ++------- 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 | 11 +---------- drivers/net/ethernet/intel/igb/igb_main.c | 7 +------ drivers/net/ethernet/intel/igc/igc_main.c | 7 +------ drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 7 +------ .../net/ethernet/intel/ixgbevf/ixgbevf_main.c | 7 +------ .../net/ethernet/mellanox/mlx5/core/en_rx.c | 7 +------ include/linux/mm.h | 2 +- include/linux/skbuff.h | 19 +++++++++++++++++-- net/core/page_pool.c | 14 ++++---------- 13 files changed, 34 insertions(+), 96 deletions(-) Reviewed-by: Jesse Brandeburg