Re: [PATCH net-next v8 07/17] net: page_pool: introduce page_pool_mp_return_in_cache

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 12/9/24 17:15, Mina Almasry wrote:
On Wed, Dec 4, 2024 at 9:22 AM David Wei <dw@xxxxxxxxxxx> wrote:
...
+/*
+ * page_pool_mp_return_in_cache() - return a netmem to the allocation cache.
+ * @pool:      pool from which pages were allocated
+ * @netmem:    netmem to return
+ *
+ * Return already allocated and accounted netmem to the page pool's allocation
+ * cache. The function doesn't provide synchronisation and must only be called
+ * from the napi context.
+ */
+void page_pool_mp_return_in_cache(struct page_pool *pool, netmem_ref netmem)
+{
+       if (WARN_ON_ONCE(pool->alloc.count >= PP_ALLOC_CACHE_REFILL))
+               return;
+

Really the caller needs to check this, and if the caller is checking
it then this additional check is unnecessarily defensive I would say.
But not really a big deal. I think I gave this feedback on the
previous iteration.

I think I already killed it. Nevertheless, that's true, the caller
has to check it, which is why it's a warning.

Reviewed-by: Mina Almasry <almasrymina@xxxxxxxxxx>

--
Pavel Begunkov





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux