This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Sun Jun 9 11:46:31 2024 >From mailfetcher Fri Jan 12 13:16:39 2024 Authentication-Results: pi4.bmw12.nl; dmarc=fail (p=none dis=none) header.from=ACULAB.COM R-Authentication-Results: VERIFYING; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=aculab.com (policy=none); spf=pass (VERIFYING: domain of "linux-kernel+bounces-24645-lkml=bmw12.nl@vger.kernel.org" designates 139.178.88.99 as permitted sende Received: from secure.jasper.es [188.166.10.231] by 1dc7d414a5be with IMAP (fetchmail-6.3.26) for (single-drop); Fri, 12 Jan 2024 13:16:39 +0100 (CET) Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org [139.178.88.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pi4.bmw12.nl (Postfix) wit Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 40192286C8A for To: 'Dan Carpenter' Cc: "linux-kernel@vger.kernel.org" , "Linus Torvalds" , 'Andy Shevchenko' , 'Andrew Morton' , "'Matthew Wilcox (Oracle)'" References: <918545c4-0870-4ea5-ab11-53eaed91aec7@moroto.mountain> In-Reply-To: <918545c4-0870-4ea5-ab11-53eaed91aec7@moroto.mountain> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: list-unsubscribe: Mime-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Action: no action X-Rspamd-Server: pi4 X-Rspamd-Queue-Id: 32B3C3F04E X-Spamd-Result: default: False [-0.76 / 6.00]; RCVD_IN_DNSWL_MED(-0.40)[52.25.139.140:received,139.178.88.99:from]; R_SPF_ALLOW(-0.20)[+ip4:139.178.88.99:c]; MAILLIST(-0.15)[generic]; MIME_GOOD(-0.10)[text/plain]; DMARC_POLICY_SOFTFAIL(0.10)[aculab.com : SPF not aligned From: Dan Carpenter > Sent: 12 January 2024 09:13 >=20 > I've often wondered why so many people use min_t(int, size, limit) when > they really do not want negative sizes... Is there a performance reason? > git grep 'min_t(int,' says there are 872 instances of this. Probably > some do want negatives but it's a quite small percent. But you really don't a negative 'size' converted to a large unsigned value above the limit - that would be worse. All the type checking is there to stop that happening. Even with my changes min(int_var, sizeof()) is a compile error. To do otherwise would really requite the sizeof() to be converted to int - leaving the other type alone. Easiest done by using 'int' instead of 'typeof(y)' for the local variable inside cmp_once(). However Linus didn't like that change so I removed it from the version that got committed. It would also bloat the expansion even more. That could be reduced by expecting min(var, const) not min(const, var) and only doing all the constant checks on the second argument. FWIW min_t() should really skip all the type checks. Once both value have been cast the 'same type' test will pass. =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)