Received: by 2002:ac8:4f0c:0:b0:427:7d78:cd45 with SMTP id b12csp239640qte; Thu, 21 Dec 2023 00:25:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IEoBQA7mTri8RG+AsgfAVvGfPVuOIHZivhvemnQ7gDyhiY68MnbhG/8VBgcupzt1L6jLlft X-Received: by 2002:a17:902:6bc6:b0:1d3:4cb4:facc with SMTP id m6-20020a1709026bc600b001d34cb4faccmr7538184plt.69.1703147103129; Thu, 21 Dec 2023 00:25:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703147102; cv=none; d=google.com; s=arc-20160816; b=yKnPerhmucR1obpkJoHDE8EKNZdnREMkJ3EnroQ6050M0Q+HQ7e+wT0j/lxu7TVbd/ LYfhKflOp0/QFs7bCc0Ji4rxVwejbO6RIFh1nYlxtbkeuaP1diCC513jjrJBlgR5oXJe UEkD75/g6MXlFRTM2W0C91x+RuDA36JSnGUeHrHw0DaUWJ7sFAubsssI321tQH01oxbT Y7ZkykLt8rTLx1H9BXJJzf3VQOF7DtC/FAHmUGT7H1RX9w7ITzI9pIf+DS69ReVOD8RX gwGxFmK8lT1KWPvPRVTzY+v6jmIvw5X8zUwx02ruQgoImUAEXCcQIjQ7TazQwCKL5mhF xanw== 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=nReyclRlr20uvqdA8j88GlQlcVhlaM1S7DNdsDOxZpw=; fh=xZiulu+bKXguaEns1I7J5eOx79NUGfw5B9pYJMKr3AY=; b=aKITNTjOhW5lrrXnjzzI0pCY84J0oH44dNZX7efQhhnyUku3IwlJw640kairHS2b19 NEURRwPuYgs43yTkpgKNIacnzmUinPW5BNw1e5Ss48sV+lYmo+KMmlDf3FbeHJM1EJwj /CLV//Gh4Mn2zw2l7UKBWG8aGb+jYzHDImd9sKr3LUpmScnUuu10hfgG28ckTtJYb7jt bR5gJu4FmP+JyDuckPIroZzdjpSPPzWvqH1Ar3hATCudXOsYxrkFsvO9hSkxAvN7cHn5 yeLg4A57ys2Lf+SUfOLy2VJIISXc8BRX1v5RUcAbNd+hOrEDxvwCMVgXLZ/bsoGFM6cJ IowA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XUEqTSM2; spf=pass (google.com: domain of linux-kernel+bounces-7992-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7992-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d11-20020a170902854b00b001d09278b856si1094598plo.347.2023.12.21.00.25.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 00:25:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-7992-linux.lists.archive=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=XUEqTSM2; spf=pass (google.com: domain of linux-kernel+bounces-7992-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-7992-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 3BE90285C47 for ; Thu, 21 Dec 2023 08:25:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08A4616438; Thu, 21 Dec 2023 08:24:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="XUEqTSM2" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 7F37E17735 for ; Thu, 21 Dec 2023 08:24:51 +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-f49.google.com with SMTP id 2adb3069b0e04-50c0f13ea11so653193e87.3 for ; Thu, 21 Dec 2023 00:24:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703147089; x=1703751889; 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=nReyclRlr20uvqdA8j88GlQlcVhlaM1S7DNdsDOxZpw=; b=XUEqTSM2K3GWhivadS/BT+u4fICgepMtlhZeYZccBFVEGdKIIdakKmgLRW48VO7/Om Vvkr02RybpaOG3bgYjUWtfqksKSbBPSmt3EuwZ+sYY5ADg+n5yM/WPcDTmRFjDi8L5bU WpDPJLDv97PYOdRu9v6io2nPY5tip5C5UTo4vVlAUZlARghqx+i4Yw1nxRQuEyv+tqWJ 77U0ukDBgoDx8qnCyoNleojJ4Fey48WwF/kdYHC9XnHWa7brqQ+4Ha9BBWWiur8FGp5t L3XHp/5m9/2pjziL3ML9jj/0PYPxEKXT54ZpIaNWqE2xahshkQLidK9YYo7xU8w+rWrb Vzcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703147089; x=1703751889; 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=nReyclRlr20uvqdA8j88GlQlcVhlaM1S7DNdsDOxZpw=; b=uPwxxtDSszfOk7cvSxwAAbjWLn0XQ/RH9iUhPAz9uub+DYal1hsupAgwmqCSrZS9dY ZmXMcDnST1y0Ahxf2n+vh3HQkE5maZbTmBY1NRtAVGERGlY9PJ0JULmPLZykDManhlEX kPmNCkjHB3tIJxWrT9KllOmbbo+sPzpI6eBEVrXjIalRQkq6Jr5QfMbS1mLSbQIhrW0a Z/v7BTWgvj6m/lxEThpTmcMCDqKiEtNPIhnHO6F4HrvYKWDHrfJH6e9brdH/562esreL fBI6wlybDzxu2DcL2HLi6JEp+AszeTpmGJU5PkUucEhGHtCkTXcLEjIe26Z4FTGy+NQu /dnA== X-Gm-Message-State: AOJu0YzzR8sbkTtoeG5ttTF5krTJlcPYmu/r6u8GaSPa8Ubxu17mNKvO 3gZkXjdX1U8eJRq0KYqGZqBV48dPCryfvX0DpetiTA== X-Received: by 2002:a05:6512:3e08:b0:50e:54af:a09 with SMTP id i8-20020a0565123e0800b0050e54af0a09mr1431677lfv.69.1703147089585; Thu, 21 Dec 2023 00:24:49 -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> <0dfffe91-2bd4-2151-cf71-ef29bf562767@huawei.com> In-Reply-To: <0dfffe91-2bd4-2151-cf71-ef29bf562767@huawei.com> From: Ilias Apalodimas Date: Thu, 21 Dec 2023 10:24:13 +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 Thu, 21 Dec 2023 at 10:00, Yunsheng Lin wrote: > > On 2023/12/21 14:37, Ilias Apalodimas wrote: > > Hi Yunsheng, > > > > On Thu, 21 Dec 2023 at 04:07, Yunsheng Lin wrote: > >> > >> On 2023/12/20 15:56, Ilias Apalodimas wrote: > >>> Hi Yunsheng, > >>>>>>> #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 > >> Acctually there are two bais numbers for a page used by > >> page_pool_alloc_frag(). > >> the one for page->pp_ref_count, which already use the BIAS_MAX, which > >> indicates the initial bais number: > >> https://elixir.bootlin.com/linux/latest/source/net/core/page_pool.c#L779 > >> > >> Another one for pool->frag_users indicating the runtime bais number, which > >> need changing when a page is split into more fragments: > >> https://elixir.bootlin.com/linux/latest/source/net/core/page_pool.c#L776 > >> https://elixir.bootlin.com/linux/latest/source/net/core/page_pool.c#L783 > > > > I know, and that's exactly what my commit message explains. Also, > > that's the reason that the rename was 'frag_cnt' on v1. > > > > Yes, I think we do not need to invert logic when the naming is frag_users > or frag_cnt. > frag_users is kind of wrong, because 'users' basically means refcnt. frag_cnt on the other hand is clear. It shows the number of fragments we split the page. But we are in bikeshedding territory now :) > But if we use 'bias' as part of the name, isn't that more reasonable to set > both of the bias number to BIAS_MAX initially, and decrement the runtime > bais number every time the page is split to more fragments? I think it's a matter of taste and how you interpret BIAS_MAX. In any case, page_pool_drain_frag() will eventually set the *real* number of references. But since the code can get complicated I like the idea of making it identical to the mm subsystem tracking. Can we just merge v2 and me or you can send the logic inversion patches right after. They are orthogonal to the rename anyway Cheers /Ilias > > >