[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sat, 19 Apr 2008 13:46:01 +0400
From: Evgeniy Polyakov <johnpol@....mipt.ru>
To: Rusty Russell <rusty@...tcorp.com.au>
Cc: netdev@...r.kernel.org, Max Krasnyansky <maxk@...lcomm.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
David Miller <davem@...emloft.net>
Subject: Re: [PATCH] net: add destructor for skb data (rewritten)
On Fri, Apr 18, 2008 at 02:21:25PM +1000, Rusty Russell (rusty@...tcorp.com.au) wrote:
> If we want to notify something when an skb is truly finished (such as
> for tun vringfd support), we need a destructor on the data.
Can we put its invokation before pages are freed?
> +static void shinfo_put(struct skb_shared_info *shinfo, bool nohdr)
> +{
> + struct skb_shared_info *orig;
> +
> + do {
> + if (atomic_sub_return(nohdr ? (1 << SKB_DATAREF_SHIFT) + 1 : 1,
> + &shinfo->dataref))
> + return;
> +
> + if (shinfo->nr_frags) {
> + int i;
> + for (i = 0; i < shinfo->nr_frags; i++)
> + put_page(shinfo->frags[i].page);
> + }
> +
> + if (shinfo->frag_list)
> + skb_drop_list(&shinfo->frag_list);
> +
> + orig = shinfo->orig;
> + if (shinfo->destructor)
> + shinfo->destructor(shinfo);
If it is first, we can process handle pages inside destructor, otherwise
they can be out of our control.
> + else
> + kfree(skb_shinfo_to_head(shinfo));
> +
> + /* We hold a payload reference to our parent. */
> + nohdr = true;
> + } while ((shinfo = orig) != NULL);
> +}
--
Evgeniy Polyakov
--
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