lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 9 Nov 2011 18:24:59 +0100
From:	Michał Mirosław <mirq-linux@...e.qmqm.pl>
To:	Ian Campbell <Ian.Campbell@...rix.com>
Cc:	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH 1/4] net: add support for per-paged-fragment destructors

On Wed, Nov 09, 2011 at 04:25:14PM +0000, Ian Campbell wrote:
> On Wed, 2011-11-09 at 15:33 +0000, Michał Mirosław wrote:
> > On Wed, Nov 09, 2011 at 03:02:04PM +0000, Ian Campbell wrote:
> > > Entities which care about the complete lifecycle of pages which they inject
> > > into the network stack via an skb paged fragment can choose to set this
> > > destructor in order to receive a callback when the stack is really finished
> > > with a page (including all clones, retransmits, pull-ups etc etc).
> > [...]
> > > --- a/include/linux/skbuff.h
> > > +++ b/include/linux/skbuff.h
> > > @@ -139,9 +139,16 @@ struct sk_buff;
> > >  
> > >  typedef struct skb_frag_struct skb_frag_t;
> > >  
> > > +struct skb_frag_destructor {
> > > +	atomic_t ref;
> > > +	int (*destroy)(void *data);
> > > +	void *data;
> > > +};
> > > +
> > >  struct skb_frag_struct {
> > >  	struct {
> > >  		struct page *p;
> > > +		struct skb_frag_destructor *destructor;
> > >  	} page;
> > 
> > You can get rid of the data field of skb_frag_destructor: if destroy() gets
> > pointer to the destroyed struct skb_frag_set_destructor, its users can
> > get at containing struct via container_of() if needed and the memory
> > pointed to by data won't have to be managed separately.
> At the moment you can share one destructor between all the frags,
> whereas data is specific to the frag.
[...]

If you want distinct data pointers then you need to also have per-frag
skb_frag_destructor as you wrote in this patch. So removing 'data' field
saves memory but doesn't change anything else except the way to reference
the data (container_of() instead of pointer dereference).

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ