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 7B3CB44D034 for ; Tue, 10 Mar 2026 10:25:53 +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=1773138353; cv=none; b=j3NTkB2TQu9JGz9SSJ5MbzC0cJw8sVJgBx2sSRfSuVuNSI5XeCjXERgb2+TvRxz+VSznrEVa4jOphlzjG2qWZHloVzyGxTbi3TQnqQNgxe4C4QfxDna1jnSoKNZPrBpuctS0YFTc8klAOQQvii9r+oaPOL/h2uNJKmNOPaIa8nQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773138353; c=relaxed/simple; bh=xtHvcFEJmn8uHGe5KG4mMvBZ2ApSldleb3V33LgLiAw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=tQ9fwgP84I2t02GJU5JTWs7PPrWwCwfKpOk5QXAg35kk/dJ4hDfByAZx4NBByeA2lcJOKViaDaYRVLHbLFMFpxXttivaJNJ/lqoMy8+QVNXYQN6JQY2O/nLr73kQk3M7jUVXFIrH6O2BnohxycttNN1EQx1Pc1A96m3RXteHHgs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IVL9p22s; 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="IVL9p22s" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EAE4C2BC9E; Tue, 10 Mar 2026 10:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773138353; bh=xtHvcFEJmn8uHGe5KG4mMvBZ2ApSldleb3V33LgLiAw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=IVL9p22shk9WLXD6yvGynmYFsVx4lbnwEKwJokwhuMs9ZhvN+riaacPdtAVdmoOV8 XkOBHB46Ptam4jhLeNoHIN9DZt0GrHMEZ2xHa98tX152piNCoBWM3uz7ESi0Fk2TZK jEvSaLAvEUyzC6Zlg/yfF0kMMH0knceUkkAS5HDcSFaVSk7p2MLaCj9onm2/TgspvQ nJceaHxT8KW2JeIEbY5dxhJJF/3GcgOie1mTEjFlLvKa0Kx2ZrxM/4Pn9K7I53VnGn VfEggxTemryySntuLBn5yA65thtQEPG1LF9ysRGJW2+SogqRv/4H7gr5Dq/SP6KGDd uxTDuw5sUdeIQ== Message-ID: <860f16ad-008a-440f-b040-23778a26866a@kernel.org> Date: Tue, 10 Mar 2026 11:25:48 +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 1/5] eventpoll: Convert epoll_put_uevent() to scoped user access To: Eric Dumazet Cc: renpanpan , linux-kernel@vger.kernel.org, Dave Hansen , Kuniyuki Iwashima , Linus Torvalds References: <20260310075431.3069438-1-renpanpan@kylinos.cn> <26d6ebf4-9a4e-416f-bccc-144c80f30ee1@kernel.org> Content-Language: fr-FR From: "Christophe Leroy (CS GROUP)" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 10/03/2026 à 09:32, Eric Dumazet a écrit : > On Tue, Mar 10, 2026 at 9:29 AM Christophe Leroy (CS GROUP) > wrote: >> >> >> >> Le 10/03/2026 à 08:54, renpanpan a écrit : >>> [Vous ne recevez pas souvent de courriers de renpanpan@kylinos.cn. Découvrez pourquoi ceci est important à https://aka.ms/LearnAboutSenderIdentification ] >>> >>> From: Eric Dumazet >>> >>> Saves two function calls, and one stac/clac pair. >>> >>> stac/clac is rather expensive on older cpus like Zen 2. >>> >>> A synthetic network stress test gives a ~1.5% increase of pps >>> on AMD Zen 2. >>> >>> Signed-off-by: Eric Dumazet >>> Cc: Christophe Leroy >>> Cc: Dave Hansen >>> Cc: Kuniyuki Iwashima >>> Signed-off-by: Linus Torvalds >>> --- >>> include/linux/eventpoll.h | 11 +++++++---- >>> 1 file changed, 7 insertions(+), 4 deletions(-) >>> >>> diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h >>> index ccb478eb174b..ea9ca0e4172a 100644 >>> --- a/include/linux/eventpoll.h >>> +++ b/include/linux/eventpoll.h >>> @@ -82,11 +82,14 @@ static inline struct epoll_event __user * >>> epoll_put_uevent(__poll_t revents, __u64 data, >>> struct epoll_event __user *uevent) >>> { >>> - if (__put_user(revents, &uevent->events) || >>> - __put_user(data, &uevent->data)) >>> - return NULL; >>> - >>> + scoped_user_write_access_size(uevent, sizeof(*uevent), efault) { >> >> As already mentionned this could be simplified: > > Note the patch was already merged in Linus tree. > > Honestly having two different macros while we have 4 users for both > of them seems a bit overkill to me. There have at the time beeing (v7.0-rc3) 66 caller of user_...access_begin(), I expect most of them being converted to scoped user access over time. In addition the simplicity of scoped user access should help grow the numbre of users of user access by block. I find it quite convenient to not have to add the size when it can be extracted from the pointer type. Christophe