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: <20230617000101.191ea52c@kernel.org>
Date: Sat, 17 Jun 2023 00:01:01 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: davem@...emloft.net, pabeni@...hat.com, edumazet@...gle.com,
 netdev@...r.kernel.org, Alan Brady <alan.brady@...el.com>,
 pavan.kumar.linga@...el.com, emil.s.tantilov@...el.com,
 jesse.brandeburg@...el.com, sridhar.samudrala@...el.com,
 shiraz.saleem@...el.com, sindhu.devale@...el.com, willemb@...gle.com,
 decot@...gle.com, andrew@...n.ch, leon@...nel.org, mst@...hat.com,
 simon.horman@...igine.com, shannon.nelson@....com,
 stephen@...workplumber.org, Joshua Hay <joshua.a.hay@...el.com>, Madhu
 Chittim <madhu.chittim@...el.com>, Phani Burra <phani.r.burra@...el.com>
Subject: Re: [PATCH net-next v2 12/15] idpf: add RX splitq napi poll support

On Wed, 14 Jun 2023 10:14:25 -0700 Tony Nguyen wrote:
> +static bool idpf_rx_can_reuse_page(struct idpf_rx_buf *rx_buf)
> +{
> +	unsigned int last_offset = PAGE_SIZE - rx_buf->buf_size;
> +	struct idpf_page_info *pinfo;
> +	unsigned int pagecnt_bias;
> +	struct page *page;
> +
> +	pinfo = &rx_buf->page_info[rx_buf->page_indx];
> +	pagecnt_bias = pinfo->pagecnt_bias;
> +	page = pinfo->page;
> +
> +	if (unlikely(!dev_page_is_reusable(page)))
> +		return false;
> +
> +	if (PAGE_SIZE < 8192) {
> +		/* For 2K buffers, we can reuse the page if we are the
> +		 * owner. For 4K buffers, we can reuse the page if there are
> +		 * no other others.
> +		 */
> +		if (unlikely((page_count(page) - pagecnt_bias) >
> +			     pinfo->reuse_bias))
> +			return false;
> +	} else if (pinfo->page_offset > last_offset) {
> +		return false;
> +	}
> +
> +	/* If we have drained the page fragment pool we need to update
> +	 * the pagecnt_bias and page count so that we fully restock the
> +	 * number of references the driver holds.
> +	 */
> +	if (unlikely(pagecnt_bias == 1)) {
> +		page_ref_add(page, USHRT_MAX - 1);
> +		pinfo->pagecnt_bias = USHRT_MAX;
> +	}
> +
> +	return true;
> +}

If you want to do local recycling you must use the page pool first,
and then share the analysis of how much and why the recycling helps.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ