From patchwork Mon Dec 11 03:52:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liang Chen X-Patchwork-Id: 13486643 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 E7ED6C4167B for ; Mon, 11 Dec 2023 03:53:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 791036B009C; Sun, 10 Dec 2023 22:53:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7432D6B009E; Sun, 10 Dec 2023 22:53:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5E1966B009D; Sun, 10 Dec 2023 22:53:30 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 4A90D6B007D for ; Sun, 10 Dec 2023 22:53:30 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 228B51C0E47 for ; Mon, 11 Dec 2023 03:53:30 +0000 (UTC) X-FDA: 81553167780.01.A76EF96 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf15.hostedemail.com (Postfix) with ESMTP id 56602A0004 for ; Mon, 11 Dec 2023 03:53:28 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=F40GoeHf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of liangchen.linux@gmail.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=liangchen.linux@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702266808; 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:in-reply-to:references:references:dkim-signature; bh=G2d8n0WXue9ygrbxloUCx8WAoE9HhkQ6PXxWrjAEYxU=; b=q6+79eYlfk/avXC/4nTed3U6BRdb7Hcx+1uoanKKvIpzaR8Uqn1F1YN8fkW4WdISEDt37N YCO5d3Y9vF5XMTaDlPK9i/6cTBf42aJBR54AzDPVWuJHqJirsmrpz3/Lt/cavSkDmnNnHU wzNoX8g4U+Zw2yD1H4IvogZeUXvxmto= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=F40GoeHf; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of liangchen.linux@gmail.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=liangchen.linux@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702266808; a=rsa-sha256; cv=none; b=aUuauH/JeKILgY+F32kjJHLbPcJnL0IM6hewDF5JoEoDXRVmQWtGOCwq9WtIsf6erC1Eum Oc7oy79r4OrYV87glnCoIzmrKLgAbi5rJuO/PELGVbXdgZJAFoW6Q0blZri7GqyjwpQawb a8TT9XE01LxuI5rug9aOLhAAoiQFt2E= Received: by mail-pj1-f50.google.com with SMTP id 98e67ed59e1d1-28647f4ebd9so2945428a91.3 for ; Sun, 10 Dec 2023 19:53:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702266807; x=1702871607; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=G2d8n0WXue9ygrbxloUCx8WAoE9HhkQ6PXxWrjAEYxU=; b=F40GoeHfl9HJknJnGTRJMAauvPwQ4Ygn4lPUU2+8nTYb+DUV71sbtn0CZ9Ek7lTwxX FBxJXqLvfx/aGUG5mYEacBtj1kYMBEAvIWRE1tgRogugmc6nflmqN6EUrfr/2CwiprwW WxufMigqt5L92zUcH3qZaszSKzzOCitYQSfm6gTXoE2sg4CLxpNR3YaBH59ssVVUNj8r Rqa6y3WqoJnO3mXH4ogcTgj8nj8yiEYV4qTDtzgvDiPGFdVI2LtUIB6BLHkQ6HDTe1Ws SrdiZEaM+6HEg2tLbgLCL7Ywkz3bCoyRnuqglfWQD76M3VP4y8Z3PXUd6tYHhZ/2XuaL TTEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702266807; x=1702871607; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G2d8n0WXue9ygrbxloUCx8WAoE9HhkQ6PXxWrjAEYxU=; b=SGMSyzmxolp2CcL7WAB/Yvl2AwbLC6uTVxcNzu0A74s+0h2yaFStyMNZSTlapy/TgM duXc3eXVNX80/dhq0TB2KCjkuLh6+ssGu5Fmp9mU3ELBfE/qUsAuCpORbQSy03DaIaKO v0stKLluZQBAq48+B2esIEgekUaTL1E4RZDq9iGKBggo/KtrBJtPi6S2RH99ww4D36xV KBHBfRCsw2mvjucS95lgwxpGj+T82uWxglaDuyHvtdlVlyXWJcJes7kfjcu/Pn9Otm9f hHMbqgfWsnXtQpFRfpCGWiCpyqhBo01vrIIr5OBX/1GFlS+orcZUfhjzXr107eZ6CU3h Qbhw== X-Gm-Message-State: AOJu0Yye/OAwanHO6x3E8ZwSQwVxtjmbuO9Uwc9EpFuUO2bYGU/+fHn2 Xnk4iGjcLgI5Qi7wxC2/d2A= X-Google-Smtp-Source: AGHT+IF/9zzYT5dBgAhPgi9UwWntEpQIso8WA4BYMk8jEYQTrt8722TIA7PHJFeT1xdLlXRfSo/WOA== X-Received: by 2002:a17:902:d4c5:b0:1d0:91c3:aaf2 with SMTP id o5-20020a170902d4c500b001d091c3aaf2mr1656471plg.25.1702266806761; Sun, 10 Dec 2023 19:53:26 -0800 (PST) Received: from localhost.localdomain ([89.187.161.180]) by smtp.gmail.com with ESMTPSA id b8-20020a170903228800b001d052d1aaf2sm5411491plh.101.2023.12.10.19.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 19:53:25 -0800 (PST) From: Liang Chen To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, hawk@kernel.org, ilias.apalodimas@linaro.org, linyunsheng@huawei.com Cc: netdev@vger.kernel.org, linux-mm@kvack.org, jasowang@redhat.com, almasrymina@google.com, liangchen.linux@gmail.com Subject: [PATCH net-next v8 3/4] skbuff: Add a function to check if a page belongs to page_pool Date: Mon, 11 Dec 2023 11:52:42 +0800 Message-Id: <20231211035243.15774-4-liangchen.linux@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20231211035243.15774-1-liangchen.linux@gmail.com> References: <20231211035243.15774-1-liangchen.linux@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 56602A0004 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: qb741jhn8ak1fbkackznd1dr8d3ou3dy X-HE-Tag: 1702266808-411668 X-HE-Meta: U2FsdGVkX19pYPzl2AJ/JXD4OCApFQrmhx0yi/c5xNAj0vM1YhoNYWWoKf9g+ciILGikZQooXneOrDT4SrsF3yQ83TjWSlCo59SWVk1BTVuaXNF8nmrN90sj1DbZ4XDgQjEmR8E7s6mvhUNojyfUQu0PtsjHnG+widbwuL2rlUW1JEg/hH+i2G6rNm2kFukBin1wG/esHmgJfUZPXdEIhCSI77yf2qESJOS40HYPFAYPxSe1/fUE7XwT6mkWKm1dGYiucdt9F7IgciaTTeFL3a5s7I6Xs7Uj8J3bzgHdTv5N/LVOBXuX2WKwNyW4nBjBBYi5KU1d2M+h4PIjQhNjWFBPFvq73xoBSr+zc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KU6hqueCRVmDHqOhixM/8+wAJzYATI4SITzJHfvlxfEBNF1/Rird3Wuk529P0qwcPIsuF3r3pYX4JNzZF+TQqWdvc2JKLtRpUZrL82KbDq/GJkxShvO9MFHZTRaLubnlWqmS72OwdwvWhhivQhZ90RRR1enODMnteDByHOo5h+VM/sbzzWBPX+hrwufiaI3XZBXuV1vkwwKuNnndq8jydNKcoIdRSfmEiimuXEMHyh4InN4DIE26etiZ31eWdfWu0LtafxDVgVbY/0pYN9VUKLzIKoALvtiUf8jpqA2qPCo+XRslU76D X-Bogosity: Ham, tests=bogofilter, spamicity=0.007087, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Wrap code for checking if a page is a page_pool page into a function for better readability and ease of reuse. Signed-off-by: Liang Chen Reviewed-by: Yunsheng Lin Reviewed-by: Ilias Apalodimas --- net/core/skbuff.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b157efea5dea..7e26b56cda38 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -890,6 +890,11 @@ static void skb_clone_fraglist(struct sk_buff *skb) skb_get(list); } +static bool is_pp_page(struct page *page) +{ + return (page->pp_magic & ~0x3UL) == PP_SIGNATURE; +} + #if IS_ENABLED(CONFIG_PAGE_POOL) bool napi_pp_put_page(struct page *page, bool napi_safe) { @@ -905,7 +910,7 @@ bool napi_pp_put_page(struct page *page, bool napi_safe) * and page_is_pfmemalloc() is checked in __page_pool_put_page() * to avoid recycling the pfmemalloc page. */ - if (unlikely((page->pp_magic & ~0x3UL) != PP_SIGNATURE)) + if (unlikely(!is_pp_page(page))) return false; pp = page->pp;