From: Cong Wang <xiyou.wangcong@gmail.com>
To: "yajun.deng@linux.dev" <yajun.deng@linux.dev>
Cc: kuba <kuba@kernel.org>, davem <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Re: [PATCH net-next] net: socket: add the case sock_no_xxx support
Date: Mon, 20 Sep 2021 09:33:09 -0700 [thread overview]
Message-ID: <CAM_iQpV4eaiD6msaiYNAOYE9Eoy2AjnGrSSwihhCO-yPb-61ww@mail.gmail.com> (raw)
In-Reply-To: <202109202028152977817@linux.dev>
On Mon, Sep 20, 2021 at 5:28 AM yajun.deng@linux.dev
<yajun.deng@linux.dev> wrote:
>
> From: Cong Wang
> Date: 2021-09-20 07:52
> To: Yajun Deng
> CC: Jakub Kicinski; David Miller; Linux Kernel Network Developers; LKML
> Subject: Re: [PATCH net-next] net: socket: add the case sock_no_xxx support
> On Sat, Sep 18, 2021 at 5:11 AM <yajun.deng@linux.dev> wrote:
> >
> > September 18, 2021 9:33 AM, "Jakub Kicinski" <kuba@kernel.org> wrote:
> >
> > > On Thu, 16 Sep 2021 20:29:43 +0800 Yajun Deng wrote:
> > >
> > >> Those sock_no_{mmap, socketpair, listen, accept, connect, shutdown,
> > >> sendpage} functions are used many times in struct proto_ops, but they are
> > >> meaningless. So we can add them support in socket and delete them in struct
> > >> proto_ops.
> > >
> > > So the reason to do this is.. what exactly?
> > >
> > > Removing a couple empty helpers (which is not even part of this patch)?
> > >
> > > I'm not sold, sorry.
> >
> > When we define a struct proto_ops xxx, we only need to assign meaningful member variables that we need.
> > Those {mmap, socketpair, listen, accept, connect, shutdown, sendpage} members we don't need assign
> > it if we don't need. We just need do once in socket, not in every struct proto_ops.
> >
> > These members are assigned meaningless values far more often than meaningful ones, so this patch I used likely(!!sock->ops->xxx) for this case. This is the reason why I send this patch.
>
> But you end up adding more code:
>
> 1 file changed, 58 insertions(+), 13 deletions(-)
>
> Yes,This would add more code, but this is at the cost of reducing other codes. At the same time, the code will only run likely(!sock->ops->xxx) in most cases. Don’t you think that this kind of meaningless thing shouldn’t be done by socket?
I have no idea why you call it reducing code while adding 45 lines
of code. So this does not make sense to me.
Thanks.
prev parent reply other threads:[~2021-09-20 16:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-16 12:29 [PATCH net-next] net: socket: add the case sock_no_xxx support Yajun Deng
2021-09-18 1:33 ` Jakub Kicinski
2021-09-18 2:53 ` yajun.deng
2021-09-19 23:52 ` Cong Wang
2021-09-20 12:28 ` yajun.deng
2021-09-20 16:33 ` Cong Wang [this message]
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=CAM_iQpV4eaiD6msaiYNAOYE9Eoy2AjnGrSSwihhCO-yPb-61ww@mail.gmail.com \
--to=xiyou.wangcong@gmail.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=yajun.deng@linux.dev \
/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).