From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AEF0CCAC59A for ; Fri, 19 Sep 2025 10:31:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 171F38E0147; Fri, 19 Sep 2025 06:31:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1226A8E006B; Fri, 19 Sep 2025 06:31:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2C5B8E0147; Fri, 19 Sep 2025 06:31:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id DD4EC8E006B for ; Fri, 19 Sep 2025 06:31:02 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 8E7E6160622 for ; Fri, 19 Sep 2025 10:31:02 +0000 (UTC) X-FDA: 83905631964.12.2B44854 Received: from fra-out-015.esa.eu-central-1.outbound.mail-perimeter.amazon.com (fra-out-015.esa.eu-central-1.outbound.mail-perimeter.amazon.com [18.158.153.154]) by imf13.hostedemail.com (Postfix) with ESMTP id 2B0CA20008 for ; Fri, 19 Sep 2025 10:30:59 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazoncorp2 header.b=kuQ4pejF; spf=pass (imf13.hostedemail.com: domain of "prvs=35013cc75=farbere@amazon.com" designates 18.158.153.154 as permitted sender) smtp.mailfrom="prvs=35013cc75=farbere@amazon.com"; dmarc=pass (policy=quarantine) header.from=amazon.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1758277860; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=0AzpApDbX8CFEbC2P7WHNPH2gra+XDIh1eSQ6GUhJZw=; b=rJDL2rr4mYlYBviYSewxN/x3mRQr1adFqe4hgHahNs4e19tFSohSOgrMP85dtK3uVZgE9B Fi1RTBqdxNUKbHWCZLfenyYe/1nMFven53diWFw0Vci06Wy9t0+At8e+DQ71w325A6pMXS T6AKY6D68LOS6IiCYo4gSNJSN64gKVw= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazoncorp2 header.b=kuQ4pejF; spf=pass (imf13.hostedemail.com: domain of "prvs=35013cc75=farbere@amazon.com" designates 18.158.153.154 as permitted sender) smtp.mailfrom="prvs=35013cc75=farbere@amazon.com"; dmarc=pass (policy=quarantine) header.from=amazon.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1758277860; a=rsa-sha256; cv=none; b=JBWaFNi7++1D+/DdWDkOpzcNhcKFcCBL+AIex+uttgC0OSFyo50VYuD8G197M8t3i5k+js BJaLFXKavMoJYAwizB0QxIB9ECrlLAvLFN5e2G/onvaKZyQlGraFmk6s8ZXdpv1jcLCS9f 9iFYd+6FB54+LwlbNtBdKPEAAq3D91E= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1758277860; x=1789813860; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0AzpApDbX8CFEbC2P7WHNPH2gra+XDIh1eSQ6GUhJZw=; b=kuQ4pejFDhpOwF1yQyxXV+YLrMgLs4pMzVdyPWwgyTNpDXG+XVHG8yGB v7QWbaLFKqQQD8X9fLAbOR49t+0EL4to0oO0cZ+RAQmz29gHQyCZVSePD WN0vDZpD5/SjQoGnuB/+2kmeUs+dfj3ibg405IC53gL/aP6YejbhdWgjx +mb0nr5h/G1dG5hQOLf6W69Na+hKRQjeNVBKaQdii9z6AQwp8EqQXAJA4 jWcpfqfw7azTgvNSoLsJJyU1pF8SEOCPaWiQWBDWpmi+VVVbgT4SuBqNB FMrc7SBCmj+uYdbXCVw62P13Ei1cRKsMzhd3bm01XkhWiwAanIM4WhCtr A==; X-CSE-ConnectionGUID: 84db8Rn2REO41Gd+36dyqw== X-CSE-MsgGUID: 5haEWmmnR/a9oLzBFFYksg== X-IronPort-AV: E=Sophos;i="6.18,277,1751241600"; d="scan'208";a="2256665" Received: from ip-10-6-11-83.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.11.83]) by internal-fra-out-015.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2025 10:30:58 +0000 Received: from EX19MTAEUB002.ant.amazon.com [54.240.197.224:10146] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.1.3:2525] with esmtp (Farcaster) id 11fa9bd4-f8b9-455d-948e-95865f7b3639; Fri, 19 Sep 2025 10:30:58 +0000 (UTC) X-Farcaster-Flow-ID: 11fa9bd4-f8b9-455d-948e-95865f7b3639 Received: from EX19D018EUA004.ant.amazon.com (10.252.50.85) by EX19MTAEUB002.ant.amazon.com (10.252.51.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 19 Sep 2025 10:30:47 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by EX19D018EUA004.ant.amazon.com (10.252.50.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 19 Sep 2025 10:30:18 +0000 From: Eliav Farber To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , Arnd Bergmann , Christoph Hellwig , Dan Carpenter , Jens Axboe , Lorenzo Stoakes , "Mateusz Guzik" , Pedro Falcato Subject: [PATCH 22/27 5.10.y] minmax.h: update some comments Date: Fri, 19 Sep 2025 10:17:22 +0000 Message-ID: <20250919101727.16152-23-farbere@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250919101727.16152-1-farbere@amazon.com> References: <20250919101727.16152-1-farbere@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.19.116.181] X-ClientProxiedBy: EX19D038UWC001.ant.amazon.com (10.13.139.213) To EX19D018EUA004.ant.amazon.com (10.252.50.85) X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 2B0CA20008 X-Stat-Signature: 8aaknytttz3i9nwud646kn1edoqag1tt X-HE-Tag: 1758277859-749929 X-HE-Meta: U2FsdGVkX1+Ze0ApPuBWw9lx/w33c9iHhfX3ZXBxw3kkn+5ZLNL/O4NNuHBuzqHMEvGd8RjUWkU+3Rrx4jfLz5VvsRU+GdOopM6dUbHDBQdsZT4vZNejtu4LDSy4rZBppO9EjiT8qTx4cG74POvzoXaoAVJ4HDg0OBWn/bdVDCMkAcsXG7a7eI9cNJfe4WHxW7oqHQtf3jIH544KdxS1ludHqfQ68l1Fax9N+/eFAAgxWqFFdNCYNd8FQkgTfzcbTQOIDJ1aEIjKnpJhnvLb/5qpe/USKA9VLfLomqYOGSppCigrOQOmo7mJe5+kras1/XbMeCSqjHvcIZLQkXpQOy9xMpbKN4Y+sBOAO2k5vtXlIHzCNhCbUASsvV/T3z05b11lq3lJ4y1G5m+Ey1AY4V/eAt2sNoVGYJkB6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MSDvvAL7gM03f21ihG8HVuKUYP84XCW5uNhrcI3KPMbLgFspPfLazxKO8igz2IMloLjZ1AR3kENjKh+HCd3Rl0un32rSXyCYs3d4t1apDQLYJkv+q8OXNMpmSUv2sEXVTMieZZQe7905mpf/HMsL0kEjs30mb5dfa30F9iwWcXAtAavYBrwcOLb8qmH/jLdKoVmxEKM7EEyaDXXfI4kGUUBAjAyev9FWKAtb5NZcO5Qo3a vPZdZx/4 ddaoS6gz5XjQSiG3rcExkAfw5UHKWrfBVIh6w/fuZd7RC2E85GYvVl+T807CKpnrTVHroJNFk8Ws+pkrJilE54G44vP6cPiLlcHvKavtkBDRovPAjRNp2WEBu+enXp0Bpca7ni52h1eNMxipcU8UU0jyONy2by/0+LKeHpN/qHqscyhdyE/LGEGE38rFG1mKeTFLivm7pgItcF6wJaqrdLyBAqWnYlij3wpqDBYyI9sfl4Llw9pUb/NYQIzTuA8LJz1KKS4pO4PiEfQu74Iz4OQRGOvL71VtUn2qH8kx9a4D+aTqV8Tzb4O4fcgF/iV/NhsaInzXIcBfHb/9s4CSAG/Ypc80OwtZQxACNbpiTnUaJF0H/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: David Laight [ Upstream commit 10666e99204818ef45c702469488353b5bb09ec7 ] - Change three to several. - Remove the comment about retaining constant expressions, no longer true. - Realign to nearer 80 columns and break on major punctiation. - Add a leading comment to the block before __signed_type() and __is_nonneg() Otherwise the block explaining the cast is a bit 'floating'. Reword the rest of that comment to improve readability. Link: https://lkml.kernel.org/r/85b050c81c1d4076aeb91a6cded45fee@AcuMS.aculab.com Signed-off-by: David Laight Cc: Andy Shevchenko Cc: Arnd Bergmann Cc: Christoph Hellwig Cc: Dan Carpenter Cc: Jason A. Donenfeld Cc: Jens Axboe Cc: Lorenzo Stoakes Cc: Mateusz Guzik Cc: Matthew Wilcox Cc: Pedro Falcato Signed-off-by: Andrew Morton Signed-off-by: Eliav Farber --- include/linux/minmax.h | 53 +++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/include/linux/minmax.h b/include/linux/minmax.h index 51b0d988e322..24e4b372649a 100644 --- a/include/linux/minmax.h +++ b/include/linux/minmax.h @@ -8,13 +8,10 @@ #include /* - * min()/max()/clamp() macros must accomplish three things: + * min()/max()/clamp() macros must accomplish several things: * * - Avoid multiple evaluations of the arguments (so side-effects like * "x++" happen only once) when non-constant. - * - Retain result as a constant expressions when called with only - * constant expressions (to avoid tripping VLA warnings in stack - * allocation usage). * - Perform signed v unsigned type-checking (to generate compile * errors instead of nasty runtime surprises). * - Unsigned char/short are always promoted to signed int and can be @@ -31,25 +28,23 @@ * bit #0 set if ok for unsigned comparisons * bit #1 set if ok for signed comparisons * - * In particular, statically non-negative signed integer - * expressions are ok for both. + * In particular, statically non-negative signed integer expressions + * are ok for both. * - * NOTE! Unsigned types smaller than 'int' are implicitly - * converted to 'int' in expressions, and are accepted for - * signed conversions for now. This is debatable. + * NOTE! Unsigned types smaller than 'int' are implicitly converted to 'int' + * in expressions, and are accepted for signed conversions for now. + * This is debatable. * - * Note that 'x' is the original expression, and 'ux' is - * the unique variable that contains the value. + * Note that 'x' is the original expression, and 'ux' is the unique variable + * that contains the value. * - * We use 'ux' for pure type checking, and 'x' for when - * we need to look at the value (but without evaluating - * it for side effects! Careful to only ever evaluate it - * with sizeof() or __builtin_constant_p() etc). + * We use 'ux' for pure type checking, and 'x' for when we need to look at the + * value (but without evaluating it for side effects! + * Careful to only ever evaluate it with sizeof() or __builtin_constant_p() etc). * - * Pointers end up being checked by the normal C type - * rules at the actual comparison, and these expressions - * only need to be careful to not cause warnings for - * pointer use. + * Pointers end up being checked by the normal C type rules at the actual + * comparison, and these expressions only need to be careful to not cause + * warnings for pointer use. */ #define __signed_type_use(x, ux) (2 + __is_nonneg(x, ux)) #define __unsigned_type_use(x, ux) (1 + 2 * (sizeof(ux) < 4)) @@ -57,19 +52,19 @@ __signed_type_use(x, ux) : __unsigned_type_use(x, ux)) /* - * To avoid warnings about casting pointers to integers - * of different sizes, we need that special sign type. + * Check whether a signed value is always non-negative. * - * On 64-bit we can just always use 'long', since any - * integer or pointer type can just be cast to that. + * A cast is needed to avoid any warnings from values that aren't signed + * integer types (in which case the result doesn't matter). * - * This does not work for 128-bit signed integers since - * the cast would truncate them, but we do not use s128 - * types in the kernel (we do use 'u128', but they will - * be handled by the !is_signed_type() case). + * On 64-bit any integer or pointer type can safely be cast to 'long'. + * But on 32-bit we need to avoid warnings about casting pointers to integers + * of different sizes without truncating 64-bit values so 'long' or 'long long' + * must be used depending on the size of the value. * - * NOTE! The cast is there only to avoid any warnings - * from when values that aren't signed integer types. + * This does not work for 128-bit signed integers since the cast would truncate + * them, but we do not use s128 types in the kernel (we do use 'u128', + * but they are handled by the !is_signed_type() case). */ #ifdef CONFIG_64BIT #define __signed_type(ux) long -- 2.47.3