From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.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 1604234CFA7 for ; Tue, 10 Mar 2026 10:36:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773139006; cv=none; b=NvSLIz1l6Nlnbcl3+AfI3h3OXmH/M50yUZ8Qzi3PDHewBXhj4ojDlGwpKyrSQpE5JmatowcTA8igmxFSI6XAW6lbSKXqajlmc/yLc6YeY+Q41wwRbtPv8HzQzXMMkmgG2QUF6hXeSpF26V164iwOzVLvyqX6T6uJ6iEMpgj6fgo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773139006; c=relaxed/simple; bh=SzQMm89LzrcgwRLvgpcWS9oK9FJHTu9Ob2dey4cJdPs=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=dRu+hgMJHIAe7mpaVH6P9Q3udVUhNfcEuBk+j6BMpFqUEeT2XGLPKGTZxqDjYKS+pv+2ZqNxV6lbSpYTiP8zd0YdEtWJu23nh0TTyxy9VBIv5xwe5xL2yhP5Wb6SOwIyxQsWIAiRjaRl7GPVkWvildXjRObtxwFGFMeVSRScEG8= 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=PDYwnEpg; arc=none smtp.client-ip=209.85.221.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="PDYwnEpg" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-439b2965d4bso7457452f8f.2 for ; Tue, 10 Mar 2026 03:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773139003; x=1773743803; 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=pMSnZw3aA1hoBmUoi0Im67zHeUr60FdE3fVvQk706vI=; b=PDYwnEpgsjlYy0ME+oN8ewWb2OEqapvhHDwI3hBu7dP9QpD6ZFZFC3BL0KesUaR8uc Rkk6z5gKFeNBPcIRHeWW15qx30iFxWz5oUWVIcHGL3CWOxkOr1CCpQanHKts0n0lOqsL oZB+tIvYZulWBfc/v1gFKo0+4KzQQ9pJuV1UkTi1YgdlRfyUWZhE0YCOq96MlB0ueFRq yuzcovmaQdIX5xfazLwVeGdoBIMVBhr/UmhvnpiA5J5pK7+9uvBAffayVv66TB37X/2q ScDi6doP1KgAyvQ8RJF/JV/n2l2w7h1lnekth224th6N6F5yS8FaYnlIPzhAx9ZELSdq LIRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773139003; x=1773743803; 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=pMSnZw3aA1hoBmUoi0Im67zHeUr60FdE3fVvQk706vI=; b=oEAII0iHTlhBKjT0tMN/xq6zzXqYUtCm3MJ41CSubLCkcdUJsZtfcufwPw3jxJYmTd 2UTxwA3md4rG8g9hb3bmopfP5zQthfW0QOpi4xbtgmnsxs9wyVNrHNGshup5EeiLAFM2 WqLuTkiA0pmsV8HcSLjVzFyTerkHWXSP5b02BT0T6l/dbP8+aVAM8Q1oMSvW/TUlUTl3 QX7AR9Co57TIMGARScJn3bwS4MIoIqbE/5208ZSe+20QDlNDmE4kfXLAx5Mq3v7b6CGW otocThFD7kGmPks+C40PWbQ3YH5uaQ0zHrUfpFnFY77NCNuHcfcXqYTk4yYUguygHXNB RaAA== X-Forwarded-Encrypted: i=1; AJvYcCVe9SoXev3jnOwR8EE7XQUKrRPlAz/ygwTIAlr2K9125Xecyqn2VZpnFq0FynUPuR7YlXuWRI7VaWHgJvQ=@vger.kernel.org X-Gm-Message-State: AOJu0YzwBi7oWJjqnQ7+32460rlBpvMPGdOwAOweBhfuQoLzrRIDnebT OJogQZLPXFSdBgIUiYzxi0fycmJNDO1nEpFosKbuvOmRRdlQDdfCdV8h8dR+BId+ X-Gm-Gg: ATEYQzxj0cKUKXx0+B0RdU3wGvH61VJpYyb1HiXbLJXe4tbPa0aEhK7EDPGzdfNwQkr GXe4i0PkooCp1oW8T5VpmWEFawYxsdpwtsRG9EGJ77HMRLXQF+MPBsjtyLe75MFdjfERCJPHgJc Vx6T/+dZ7zB9dMAVe499iOFmdnXf1Go4tvC1Fte6uxmldA0ctxyLfLmF1eK5QGmrlJBpMrKVGxA xyKCnrTTPjy3f21fl10hPRX99ZK92FYub18QR7EKL24TM6ikLRg67omFWj9muJxg8UQktRzthT+ LUaIb3SurtS4INmISF1W6vM+kYqM8VjcUly9KZ8MT6TRfrT7BNMSkJEnhgTCC/FWaGVMAKjvfXY 8ohj3+wNRLLmFsRugmkJ+FPuSy657OfGMW61KYGsSE7xGQ9ddPWd2nGjIsbJbKg190dA/YNxz1v VN5Bn/MhZIhLS/4CW6OfNGbIPcncT5VhyHs7md3dJzE9pzuyOoGhkRaJx6dwyaCmmI X-Received: by 2002:a05:6000:2404:b0:430:f985:a7b2 with SMTP id ffacd0b85a97d-439da86e9f5mr26494420f8f.51.1773139003142; Tue, 10 Mar 2026 03:36:43 -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 ffacd0b85a97d-439dad8d840sm37150717f8f.8.2026.03.10.03.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 03:36:42 -0700 (PDT) Date: Tue, 10 Mar 2026 10:36:40 +0000 From: David Laight To: Eric Dumazet Cc: "Christophe Leroy (CS GROUP)" , 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: <20260310103640.55d45a3c@pumpkin> In-Reply-To: References: <20260310075431.3069438-1-renpanpan@kylinos.cn> <26d6ebf4-9a4e-416f-bccc-144c80f30ee1@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 09:32:53 +0100 Eric Dumazet wrote: > On Tue, Mar 10, 2026 at 9:29=E2=80=AFAM Christophe Leroy (CS GROUP) > wrote: > > > > > > > > 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 I'm also not sure all the 'hidden size' macros really help readability. (especially of the header file that defines them all.) It isn't as though the source lines would get overlong - especially if the macro name was shorter. But now is the time to change anything - before there are too many users. David