OpenVZ Forum


Home » Mailing lists » Devel » netns refcounting
netns refcounting [message #23418] Fri, 16 November 2007 14:04 Go to next message
den is currently offline  den
Messages: 494
Registered: December 2005
Senior Member
Hello, All!

During port of Eric's patches I have noticed an interesting thing.
The patch "net: Teach the ipv4 route cache to handle multiple network
namespaces" call hold_net for each IPv4 DST cache entry.

Though it is not possible to stop a namespace without stopping all the
devices inside. Additionally, the device can't be unregistered if there
are dst entries to it. These entries are moved to a namespace loopback
and the namespace will block until these entries will gone from a loopback.

So, I do not see a necessity to have an extra atomic on this hot path,
i.e. hold_net can re moved away for this. Are there any holes?

Regards,
	Den
Re: netns refcounting [message #23435 is a reply to message #23418] Fri, 16 November 2007 15:50 Go to previous messageGo to next message
Daniel Lezcano is currently offline  Daniel Lezcano
Messages: 417
Registered: June 2006
Senior Member
Denis V. Lunev wrote:
> Hello, All!
> 
> During port of Eric's patches I have noticed an interesting thing.
> The patch "net: Teach the ipv4 route cache to handle multiple network
> namespaces" call hold_net for each IPv4 DST cache entry.
> 
> Though it is not possible to stop a namespace without stopping all the
> devices inside. Additionally, the device can't be unregistered if there
> are dst entries to it. These entries are moved to a namespace loopback
> and the namespace will block until these entries will gone from a loopback.
> 
> So, I do not see a necessity to have an extra atomic on this hot path,
> i.e. hold_net can re moved away for this. Are there any holes?

That seems reasonable to remove, good catch.
Re: netns refcounting [message #23444 is a reply to message #23418] Fri, 16 November 2007 17:14 Go to previous message
ebiederm is currently offline  ebiederm
Messages: 1354
Registered: February 2006
Senior Member
"Denis V. Lunev" <den@sw.ru> writes:

> Hello, All!
>
> During port of Eric's patches I have noticed an interesting thing.
> The patch "net: Teach the ipv4 route cache to handle multiple network
> namespaces" call hold_net for each IPv4 DST cache entry.
>
> Though it is not possible to stop a namespace without stopping all the
> devices inside. Additionally, the device can't be unregistered if there
> are dst entries to it. These entries are moved to a namespace loopback
> and the namespace will block until these entries will gone from a loopback.
>
> So, I do not see a necessity to have an extra atomic on this hot path,
> i.e. hold_net can re moved away for this. Are there any holes?

So all hold_net is good for is to catch logic errors where people are
still using a network namespace but have freed it.  It is a bit like
the device reference count in that regard.

The usage of the dst cache from ipv4 looked complicated enough that making
some small mistake easy to have so I included the reference count for good
measure.

If the movement to loopback device is sufficient to prevent us from goofing
up in this area I am happy to avoid the reference count.

Eric
Previous Topic: [PATCH 2/4] proc: detect duplicate names on registration
Next Topic: [RFC PATCH 1/2] capabilities: define CONFIG_COMMONCAP
Goto Forum:
  


Current Time: Sat Sep 06 15:46:30 GMT 2025

Total time taken to generate the page: 0.12542 seconds