From patchwork Wed Dec 20 08:01:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilias Apalodimas X-Patchwork-Id: 181517 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2484224dyi; Wed, 20 Dec 2023 00:02:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IECLZLaMzbSacjN8IPVLoZnFuCcyNQl9qz9Gx+cLkjpKh2WJ8e1+EWE1sAO9HJlPyMYUn+E X-Received: by 2002:a05:6358:52d0:b0:172:b5f0:e904 with SMTP id z16-20020a05635852d000b00172b5f0e904mr7805311rwz.57.1703059367381; Wed, 20 Dec 2023 00:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703059367; cv=none; d=google.com; s=arc-20160816; b=LZCWTh9LCi7VV0ywKzIOuL5h2REno590Z7FV0Deg/v0jroIJ16Z2x+VMPKqaKyeL3o UAYhuZ7fQTSl3htFLRDfkbEo25mJSlkQaXmLcQJgSENUEdkFca5eDHRVVHto2wrQs6GQ qd3PqRtv5xFs6KP+vXg88SFGVNoOz5SmUXN9DxP7mPGbV+0Ep9rsjG8J96XdSGmn+o3W YVqVX5SML6iHRV6fj8LILTHh1+SS8/yTxQkuKa2c843L2ADnmqNLBFQUbMdzyPPL+uA7 aZCBDtvMtm10vqCTW+K1nJN/UO7Af3iHEXKR1SPq4Q+mL8+lQeq+4TYnIk48LmJ5UVd/ 2hvA== 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=Q6qwFojeAseZiqFw0AS/OLjMh8l70gGs83fGIX57eS8=; fh=Ep9OtI3hwH+mjkSKerJ++vABqu0V3puokxRkxJA5gW8=; b=eIw7TfLxwq5MVY2aYIT5ji210JEC43GUTLMmzTZUHVHLPo1Hfux+goXipygUjDSf/M bnohekaVweNFpa2g7yy3iB5uw8VLnxUlo3sb4cLF2Rxzias3eIsb1+p0x85wags4Vdmd V9KRF2u0DR2sJ/HtKmcP3UwgMk2B5yP/3mfFfBnZyOmD+4hWe+RM8k9++WlF/7jSA/XP 5/z/c6S/JE70sOb7FS+fCPN1MjlpdRdS+ebvcBbYAeGK8lvOiVhNcEU9oBJtetzUFOWm /O/JksoW9W5Xk8Y9HLVJwoziwXfPG/+UU9KekhBtkxgJ5Dg50aBtV7i2IsK7XGQgLz4Z T6Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vEu/s0jk"; spf=pass (google.com: domain of linux-kernel+bounces-6525-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6525-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bq7-20020a056a02044700b005cd8fa82040si5907591pgb.614.2023.12.20.00.02.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:02:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6525-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vEu/s0jk"; spf=pass (google.com: domain of linux-kernel+bounces-6525-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6525-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1CF702866B9 for ; Wed, 20 Dec 2023 08:02:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5C7361D550; Wed, 20 Dec 2023 08:01:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="vEu/s0jk" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 CFFC81CA9A for ; Wed, 20 Dec 2023 08:01:52 +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-f45.google.com with SMTP id a640c23a62f3a-a234dc0984fso392620866b.0 for ; Wed, 20 Dec 2023 00:01:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703059311; x=1703664111; 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=Q6qwFojeAseZiqFw0AS/OLjMh8l70gGs83fGIX57eS8=; b=vEu/s0jkPZHYqnslqSPpyyE9UgQFXq4gQvQR1QOwZE6hQewzkbHbs7q9d70Rk7vTfj 7nGSYzjZ6ZVLzBjoupf6FYlW+yAMR9eCvtZkGc+eI5oXRNBEBXSH8hyKZvoDEEMHLsV3 tUUav1/2J9t5yPsa3cYuG1mQ4ieI95FeijRcCvOPk8HubLDqLfAa/XwyrBgmMquNRB2W adHmrhCVMA09mSW4oqSPS5kQTh+VXPrnt7PqM0nQAu0VJ7hxifuIJ/DgWBp6XQvtE3jc CRPIlSmZZl/1laCnBlxJlclQGkj/8NkcrSnNjtVYjPKrxaFO8Y8ai9T/dlBjuCvxt1ad v3EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703059311; x=1703664111; 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=Q6qwFojeAseZiqFw0AS/OLjMh8l70gGs83fGIX57eS8=; b=Vp+Na6qFveQmM29HKhJgaRx01kCk5UZWF1+IQNKb8BAhkx5zsF9O0OWHWfAh+DK9dG SzSDKHgius0lRVlgzzWJaRrKHIpfi0S4d5RyulYLXipNr31FHTLnp7vDR6XcwbFate8G sVqfmlAaCJ7vR+doxLuFesJS9cSkjwaWK2K3AFsre05PXkwllvaXqxU/iwZYGpu9XKCS CMjCLrBhD1staD8NV6fE0Z7aeIPEOxDiQBsvI3XFEkQiFsfMoUErgkOew8frHBW0NPDg Py20wL9xZp4U2OIE8b4my+F49PJ+JeVx9yTLOQgZvfxnFnA2XU0hYb3fZr+uKQXeMIzL lIxw== X-Gm-Message-State: AOJu0YxVKJTfdT4mCyi1E6UfRtMTHcsdaShQ5zHtkZ61+eEoltjzcSvM vvAyVeQLMNh4SzBKMHumk1azxA== X-Received: by 2002:a17:906:257:b0:a23:48be:3eba with SMTP id 23-20020a170906025700b00a2348be3ebamr2540650ejl.142.1703059311081; Wed, 20 Dec 2023 00:01:51 -0800 (PST) Received: from hades.. (ppp089210121239.access.hol.gr. [89.210.121.239]) by smtp.gmail.com with ESMTPSA id wq8-20020a170907064800b00a2697aaac78sm223206ejb.30.2023.12.20.00.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Dec 2023 00:01:50 -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 v2] page_pool: Rename frag_users to pagecnt_bias Date: Wed, 20 Dec 2023 10:01:46 +0200 Message-Id: <20231220080147.740134-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: 1785787178907852421 X-GMAIL-MSGID: 1785787178907852421 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_pool 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 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 --- Changes since v1: - rename to pagecnt_bias instead of frag_cnt to match the mm subsystem - rebase on top of -main include/net/page_pool/types.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/types.h b/include/net/page_pool/types.h index 76481c465375..d47491ba973d 100644 --- a/include/net/page_pool/types.h +++ b/include/net/page_pool/types.h @@ -130,7 +130,7 @@ struct page_pool { bool has_init_callback; - long frag_users; + long pagecnt_bias; struct page *frag_page; unsigned int frag_offset; u32 pages_state_hold_cnt; diff --git a/net/core/page_pool.c b/net/core/page_pool.c index 4933762e5a6b..0e64d6b8e748 100644 --- a/net/core/page_pool.c +++ b/net/core/page_pool.c @@ -760,7 +760,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->pagecnt_bias; /* Some user is still using the page frag */ if (likely(page_pool_unref_page(page, drain_count))) @@ -779,7 +779,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->pagecnt_bias; struct page *page = pool->frag_page; pool->frag_page = NULL; @@ -821,14 +821,14 @@ struct page *page_pool_alloc_frag(struct page_pool *pool, pool->frag_page = page; frag_reset: - pool->frag_users = 1; + pool->pagecnt_bias = 1; *offset = 0; pool->frag_offset = size; page_pool_fragment_page(page, BIAS_MAX); return page; } - pool->frag_users++; + pool->pagecnt_bias++; pool->frag_offset = *offset + size; alloc_stat_inc(pool, fast); return page;