Subject: Re: [PATCH net-next] net: page_pool: add pages and released_pages counters

From: Jakub Kicinski <[email-masked]>
Date: Mon, 17 Apr 2023 11:12:04 -0700

On Sat, 15 Apr 2023 13:16:40 +0200 Lorenzo Bianconi wrote:
> > What about high order? If we use bulk API for high order one day, 
> > will @slow_high_order not count calls like @slow does? So we should
> > bump the new counter for high order, too.  
> 
> yes, right. AFAIU "slow_high_order" and "slow" just count number of
> pages returned to the pool consumer and not the number of pages
> allocated to the pool (as you said, since we do not use bulking
> for high_order allocation there is no difference at the moment).
> What I would like to track is the number of allocated pages
> (of any order) so I guess we can just increment "pages" counter in
> __page_pool_alloc_page_order() as well. Agree?

Yup, that sounds better.

> > Which makes it very similar to pages_state_hold_cnt, just 64bit...  
> 
> do you prefer to use pages_state_hold_cnt instead of adding a new
> pages counter?

No strong preference either way. It's a tradeoff between saving 4B 
and making the code a little more complex. Perhaps we should stick 
to simplicity and add the counter like you did. Nothing stops us from
optimizing later.