Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp405518rdb; Tue, 19 Dec 2023 23:57:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IG8M4zq0UK6v4420BoUKNH7AgfCAM4qt1DJRymLOyodN63QOzx9sUJQD+C00dwmwo9jR8+V X-Received: by 2002:a17:903:41cf:b0:1d3:b609:eb0a with SMTP id u15-20020a17090341cf00b001d3b609eb0amr3561599ple.23.1703059050164; Tue, 19 Dec 2023 23:57:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703059050; cv=none; d=google.com; s=arc-20160816; b=PAdNJPxI7nKjxBcsKpUuyjuT/R8NOdw0p8nmh45+eaVTxAfChKI5tRwmibA6EpYe33 aGl99olhdZLcdy2M3hA6MdHgmtCpd3jxpcWf6CXWq0Q/w/Ha5Ebr3QzpgRXkKs9pC8WZ BUauLK5OI65VQQmZ28mh5eGbEEew9/mvua9sV/XS6lm6bMARFNrRPNto+TsS/lhgZX42 Q+BHLXjdplAVcjQ4awrKV+BD1EY578rDWn9I0tRNy6ZMt8cZkIXRC31oXoG1chX7TIon 3RxmziKxgly0RoZ5k+QS7+3PwjMvV+BIKCvppqCfLs+0gthL16s+5UFginzKCrvC37I3 5C4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=xhzDs4fQYzZp/6r6fTf/FxMWbjIgjGBLAvcDTnyWS/c=; fh=xZiulu+bKXguaEns1I7J5eOx79NUGfw5B9pYJMKr3AY=; b=tSAzifsnJxmnWUroLa6xam/pGo0hMyaPhEgHF+B4mUOLFkzaeABFD/omGktpb0ep4M NCEUv+DvXEcx3fwqhUYpe+Sv3bOtfRWbTSKAXZ9TQAT09xJyp7S1wq0+zXpS5MyYt5SF dr6ISLSQ2f1+28wRqDP7vVJlHMSkl04eSJqLBMjW8TiJA2lhj2DhL/QmwHrcHITFvxCu SqrcRmEOKd1kIk75sSn64B9buXzhQyz1XdN/FiibwX6pZx0pOA8IABppGTVkVvk51NK+ gtpHRpliyi06Ejjhk9/NBFuyGdQ/DVx7IYg6j6nnW0p4L8OhuDorFWCe117CIVDAz+qz 4e7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zzLyB38g; spf=pass (google.com: domain of linux-kernel+bounces-6521-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6521-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id v6-20020a170902b7c600b001d3e80ddea9si1529504plz.585.2023.12.19.23.57.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 23:57:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6521-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zzLyB38g; spf=pass (google.com: domain of linux-kernel+bounces-6521-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6521-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E1F4FB24568 for ; Wed, 20 Dec 2023 07:57:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E89A01CA91; Wed, 20 Dec 2023 07:57:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zzLyB38g" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 898281CA8E for ; Wed, 20 Dec 2023 07:57:16 +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-lf1-f51.google.com with SMTP id 2adb3069b0e04-50e18689828so6171402e87.2 for ; Tue, 19 Dec 2023 23:57:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703059034; x=1703663834; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=xhzDs4fQYzZp/6r6fTf/FxMWbjIgjGBLAvcDTnyWS/c=; b=zzLyB38gxCR1ktyw7qfpvJqxRMvPIkZh7s6RvZ0taXE60ZJ8SG1YNGS5U+7wvU0M3R C37tgSFZc3Sjsaeq5guxABhsnjAZLeoRAdO3vS0VgMt1aCLsqB5df+zF/FXNPm4xVAU6 G74CWk638IYR1k4m2VbrfP85bX3Fz99Vyzu9jgkqS0g6sSzoiHyV7fDH90rsPqTHQfWE DXzNiisaATuu0K1MlXjR3moPzWxQ6rMdf50+gJdmU28NcOf8FNteU5ZJUxf15BvDKH8U IVkNMTyhcdhx66YIviX+ovgD2DIwgHnNtnHCu/kAeQbZkOUe3IjZBRsCvPEZdPQzsWIO HwkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703059034; x=1703663834; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xhzDs4fQYzZp/6r6fTf/FxMWbjIgjGBLAvcDTnyWS/c=; b=hWXs476gGIEk9DzYdTtdBIMRu+mh8ZH/2wxGdyN9PvYzvk4xDcIFTqBhHBSfoU5JF9 wqYJiOJzqQo5tmv8BPJ39dPXvOZVIAktamDUMpz8EEZwjBVjE8mZlyfZ2wkPtyG7db8M +4sNCLT6YK0urYpKTI90gJegi9Az4RN/2lJm/EdlZVzVcgUA6hEVQ3MBrtduWrJQZk5z OV1hJwoE+KXl7bBU29tLUMiNW38ZATgWFu27Qqj5FyZhQcZZfwoCeL3N627Nn2NQTM2s 0QA3Ua13b3e1pWsRaK25tuj/rIi/ujYoeEoAGaktrkMD21VlvlNOiNINOh5xGlaBTRha uCYQ== X-Gm-Message-State: AOJu0Yyu8NZZPgKq6+CCDtuYN2jHYiTwj0wiVJfxCYG48mKGcaJVocIG DwKDiB0KJOHNZj/ADkLHa+ZsyUC78ew0pnyq0+KtegEhProGJjR6 X-Received: by 2002:ac2:562c:0:b0:50e:3b91:99a1 with SMTP id b12-20020ac2562c000000b0050e3b9199a1mr2022467lff.86.1703059034592; Tue, 19 Dec 2023 23:57:14 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231215073119.543560-1-ilias.apalodimas@linaro.org> <6fddeb22-0906-e04c-3a84-7836bef9ffa2@huawei.com> In-Reply-To: From: Ilias Apalodimas Date: Wed, 20 Dec 2023 09:56:38 +0200 Message-ID: Subject: Re: [PATCH net-next] page_pool: Rename frag_users to frag_cnt To: Yunsheng Lin Cc: netdev@vger.kernel.org, Jesper Dangaard Brouer , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Hi Yunsheng, On Fri, 15 Dec 2023 at 14:34, Yunsheng Lin wrote: > > On 2023/12/15 19:58, Ilias Apalodimas wrote: > > Hi Yunsheng, > > > > On Fri, 15 Dec 2023 at 13:10, Yunsheng Lin wrote: > >> > >> On 2023/12/15 15:31, Ilias Apalodimas wrote: > >>> 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(-) > >>> > >>> 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; > >> > >> I would rename it to something like refcnt_bais to mirror the pagecnt_bias > >> in struct page_frag_cache. > > > > Sure > > > >> > >>> > >>> #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; > >> > >> drain_count = pool->refcnt_bais; > > > > I think this is a typo right? This still remains > > It would be better to invert logic too, as it is mirroring: > > https://elixir.bootlin.com/linux/v6.7-rc5/source/mm/page_alloc.c#L4745 This is still a bit confusing for me since the actual bias is the number of fragments that you initially split the page. But I am fine with having a common approach. I'll send the rename again shortly, and I can send the logic invert a bit later (or feel free to send it, since it was your idea). Thanks /Ilias