netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: eric.dumazet@gmail.com
Cc: netdev@vger.kernel.org
Subject: Re: [RFC PATCH] net: Implement read-only protection and COW'ing of metrics.
Date: Thu, 27 Jan 2011 12:28:24 -0800 (PST)	[thread overview]
Message-ID: <20110127.122824.193719098.davem@davemloft.net> (raw)
In-Reply-To: <1296122511.3027.11.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Thu, 27 Jan 2011 11:01:51 +0100

> Since you use cmpxchg() to permut the dst->_metrics, I feel this rt->fi
> needs some protection as well. Maybe store fi pointer inside the metrics
> instead of dst, or else you need a spinlock to perform the whole
> transaction (change dst->_metrics & rt->fi) ?

I think this is OK, because there are only two points at which the
"rt->fi" is tested and (conditionally) released.

1) At dst destruction time, which is when no other references may
   exist to the dst.

2) At COW time, and here we know a) we are the one and only entity
   which successfully COW'd the metrics and b) there is at least our
   reference to the dst and therefore dst destroy (and therefore case
   #1) may not execute in parallel with us.

So I think it's safe.

      parent reply	other threads:[~2011-01-27 20:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-15 21:21 [RFC PATCH] net: Implement read-only protection and COW'ing of metrics David Miller
2010-12-16 19:55 ` Eric Dumazet
2010-12-16 19:59   ` David Miller
2010-12-16 21:21     ` David Miller
2011-01-26 23:25     ` David Miller
2011-01-26 23:31       ` David Miller
2011-01-27 10:01       ` Eric Dumazet
2011-01-27 10:20         ` Eric Dumazet
2011-01-27 20:29           ` David Miller
2011-01-27 20:28         ` David Miller [this message]

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=20110127.122824.193719098.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).