Netdev List
 help / color / mirror / Atom feed
From: David VomLehn <dvomlehn@cisco.com>
To: Mitchell Erblich <erblichs@earthlink.net>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH][RFC] Check sk_buff states
Date: Tue, 8 Jun 2010 11:28:11 -0700	[thread overview]
Message-ID: <20100608182811.GA31503@dvomlehn-lnx2.corp.sa.net> (raw)
In-Reply-To: <EB1E9C2D-55C5-4B57-A98D-E195309E9E05@earthlink.net>

On Mon, Jun 07, 2010 at 11:46:10PM -0500, Mitchell Erblich wrote:
> 
> On Jun 7, 2010, at 5:30 PM, David VomLehn wrote:
> 
> > This uses the oobparam and callsite infrastructure to implement sk_buff
> > state checking and error reporting. Possible states of an sk_buff are:
> > 	SKB_STATE_FREE - Is not currently in use
> > 	SKB_STATE_ALLOCATED - Has been allocated, but is not on a queue
> > 	SKB_STATE_QUEUED - Is allocated and on a queue
> > Since there are only three states, two bits suffice to record the state of
> > an sk_buff structure, so checking for consistent state is easy. (For you
> > weenies, the fourth possible state *is* flagged as an error).
> 
> 
> ... cut...
> 
> Just my two cents,
> Just initially thinking of the state names & using only two bits
> If a 3rd bit, then it could indicate exclusive or shared (double free then acceptable if shared)
> 
> kmem_alloc, malloc, etc actually allocate structs
> when something is allocated but not associated with anything, then it has no reference
> 
> so then why not?
> 
> xxx_STATE_INVALID:		both bits unset
> xxx_STATE_ALLOCATED:     bit 0 set and bit 1 not set
> xxx_STATE_REFERENCED : could be exclusive or shared, bit 0 unset & bit 1 set
> xxx_STATE_QUEUED:           both bits set
> 
> Mitchell Erblich

I think adding a bit is no problem, but the description is a bit too terse
for me.  The distinction between allocated and referenced wasn't clear
enough that I could figure out which skb_* functions affect this.
-- 
David VL

  reply	other threads:[~2010-06-08 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-08  0:30 [PATCH][RFC] Check sk_buff states David VomLehn
2010-06-08  4:46 ` Mitchell Erblich
2010-06-08 18:28   ` David VomLehn [this message]
2010-06-09  7:14 ` Andi Kleen
2010-06-09 18:07   ` David VomLehn

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=20100608182811.GA31503@dvomlehn-lnx2.corp.sa.net \
    --to=dvomlehn@cisco.com \
    --cc=erblichs@earthlink.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