From: David Miller <davem@davemloft.net>
To: steffen.klassert@secunet.com
Cc: timo.teras@iki.fi, netdev@vger.kernel.org
Subject: Re: [PATCH 0/4] Fix routing metrics
Date: Tue, 21 Feb 2012 14:24:55 -0500 (EST) [thread overview]
Message-ID: <20120221.142455.1647947327897905941.davem@davemloft.net> (raw)
In-Reply-To: <20120221081827.GF31660@secunet.com>
From: Steffen Klassert <steffen.klassert@secunet.com>
Date: Tue, 21 Feb 2012 09:18:27 +0100
> I need the dst->ops->metrics() method because I removed the direct
> reference to the inetpeer metrics from the dst_entry. I had to
> remove this direct reference to be able to free the old metrics
> safely. A dst_entry with a direct reference to old metrics
> could leave the rcu protected region and might then try to access
> already freed metrics (i.e. if a dst_entry with old metrics is already
> attached to a skb when the routing cache is flushed and the skb is queued
> for asynchronous processing). With this patchset we access the interpeer
> metrics via the inetpeer itself on every metrics access, so we ensure
> the metrics are not freed in the meantime.
Then a callback still seems like extreme overkill just to ensure the
RCU safety of metric pointer accesses.
It seems much simpler to me to just kill the inetpeer when we find out
we actually do need to change the metrics, instead of trying to change
the metric memory from underneath it. Just make a new inetpeer and let
the old one with the old outdated metrics simply die off as the stray
references disappear.
Remove the old inetpeer from the tree (so it cannot be found in a
lookup), and then any dangling old, invalid, routing cache entries
referring to it will hold a reference count. And once that final
reference drops, we'll know we can safely free the inetpeer up. So
we'll use stale metrics for a while from these old invalid routing
cache entries, but that's perfectly fine.
The whole thing is about not doing something non-trivial in the fast
path, which is what your patch does. Your approach causes us to incur
a cost every single metric access just because we "might" access stale
metrics from a old invalid routing cache entry. This is not the
common case at all.
next prev parent reply other threads:[~2012-02-21 19:25 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-02 10:11 [PATCH 0/4] Fix routing metrics Steffen Klassert
2012-02-02 10:12 ` [PATCH 1/4] inetpeer: Allocate the peer metrics dynamically Steffen Klassert
2012-02-02 10:12 ` [PATCH 2/4] net: Unlink the inetpeer metrics from dst_entry Steffen Klassert
2012-02-02 10:13 ` [PATCH 3/4] inetpeer: protect the inetpeerpeer metrics with rcu Steffen Klassert
2012-02-02 10:14 ` [PATCH 4/4] route: Invalidate the peer metrics along with the routing cache Steffen Klassert
2012-02-06 20:29 ` [PATCH 0/4] Fix routing metrics David Miller
2012-02-08 7:30 ` Steffen Klassert
2012-02-08 20:18 ` David Miller
2012-02-09 12:44 ` Steffen Klassert
2012-02-09 18:40 ` David Miller
2012-02-10 6:50 ` Steffen Klassert
2012-02-10 7:38 ` David Miller
2012-02-10 7:51 ` Steffen Klassert
2012-02-10 8:12 ` David Miller
2012-02-10 8:44 ` Steffen Klassert
2012-02-10 18:25 ` David Miller
2012-02-21 6:19 ` Steffen Klassert
2012-02-21 6:36 ` David Miller
2012-02-21 8:18 ` Steffen Klassert
2012-02-21 19:24 ` David Miller [this message]
2012-02-24 9:08 ` Steffen Klassert
2012-02-24 9:13 ` David Miller
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=20120221.142455.1647947327897905941.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
--cc=timo.teras@iki.fi \
/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).