From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 90495221F2F for ; Tue, 10 Mar 2026 14:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773153020; cv=none; b=cM909A0cIvjc8ynZhh+Ocq5e5+QnyhFwcZtgeX88w95xaOi0kpEZImbSpQf+MFOnSTmrKciMdBwPbWjVKnxoImND0Oi/N3OhF9iax859PZ8bVq9LN9AwaXOxExPRm76l+7wm1/UhKBZylrN5bedbE4vNKVmUTfSxDW6ewx4pS9c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773153020; c=relaxed/simple; bh=CA597y2GxCDjhSIQcUjPOWluJl89FU+78QUF/9JAvYs=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oLe4uxn5dICzEn5tqXaIBctu/uqJZLe/vQ/XW1X3UlDR0/Pc2wXcecge87AYNfLtWOJ8QWZB2gAeI7SSyd4tzMtAcwuytobdHGqPMDeviEKPrG3WJaBSmgmyf8nq7ZAQiTuan5EKWKxfWC70xO0EibBhdMZsX+v3GV2k5FnoxUo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=dGNh7+Rl; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dGNh7+Rl" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4853c3c2fe7so13967275e9.0 for ; Tue, 10 Mar 2026 07:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773153017; x=1773757817; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=GUfYOCmCTWjdTxbEJsvBfefFCCFz60BjxfYRPSZ+qTM=; b=dGNh7+RlhXDzkgv1+B+rKeT2qH+XCCmklzS8uYiwrJX3q3fH6/CQ0sRPWelp4L9lit s3PaYLBvEJyzPUBKmHOH6dPJ/aZp1AZ/eOcTLpKycpkiGFBHXEjp4RSNQHPmB9PC0eEd RZ5LtrkbxlR2nAr4DJsIpyhJ6E9WejVKnT06uhpEiRZ19effJp4UmVSeZnlitUR+sp31 sgu8EzbUEdo2urLCpcUd926AB8Wa/9DdhmKImGgkBqg1uUMdvHeJLK+tQQLJL8xA0Rq2 2X0ez44ilLLjzwr/aFDTkPlS9vaIRygn12/e8WQ4dP6s1ocbSJIWrOY0pXPHgimkV9Wx 7Ltw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773153017; x=1773757817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GUfYOCmCTWjdTxbEJsvBfefFCCFz60BjxfYRPSZ+qTM=; b=eWtqTRMOCOHS1FMHKzmWGjoBwWBwxT1dGoKn+34D2DHlOCFZphgG3zRlDJQ8gQrPLu zPghMH0tM41a+oMIJcYbjEMuyxYHVvOWGU/kbxU6fRbamjiDzCs6zGiiliLMTJB2daF0 23tsOwlw7HfMAo7GfkIgwl3KHxqQSRAWLdDZYtnh5B5+x5CxYY/Scgu5GriOu0aGC2WX DbCi0tV2KeFSyzyPwA6CcAsCXx7xEKlAHokVRVkO4rOapbVKkGhS1b4o3ICXuM0r8xSy Vkbonc1HEZsN0Oqgiz8SeM+q0mOozlir4RwMGOB72gLZjTxQybhqoMB1SPP2LmXVmTYS NUsA== X-Forwarded-Encrypted: i=1; AJvYcCWGOKLcmqTxTIrk+IDWWbzqd7/sk1h/fj0OiKCmOsoQe9JGWPFOCTUuqSwzVA6paF/z6Ns4c8rC/Q+/E/Y=@vger.kernel.org X-Gm-Message-State: AOJu0YwcWRPR0T3gwM1Z6rVySG7jEs2NEHiesNThLnv1SuPhJ59BStFB /57EOHsaHgdYimjt+mgj47AzA/dN/Hy6zTphpfXrFW/aoUy++1MMiikG X-Gm-Gg: ATEYQzyxtUfizh22x7WWIbOsjdGFnTSMb1DNAXdRkrb4ZVfl5yCNn5/enxg+jDtuBIi xm7Vwp7CPe7Gi2+9y641+hkHg9ooIHlnJl4R6VbJD2Jo+CIVbBDJl5+8+x9+YDt6479EEIH6C0v MGLFvFojtewB9gnz8umBCPBf4BJnlXihUFlA+pvgKeBx1FI3AT0cJ6AdA/ygyOtnQFWTjnt58gA H/tilz6bHWA0LLYQiVLxjd/cifsB4VAzdMwf/nSza5JSpRLN2MSPMZ8d8UaxrTdK1h+V0Bu5joF 6nxw6MSlzOR37CnYcR6tbHtp2l6eE/h1qvWSEgwB9sbfjsNYQ4my8X8LNPU5hIWWWlL2maZXpio ompjMwKwz5I7ZZInjqo616ypYJj4nJYLt2q9qWnhIzOpnN4CqTxdA9X62HHia0HVinffCaZYHo6 U+huKSwAUncJ4i1K+dVEtRjL+dY4vuuPsPjpNgwlnU8YOW1H98A+1mCHUFJY//bNLL X-Received: by 2002:a05:600c:1382:b0:485:3423:727c with SMTP id 5b1f17b1804b1-4853423748fmr162629685e9.18.1773153016555; Tue, 10 Mar 2026 07:30:16 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541a9e6aesm78568715e9.11.2026.03.10.07.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 07:30:15 -0700 (PDT) Date: Tue, 10 Mar 2026 14:30:14 +0000 From: David Laight To: "Christophe Leroy (CS GROUP)" Cc: Eric Dumazet , renpanpan , linux-kernel@vger.kernel.org, Dave Hansen , Kuniyuki Iwashima , Linus Torvalds Subject: Re: [PATCH 1/5] eventpoll: Convert epoll_put_uevent() to scoped user access Message-ID: <20260310143014.170862f9@pumpkin> In-Reply-To: <860f16ad-008a-440f-b040-23778a26866a@kernel.org> References: <20260310075431.3069438-1-renpanpan@kylinos.cn> <26d6ebf4-9a4e-416f-bccc-144c80f30ee1@kernel.org> <860f16ad-008a-440f-b040-23778a26866a@kernel.org> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, 10 Mar 2026 11:25:48 +0100 "Christophe Leroy (CS GROUP)" wrote: > Le 10/03/2026 =C3=A0 09:32, Eric Dumazet a =C3=A9crit=C2=A0: > > On Tue, Mar 10, 2026 at 9:29=E2=80=AFAM Christophe Leroy (CS GROUP) > > wrote: =20 > >> > >> > >> > >> Le 10/03/2026 =C3=A0 08:54, renpanpan a =C3=A9crit : =20 > >>> [Vous ne recevez pas souvent de courriers de renpanpan@kylinos.cn. D= =C3=A9couvrez pourquoi ceci est important =C3=A0 https://aka.ms/LearnAboutS= enderIdentification ] > >>> > >>> 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= ) { =20 > >> > >> As already mentionned this could be simplified: =20 > >=20 > > Note the patch was already merged in Linus tree. > >=20 > > Honestly having two different macros while we have 4 users for both > > of them seems a bit overkill to me. =20 >=20 > There have at the time beeing (v7.0-rc3) 66 caller of=20 > user_...access_begin(), I expect most of them being converted to scoped=20 > user access over time. In addition the simplicity of scoped user access=20 > should help grow the numbre of users of user access by block. >=20 > I find it quite convenient to not have to add the size when it can be=20 > extracted from the pointer type. Lets see if it possible to support both: foo(ptr, label) and: foo(ptr, size, label) #define foo(p, ...) foo_1(p, __VA_ARGS__, sizeof *p) #define foo_1(p, s_or_l, l_or_ps, ...) \ foo_2(p, __VA_OPT__(s_or_l, l_or_ps, foo_x(__VA_ARGS__)) l_or_ps, s_or_pl) #define foo_x(one_arg) #define foo_2(p, s, l, ...) foo_real(p, s, l) untested - but might work! (foo_x() is there to error foo(a, b, c, d)) David >=20 > Christophe >=20