Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp638650pxb; Wed, 27 Jan 2021 17:39:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeHmuIBgSp30B+bNvHwxCOokirb3lsEvQHHz8gVxSZ2oRGDSpBRMnupTI5chsddtC8ACnU X-Received: by 2002:a05:6402:79a:: with SMTP id d26mr11294502edy.266.1611797959776; Wed, 27 Jan 2021 17:39:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611797959; cv=none; d=google.com; s=arc-20160816; b=PHihxxCgJvfouCFazCcn1Uy5BmOa3b8NSIlbG0XdfJIdXioIejSLwzCXkd+Axl0I1l vLaZ7eet885DdRP5igbLBAbalUQwigXsLYbxPBdR8adh4MaxReP334ZT9+IoYWbG+C2p LIMy2atQaX+ar/s+lM54245Knwb/y7YEFNV4MN7wpe2DopW1LR95MVf7zqzUQD7LDQuN uRXFx3aY8ZX5FZ5TyV6vLY/60hglyjm+dCUVzFFEhVp6S21Cnsz9Y732KLMNbrimr9Z3 yplmx5k9SuZXx5KnZyGprPmZG+q/ATpFOVPin6ZDGr0k0TkmyDTJiJGJukJ7Zd/r2UPx 6HoA== 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=VdLcOnTLbHfFNHFlN/XjYPHtoWTcOg+AoFdHQrfr7jE=; b=noW1tMx0bglnxIydcukrjSAGfjBB9X6rh1q68x47OMDNmBIuSPYh8lqGvUOLkgUPfa BrP7Uv8Y2YG4lTFc/OUwZAEHFQIZj2Df5ii13jx3uqY0UjDb1anCW6hr1sKUy+R2GqWb 0yfHSxRmhEd8IsvnS3svyR0iW6HbaynCU+hPXIpBy81l0HwNjX/FRtZQAL1Gd5jjqJ8G pPuT2Y8eaIH01buJbcbH8dvP/FKyniumglFAfJ/u7BJexsBAlZwUkYDpWVy1my6nvGxx ymUwGzWdLx79SV52H9iiyY332JevlZRubs2SXRWMlmQ9OjnNJzXBtmm4yuXypw5vdkO9 hD3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail header.b=Xk5AAUW2; 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 jg13si1871632ejc.126.2021.01.27.17.38.55; Wed, 27 Jan 2021 17:39:19 -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=Xk5AAUW2; 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 S232602AbhA0ULr (ORCPT + 99 others); Wed, 27 Jan 2021 15:11:47 -0500 Received: from mail-40134.protonmail.ch ([185.70.40.134]:45767 "EHLO mail-40134.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232429AbhA0ULq (ORCPT ); Wed, 27 Jan 2021 15:11:46 -0500 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 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 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(-) --=20 2.30.0