All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Florian Westphal <fw@strlen.de>
Cc: Network Development <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next 02/13] sk_buff: add skb extension infrastructure
Date: Wed, 12 Dec 2018 10:45:42 -0500	[thread overview]
Message-ID: <CAF=yD-KC19R1fzNfv6ew5JPNC86600YxTcYb+E8NmHNecsgFMQ@mail.gmail.com> (raw)
In-Reply-To: <20181212154019.galockcggu6spcmp@breakpoint.cc>

On Wed, Dec 12, 2018 at 10:40 AM Florian Westphal <fw@strlen.de> wrote:
>
> Willem de Bruijn <willemdebruijn.kernel@gmail.com> wrote:
> > > +#ifdef CONFIG_SKB_EXTENSIONS
> > > +       __u8                    active_extensions;
> > > +#endif
> >
> > This byte could be saved by moving the bits to the first byte of the
> > new extension.
>
> I tried to do this, but could not resolve following problem:
> - extensions a and b are active
> - skb is cloned
> - extension a is to be disabled
>
> In this patch series, we can just clear the 'a' bit from
> from clone->active_extensions.
>
> But if its part of the extension itself, we must first need to
> be able to duplicate the extension blob before we can disable
> the extension, which means that attempt to disable an extension
> would now fail on -ENOMEM.  I think disabling should always work.

Absolutely. I certainly overlooked that complicating factor.

> (its not a problem at the moment for either secpath or bridge
>  as both use distinct pointers in sk_buff).
>
> > The likely cold cacheline now needs to be checked, but
> > only if the pointer is non-NULL.
>
> The upside of the 'active_extension' member is that we can keep the
> pointer in uninitialized state for the active_extensions == 0 case,
> i.e., when allocating a new skb skb->extensions is not initialized.
>
> > If exclusively using accessor
> > functions to access the struct, even this can be avoided if encoding
> > the first 3 or 7 active extensions in the pointer itself.
>
> Yes, that would work, but requires to init the pointer on skb allocation
> plus a few tricks to align the allocation so we have three bits to use
> on arches where kmalloc doesn't guarantee 8-byte-aligned pointers.
>
> Would also need a 'plan b' in place when extension number 4 arrives.

My assumed fallback was the first byte(s) of the extension, but as you
point out above, we cannot rely on that.

Okay, in that case the current solution is definitely preferable.

Ack also on the zeroing and alignment. Thanks for pointing out the
various pros and cons.

  reply	other threads:[~2018-12-12 15:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10 14:49 [PATCH net-next 0/13] sk_buff: add extension infrastructure Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 01/13] netfilter: avoid using skb->nf_bridge directly Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 02/13] sk_buff: add skb extension infrastructure Florian Westphal
     [not found]   ` <CAPUCuiADYwjY4kpq76-w9BKL3uiRvNjnmzKG29mCrb=b8YeesA@mail.gmail.com>
2018-12-12  0:07     ` Mat Martineau
2018-12-12  0:11       ` Florian Westphal
2018-12-12 11:59         ` Florian Westphal
2018-12-12 16:59           ` Mat Martineau
2018-12-12 14:44   ` Willem de Bruijn
2018-12-12 15:40     ` Florian Westphal
2018-12-12 15:45       ` Willem de Bruijn [this message]
2018-12-12 17:23   ` Eric Dumazet
2018-12-12 18:44     ` Florian Westphal
2018-12-12 20:17       ` Eric Dumazet
2018-12-12 20:52         ` Florian Westphal
2018-12-13  5:40           ` Eric Dumazet
2018-12-13  9:27             ` Florian Westphal
2018-12-13 10:18               ` Eric Dumazet
2018-12-13 10:39                 ` Florian Westphal
2018-12-13 10:58                   ` Eric Dumazet
2018-12-13 11:03                     ` Florian Westphal
2018-12-13 11:16                       ` Eric Dumazet
2018-12-13 11:44                         ` Florian Westphal
2018-12-13 17:00                   ` Christoph Paasch
2018-12-12 18:16   ` Stephen Suryaputra
2018-12-12 18:38     ` Florian Westphal
2018-12-13  0:38     ` David Miller
2018-12-10 14:49 ` [PATCH net-next 03/13] net: convert bridge_nf to use " Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 04/13] xfrm: change secpath_set to return secpath struct, not error value Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 05/13] net: move secpath_exist helper to sk_buff.h Florian Westphal
2018-12-10 14:49 ` [PATCH net-next 06/13] net: use skb_sec_path helper in more places Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 07/13] drivers: net: intel: use secpath helpers " Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 08/13] drivers: net: ethernet: mellanox: use skb_sec_path helper Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 09/13] drivers: net: netdevsim: " Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 10/13] xfrm: use secpath_exist where applicable Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 11/13] drivers: chelsio: use skb_sec_path helper Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 12/13] xfrm: prefer secpath_set over secpath_dup Florian Westphal
2018-12-10 14:50 ` [PATCH net-next 13/13] net: switch secpath to use skb extension infrastructure Florian Westphal
2018-12-11  8:06   ` Steffen Klassert
2018-12-11 10:18     ` Florian Westphal
2018-12-11 10:20       ` Steffen Klassert
2018-12-12 11:52         ` Florian Westphal
2018-12-13  4:08 ` [PATCH net-next 0/13] sk_buff: add " Shannon Nelson

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='CAF=yD-KC19R1fzNfv6ew5JPNC86600YxTcYb+E8NmHNecsgFMQ@mail.gmail.com' \
    --to=willemdebruijn.kernel@gmail.com \
    --cc=fw@strlen.de \
    --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 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.