[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b6263d35-0d31-e4a8-a955-494ce2b36ad6@gmail.com>
Date: Thu, 23 Sep 2021 09:49:49 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Yajun Deng <yajun.deng@...ux.dev>, davem@...emloft.net,
kuba@...nel.org
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net: socket: integrate sockfd_lookup() and
sockfd_lookup_light()
On 9/21/21 11:31 PM, Yajun Deng wrote:
> As commit 6cb153cab92a("[NET]: use fget_light() in net/socket.c") said,
> sockfd_lookup_light() is lower load than sockfd_lookup(). So we can
> remove sockfd_lookup() but keep the name. As the same time, move flags
> to sockfd_put().
???
>
> Signed-off-by: Yajun Deng <yajun.deng@...ux.dev>
> ---
> include/linux/net.h | 8 +++-
> net/socket.c | 101 +++++++++++++++++---------------------------
> 2 files changed, 46 insertions(+), 63 deletions(-)
>
> diff --git a/include/linux/net.h b/include/linux/net.h
> index ba736b457a06..63a179d4f760 100644
> --- a/include/linux/net.h
> +++ b/include/linux/net.h
> @@ -238,8 +238,14 @@ int sock_recvmsg(struct socket *sock, struct msghdr *msg, int flags);
> struct file *sock_alloc_file(struct socket *sock, int flags, const char *dname);
> struct socket *sockfd_lookup(int fd, int *err);
> struct socket *sock_from_file(struct file *file);
> -#define sockfd_put(sock) fput(sock->file)
> int net_ratelimit(void);
> +#define sockfd_put(sock) \
> +do { \
> + struct fd *fd = (struct fd *)&sock->file; \
> + \
> + if (fd->flags & FDPUT_FPUT) \
> + fput(sock->file); \
> +} while (0)
>
Really ?
I wonder how was this tested ?
We can not store FDPUT_FPUT in the sock itself, for obvious reasons.
Each thread needs to keep this information private.
Powered by blists - more mailing lists