tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MP-safe ifnet with psz & psref



On Thu, May 19, 2016 at 04:11:56PM +0900, Ryota Ozaki wrote:
> I'm working on a next task that replaces an ifnet pointer embedded
> in other objects, say mbuf and rtentry, with an interface index
> (ifnet#if_index) and when we take an ifnet object from such objects,
> look it up (with psz or psref) from the interface collection
> (ifindex2ifnet, just an array). By doing so, we can ensure a taken
> ifnet object isn't freed during manipulating it. And if an interface
> which we're obtaining is being destroyed, a look-up just returns NULL.

Similar to Taylor's question, I wonder if this is really the correct
direction. Routing table entries should never point to dead interfaces.
If they do, there is a synchronisation bug already. Introducing a layer
of indirection seems to be a pure penalty for the hot path.

Mbufs are slightly different. They can be queued on an interface for a
moderately long time. For this purpose, a "flush" hook would definitely
be needed. I think having such a hook would be useful for other purposes
as well, i.e. to trigger memory compaction. But it is a somewhat
expensive change in that it requires review of a lot of code.

The final question for me is whether we can get away with just not
deallocating ifnet instances. Reusing them is fine in principle, the
problem is just keeping the memory type safe.

Joerg


Home | Main Index | Thread Index | Old Index