From: yajun.deng@linux.dev
To: "Eric Dumazet" <eric.dumazet@gmail.com>,
davem@davemloft.net, kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: socket: integrate sockfd_lookup() and sockfd_lookup_light()
Date: Fri, 24 Sep 2021 02:49:51 +0000 [thread overview]
Message-ID: <836595da2ba742cb790b8dd2a3c14ae4@linux.dev> (raw)
In-Reply-To: <b6263d35-0d31-e4a8-a955-494ce2b36ad6@gmail.com>
September 24, 2021 12:49 AM, "Eric Dumazet" <eric.dumazet@gmail.com> wrote:
> 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@linux.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.
The sockfd_lookup() already changed in this patch. FDPUT_FPUT stored in fdget(), precisely in __fget_light().
next prev parent reply other threads:[~2021-09-24 2:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 6:31 [PATCH net-next] net: socket: integrate sockfd_lookup() and sockfd_lookup_light() Yajun Deng
2021-09-23 15:24 ` Jakub Kicinski
2021-09-24 2:39 ` yajun.deng
2021-09-23 16:49 ` Eric Dumazet
2021-09-24 2:49 ` yajun.deng [this message]
2021-09-24 2:56 ` Al Viro
2021-09-24 3:39 ` yajun.deng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=836595da2ba742cb790b8dd2a3c14ae4@linux.dev \
--to=yajun.deng@linux.dev \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).