From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C46232FD1D0 for ; Thu, 26 Mar 2026 14:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774534515; cv=none; b=NUh+jseeUIoh/eVc0x80xbuHX5m3MCVGpgkeFugcq1VvhGgZHS0sdGxbMJu+m5oHsmPuE3z4u336Rk9FKWF0lBVwmy2SokV76CkWLVDB9PMk4Q1xEw7AvP5mp7F9+V4WeVH8dxZhrlkBoD6yM9VuzuA9Y/0U2DASevFKY5/Wb28= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774534515; c=relaxed/simple; bh=8lIxdSy0Ncq/WRwa3NKuthYAxbMKKOx4g0MqvP4l3KI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ECXEBIi8UdjAizImpISJWPDvXfm8UxsdMScKRWKj3TJszq66V2mtI7bnFQ3TCBLoiGwNFfsdy+lNhQ7foONMhGyyG07RnFWGO0oMS0Ga84rh6qM80URrMmWbNJNToO3/ghdFcbj66dCSLWEzyPwPgI/weK19w8QuZlBrMn6/ijk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=O4wSBSdB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="O4wSBSdB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66030C116C6; Thu, 26 Mar 2026 14:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1774534515; bh=8lIxdSy0Ncq/WRwa3NKuthYAxbMKKOx4g0MqvP4l3KI=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=O4wSBSdBpslX0JdvIxEOd9admeOk2AsOE9d9sftkMJEoHD5KgfMVa2JlWFq9KS6vZ 2cmHtoOA4ZU6IWqh+aXO/ZPcXO1LW7bjmAjBbbOMxE4luHMN6MVxMBA5Cv7EA8YDKz uFews5aJIbZ9IKq2WlaZ8E5JQj2S293gPKCCohTWV+A+AIx+cSDLcizUZrRvaJFByF 4Tk22KTAlI+zdkS4KdsZ8RucDdkR0/xPf6X8wEOdGBv3CbsjCj6kF2nUDqDO3q59LR 91gJx/45kcfQbgzl1RRe25m55dMSFBcqdpFEM1GHCqEt96Ic55C7pRNDBHDP1zJh5w 67VjLxf28yOWQ== Message-ID: <1b04dc17-baa7-47cd-b10a-01ee5a2c79b3@kernel.org> Date: Thu, 26 Mar 2026 15:15:09 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] uaccess: minimize INLINE_COPY_USER-related ifdefery To: Yury Norov , Andrew Morton , Thomas Gleixner , "Peter Zijlstra (Intel)" , Mathieu Desnoyers , Alice Ryhl , Viktor Malik , Randy Dunlap , David Laight , linux-kernel@vger.kernel.org Cc: Yury Norov References: <20260325163313.749336-1-ynorov@nvidia.com> <20260325163313.749336-3-ynorov@nvidia.com> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: <20260325163313.749336-3-ynorov@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 25/03/2026 à 17:33, Yury Norov a écrit : > Now that we've got the same knob selecting inline vs outline copy_to_user() > and copy_from_user(), we can simplify the corresponding logic in the > uaccess.h. I think we should get rid of ifdefery completly, see below. And with comment to previous patch, __is_defined(INLINE_COPY_TO_USER) becomes !IS_ENABLED(CONFIG_ARCH_WANT_OUTLINE_USER_COPY) diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 327f967a24b8..02a05dd61a77 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h @@ -190,10 +190,9 @@ _inline_copy_from_user(void *to, const void __user *from, unsigned long n) memset(to + (n - res), 0, res); return res; } -#ifndef INLINE_COPY_FROM_USER + extern __must_check unsigned long _copy_from_user(void *, const void __user *, unsigned long); -#endif static inline __must_check unsigned long _inline_copy_to_user(void __user *to, const void *from, unsigned long n) @@ -207,21 +206,19 @@ _inline_copy_to_user(void __user *to, const void *from, unsigned long n) } return n; } -#ifndef INLINE_COPY_TO_USER + extern __must_check unsigned long _copy_to_user(void __user *, const void *, unsigned long); -#endif static __always_inline unsigned long __must_check copy_from_user_common(void *to, const void __user *from, unsigned long n, bool partial) { if (!check_copy_size(to, n, false)) return n; -#ifdef INLINE_COPY_FROM_USER - return _inline_copy_from_user(to, from, n); -#else - return _copy_from_user(to, from, n); -#endif + if (__is_defined(INLINE_COPY_FROM_USER)) + return _inline_copy_from_user(to, from, n); + else + return _copy_from_user(to, from, n); } static __always_inline unsigned long __must_check @@ -242,11 +239,10 @@ copy_to_user_common(void __user *to, const void *from, unsigned long n, bool par if (!check_copy_size(from, n, true)) return n; -#ifdef INLINE_COPY_TO_USER - return _inline_copy_to_user(to, from, n); -#else - return _copy_to_user(to, from, n); -#endif + if (__is_defined(INLINE_COPY_TO_USER)) + return _inline_copy_to_user(to, from, n); + else + return _copy_to_user(to, from, n); } static __always_inline unsigned long __must_check Christophe