From: Alexey Dobriyan <adobriyan@gmail.com>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>,
Patrick McHardy <kaber@trash.net>
Subject: Re: [PATCH] net: introduce read_pnet() and write_pnet() functions
Date: Fri, 7 Nov 2008 20:41:00 +0300 [thread overview]
Message-ID: <20081107174100.GA3469@x200.localdomain> (raw)
In-Reply-To: <49146265.8040301@cosmosbay.com>
On Fri, Nov 07, 2008 at 04:44:37PM +0100, Eric Dumazet wrote:
> CONFIG_NET_NS is not a widespread option, we can reduce kernel size
> not declaring useless "struct net" pointers in several structures.
This can be done separatedly for each offending "struct net *".
> This patch declares three helper to clean various "ifdef CONFIG_NET_NS"
> that we have in many places.
There is an implicit assumption, that all such ifdefs are bad, while if fact
there are nothing wrong with them:
#ifdef CONFIG_NET_NS
struct net *ct_net;
#endif
> #ifdef CONFIG_NET_NS
>
> #define DECLARE_PNET(name) struct net *name;
One more macro, instead of immediately understandable thing.
> static inline void write_pnet(struct net **pnet, struct net *net)
> {
> *pnet = net;
> }
>
> static inline struct net *read_pnet(struct net * const *pnet)
> {
> return *pnet;
> }
> #else
>
> #define DECLARE_PNET(name)
> #define write_pnet(pnet, net) do { (void)(net);} while (0)
> #define read_pnet(pnet) (&init_net)
>
> #endif
>
> In particular, using these helpers permits a shrink of inet_bind_bucket
> (16 bytes instead of 32 on 32bit arches, and 32 bytes instead of 64 on 64bits)
Why not just fix exactly bind bucket issue.
As I posted earlier, ->dst_net can go after IPv6 dst_ops can be embedded
directly into struct netns_ipv6, but header dependencies aren't trivial.
As for netns comparisons, use net_eq() to amortize the cost somewhat.
next prev parent reply other threads:[~2008-11-07 17:37 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-07 15:44 [PATCH] net: introduce read_pnet() and write_pnet() functions Eric Dumazet
2008-11-07 17:41 ` Alexey Dobriyan [this message]
2008-11-07 17:49 ` Eric Dumazet
2008-11-07 18:07 ` Alexey Dobriyan
2008-11-11 0:44 ` David Miller
2008-11-11 11:08 ` [PATCH] net: #ifdef inet_bind_bucket::ib_net Alexey Dobriyan
2008-11-11 11:19 ` [PATCH v2] " Alexey Dobriyan
2008-11-12 0:45 ` David Miller
2008-11-12 6:20 ` [PATCH] nets: Introduce read_pnet() and write_pnet() helpers Eric Dumazet
2008-11-12 6:31 ` [PATCH] net: Cleanup of neighbour code Eric Dumazet
2008-11-12 8:55 ` David Miller
2008-11-12 8:53 ` [PATCH] nets: Introduce read_pnet() and write_pnet() helpers David Miller
2008-11-12 6:21 ` [PATCH] net: ib_net pointer should depends on CONFIG_NET_NS Eric Dumazet
2008-11-12 8:54 ` David Miller
2008-11-12 10:44 ` [PATCH v2] net: #ifdef inet_bind_bucket::ib_net Alexey Dobriyan
2008-11-12 10:50 ` Eric Dumazet
2008-11-12 12:24 ` [PATCH v3] " Alexey Dobriyan
2008-11-12 12:24 ` David Miller
2008-11-12 10:55 ` [PATCH v2] " Eric Dumazet
2008-11-12 11:16 ` David Miller
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=20081107174100.GA3469@x200.localdomain \
--to=adobriyan@gmail.com \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=kaber@trash.net \
--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