lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241209194057.161e9183@kernel.org>
Date: Mon, 9 Dec 2024 19:40:57 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: David Wei <dw@...idwei.uk>
Cc: io-uring@...r.kernel.org, netdev@...r.kernel.org, Jens Axboe
 <axboe@...nel.dk>, Pavel Begunkov <asml.silence@...il.com>, Paolo Abeni
 <pabeni@...hat.com>, "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Jesper Dangaard Brouer <hawk@...nel.org>, David
 Ahern <dsahern@...nel.org>, Mina Almasry <almasrymina@...gle.com>,
 Stanislav Fomichev <stfomichev@...il.com>, Joe Damato <jdamato@...tly.com>,
 Pedro Tammela <pctammela@...atatu.com>
Subject: Re: [PATCH net-next v8 07/17] net: page_pool: introduce
 page_pool_mp_return_in_cache

On Wed,  4 Dec 2024 09:21:46 -0800 David Wei 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.

NAPI is irrelevant, this helper, IIUC, has to be called down the call
chain from mp_ops->alloc().

> + */
> +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;

I'd

	return false;

without a warning.

> +	page_pool_dma_sync_for_device(pool, netmem, -1);
> +	page_pool_fragment_netmem(netmem, 1);
> +	pool->alloc.cache[pool->alloc.count++] = netmem;

and here:

	return true;

this say mps can use return value as a stop condition in a do {} while()
loop, without having to duplicate the check.

	do {
		netmem = alloc...
		... logic;
	} while (page_pool_mp_alloc_refill(pp, netmem));

	/* last netmem didn't fit in the cache */
	return netmem;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ