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: <d1fe6fa4-da50-4899-8e2c-0721851c4e0d@lunn.ch>
Date: Fri, 19 Sep 2025 14:54:40 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Thorsten Blum <thorsten.blum@...ux.dev>
Cc: FUJITA Tomonori <fujita.tomonori@...il.com>,
	Trevor Gross <tmgross@...ch.edu>,
	Heiner Kallweit <hkallweit1@...il.com>,
	Russell King <linux@...linux.org.uk>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Boqun Feng <boqun.feng@...il.com>, Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <lossin@...nel.org>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Danilo Krummrich <dakr@...nel.org>, netdev@...r.kernel.org,
	rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] rust: net::phy inline if expressions to improve
 read_status

On Fri, Sep 19, 2025 at 01:20:08PM +0200, Thorsten Blum wrote:
> Inline the if expressions for dev.set_speed() and dev.set_duplex() to
> improve read_status(). This ensures dev.set_speed() is called only once

What is the issue of calling it twice, or 42 times??

> and allows us to remove the local variable 'duplex'.

And what is wrong with local variables?

And did you disassemble the code? What is the compiler actually doing?
Does it actually have a stack variable, or is it just a register? Does
the optimiser end up with just a single call to set_speed()?

This is slow path code. It gets called at most once per
second. Performance does not matter. Which means readability has much
higher preference. And i find the older version much easier to read.

	Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ