From: Andrew Lunn <andrew@lunn.ch>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Jiri Pirko <jiri@resnulli.us>, Michal Kubecek <mkubecek@suse.cz>,
dsahern@kernel.org, pablo@netfilter.org, netdev@vger.kernel.org
Subject: Re: Genetlink per cmd policies
Date: Thu, 1 Oct 2020 03:53:23 +0200 [thread overview]
Message-ID: <20201001015323.GB4050473@lunn.ch> (raw)
In-Reply-To: <20200930172317.48f85a5b@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On Wed, Sep 30, 2020 at 05:23:17PM -0700, Jakub Kicinski wrote:
> On Thu, 1 Oct 2020 01:38:17 +0200 Andrew Lunn wrote:
> > > > > +static void genl_op_from_full(const struct genl_family *family,
> > > > > + unsigned int i, struct genl_ops *op)
> > > > > +{
> > > > > + memcpy(op, &family->ops[i], sizeof(*op));
> > > >
> > > > What's wrong with struct assignment? :)
> > > >
> > > > *op = family->ops[i];
> > >
> > > Code size :)
> > >
> > > text data bss dec hex
> > > 22657 3590 64 26311 66c7 memcpy
> > > 23103 3590 64 26757 6885 struct
> >
> > You might want to show that to the compiler people. Did you look at
> > the assembly?
>
> Somewhere along the line I lost the ability to decipher compiler code :(
Yah, Z80 and 6809 i could sometimes just read the byte codes. That has
long gone. I tend to read ARM assembly now a days being mostly in the
embedded world.
So the memcpy version just calls memcpy by the looks of it. I thought
it might of inlined it, but it has not. Maybe because of the -Os.
The struct assignment is interesting because it appears to be calling
three functions to do the work. I wonder if it is avoiding copying the
padding in the structure?
But still, that does not explain an extra 400 bytes in the text
segment.
Andrew
next prev parent reply other threads:[~2020-10-01 1:53 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-30 15:49 Genetlink per cmd policies Jakub Kicinski
2020-09-30 16:03 ` Michal Kubecek
2020-09-30 16:11 ` Jakub Kicinski
2020-09-30 16:06 ` Johannes Berg
2020-09-30 16:17 ` Johannes Berg
2020-09-30 16:44 ` Jakub Kicinski
2020-09-30 18:36 ` Johannes Berg
2020-09-30 18:42 ` Michal Kubecek
2020-09-30 18:42 ` Johannes Berg
2020-09-30 19:01 ` Jakub Kicinski
2020-09-30 19:03 ` Johannes Berg
2020-09-30 19:14 ` Jakub Kicinski
2020-09-30 19:15 ` Johannes Berg
2020-09-30 19:46 ` Jakub Kicinski
2020-09-30 20:13 ` Johannes Berg
2020-09-30 20:47 ` Jakub Kicinski
2020-09-30 23:38 ` Andrew Lunn
2020-10-01 0:23 ` Jakub Kicinski
2020-10-01 1:53 ` Andrew Lunn [this message]
2020-10-01 15:50 ` Jakub Kicinski
2020-10-01 15:52 ` Johannes Berg
2020-09-30 16:18 ` Jakub Kicinski
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=20201001015323.GB4050473@lunn.ch \
--to=andrew@lunn.ch \
--cc=dsahern@kernel.org \
--cc=jiri@resnulli.us \
--cc=johannes@sipsolutions.net \
--cc=kuba@kernel.org \
--cc=mkubecek@suse.cz \
--cc=netdev@vger.kernel.org \
--cc=pablo@netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.