From patchwork Fri Dec 15 07:31:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 179055 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp9100704dys; Thu, 14 Dec 2023 23:32:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGB6BJfQrBAlxkUA4fyA+o56RvqqJcMMDl7FTndrRBR8VVGgwDbn9p/a4qFmDa6v9G3lD9Q X-Received: by 2002:a05:622a:46:b0:425:4043:2a0b with SMTP id y6-20020a05622a004600b0042540432a0bmr15390302qtw.134.1702625523899; Thu, 14 Dec 2023 23:32:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702625523; cv=none; d=google.com; s=arc-20160816; b=FCOMtWT2xNfD1KxJ03+vf7UJ2PYIjmQwku9hQ71k+mmWzcOtU7GoRjgozOEsfyinOp 9ro3ATb4PLbzhl9uiFOVK06qitAiu/Mi1eUZFXiXXVIm4+7O2yLRiVp1bRsWcTfX78rK DLY6nDnzo1nrbX3EsRnRqdIMDzYAvthG4i+e9fs/HqRaKE1muHMjol4BHLjLqQ109lXp SNevO8JFQ6aQwZ9XQHaYctlSTldD6h3nsnqGiwK2RRTQWxAGu99Rz8DSkjCdX0p/3LjC +AEfIyDYw7hHYMOoQ0uxtRSWv9Rb6NlW87V3JhUSapgcbkWox/v+ZkI1X0eJl9iJ0Un5 iZ6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=y3LpvrqPMHTpFgWHeM6VHdWnvBHwIABqDsat0ivEWK0=; fh=Ep9OtI3hwH+mjkSKerJ++vABqu0V3puokxRkxJA5gW8=; b=S31c1nZBDuWsbQuMIBwcr0hsypGUbWZzLJktUBIevXbN6bbzdspgXjfn1phrCQ/za1 p7HSraGG8U1OUsibgJdXPyU2HHsfImJ+IyxNN8z+3TycvDYBtMnHJ1/mKYPqo+ZarIIS 06xYIyBWNM96GSQwlB2HkiUc6Cq8SXrXkecCFivl2V1QL/M47pzibwwuBu2H2/58JZ4K L3jeBuq9L2rF3mr7Muuh2+UwIsY614HUpaSnXKTO8t4euARHgM0OW3r+t4fMC3fHwpeg HrhGeVUq8/7j/Tk0PynL/i5OCPqJt4LcMj4xg0/87cAOhEfShYxBc3XqY7jggY7UDX8C RBEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oK+WEWb7; spf=pass (google.com: domain of linux-kernel+bounces-520-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-520-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id r9-20020a05622a034900b004257a107643si18440557qtw.426.2023.12.14.23.32.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 23:32:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-520-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oK+WEWb7; spf=pass (google.com: domain of linux-kernel+bounces-520-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-520-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9FCB51C2132E for ; Fri, 15 Dec 2023 07:32:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A59F101E4; Fri, 15 Dec 2023 07:31:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oK+WEWb7" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCCADD2F0 for ; Fri, 15 Dec 2023 07:31:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a1d2f89ddabso40383466b.1 for ; Thu, 14 Dec 2023 23:31:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1702625500; x=1703230300; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=y3LpvrqPMHTpFgWHeM6VHdWnvBHwIABqDsat0ivEWK0=; b=oK+WEWb7yYhqHH8CkLL+1rpsbBvE7Yb3cM6grtxi48LC4dU+4d3vkV7lPITOdxLW1O bWqNbvd2+PwtJh11J49SeLZpApDLR55cY0ylzey7fWFrWBmKLyvNu10OtxVqEYsH7VvO XudGHcALJ5OmSKcZdW0m/ndVQRzU3n+HnjBxVMJExnpVVW3znzKv76iBPd9UyTtQUonr 9BGRyTGD2LozK1/keBUvFwiIjOMt8VHkY52+jGfTVufJXoxhjiXxwUXzyqgC42gC9tvy LzghMz4wvuMaaMZBOPm5WGnvmUcUcvBGCVv48TZhpFOO4iOJlHMKtdqo8cnS9JKfhTTS bXDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702625500; x=1703230300; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=y3LpvrqPMHTpFgWHeM6VHdWnvBHwIABqDsat0ivEWK0=; b=DPVZmIQaTSEpY9kVPoaGrSk69yaZQ3aTO7cOfhij0zxkf7OLkD1S8pxZUUOuvhSoFg A1ScfHnQQXgbG/AjFhmSd9OmuTrWVmpfWvrP+IE42Cn2oZbzJNEymrtxLldwUC4etrno 3ln56F4R4GGGB+LRQdvcfFlxQK5BvAYd+4KYmQw3Qr5PnukcmWCsAVgr4vos83FRvZGr Z0ziV6fgFazMyYEEVXORRBdrx54r+YHzajQaaYHmpdga7laCg7rxsfI28BAs30bX1YGi Y0vt4Mz399UN13i2lZv57ZJQLDEI2N/+4Vd+hSetxciw1AIXMIEGjV0MD+D4GVQZJhQQ VM1w== X-Gm-Message-State: AOJu0YxhPigklyDQ3XwoG03xsQ/k3g76dSPjt/hLRphvpjjA5QW81sXP MyKOLz/lklt+fshJF4gYEGt2hQ== X-Received: by 2002:a17:907:7677:b0:a09:589f:8853 with SMTP id kk23-20020a170907767700b00a09589f8853mr5786522ejc.66.1702625499973; Thu, 14 Dec 2023 23:31:39 -0800 (PST) Received: from hades.. (ppp089210121239.access.hol.gr. [89.210.121.239]) by smtp.gmail.com with ESMTPSA id vc11-20020a170907d08b00b00a1ce58e9fc7sm10372337ejc.64.2023.12.14.23.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 23:31:39 -0800 (PST) From: Ilias Apalodimas To: netdev@vger.kernel.org Cc: linyunsheng@huawei.com, Ilias Apalodimas , Jesper Dangaard Brouer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Subject: [PATCH net-next] page_pool: Rename frag_users to frag_cnt Date: Fri, 15 Dec 2023 09:31:19 +0200 Message-Id: <20231215073119.543560-1-ilias.apalodimas@linaro.org> X-Mailer: git-send-email 2.37.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785332261369531111 X-GMAIL-MSGID: 1785332261369531111 Since [0] got merged, it's clear that 'pp_ref_count' is used to track the number of users for each page. On struct_page though we have a member called 'frag_users'. Despite of what the name suggests this is not the number of users. It instead represents the number of fragments of the current page. When we have a single page this is set to one. When we split the page this is set to the actual number of frags and later used in page_pool_drain_frag() to infer the real number of users. So let's rename it to something that matches the description above [0] Link: https://lore.kernel.org/netdev/20231212044614.42733-2-liangchen.linux@gmail.com/ Signed-off-by: Ilias Apalodimas --- include/net/page_pool.h | 2 +- net/core/page_pool.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) -- 2.37.2 diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 813c93499f20..957cd84bb3f4 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -158,7 +158,7 @@ struct page_pool { u32 pages_state_hold_cnt; unsigned int frag_offset; struct page *frag_page; - long frag_users; + long frag_cnt; #ifdef CONFIG_PAGE_POOL_STATS /* these stats are incremented while in softirq context */ diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 9b203d8660e4..19a56a52ac8f 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -659,7 +659,7 @@ EXPORT_SYMBOL(page_pool_put_page_bulk); static struct page *page_pool_drain_frag(struct page_pool *pool, struct page *page) { - long drain_count = BIAS_MAX - pool->frag_users; + long drain_count = BIAS_MAX - pool->frag_cnt; /* Some user is still using the page frag */ if (likely(page_pool_defrag_page(page, drain_count))) @@ -678,7 +678,7 @@ static struct page *page_pool_drain_frag(struct page_pool *pool, static void page_pool_free_frag(struct page_pool *pool) { - long drain_count = BIAS_MAX - pool->frag_users; + long drain_count = BIAS_MAX - pool->frag_cnt; struct page *page = pool->frag_page; pool->frag_page = NULL; @@ -721,14 +721,14 @@ struct page *page_pool_alloc_frag(struct page_pool *pool, pool->frag_page = page; frag_reset: - pool->frag_users = 1; + pool->frag_cnt = 1; *offset = 0; pool->frag_offset = size; page_pool_fragment_page(page, BIAS_MAX); return page; } - pool->frag_users++; + pool->frag_cnt++; pool->frag_offset = *offset + size; alloc_stat_inc(pool, fast); return page;