tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: MP-safe ifnet with psz & psref
On Fri, May 20, 2016 at 6:11 PM, Ryota Ozaki <ozaki-r%netbsd.org@localhost> wrote:
> On Fri, May 20, 2016 at 5:38 PM, Joerg Sonnenberger <joerg%bec.de@localhost> wrote:
>> On Fri, May 20, 2016 at 12:15:10PM +0900, Ryota Ozaki wrote:
>>> > 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.
>>>
>>> What "keeping the memory type safe" means?
>>
>> Once allocated as ifnet, it will always be an ifnet.
>
> I see.
>
>>
>>> The problem "when we can reuse it?" seems to be similar to "when we can
>>> deallocate it?". Don't we need to do a similar solution I propose?
>>
>> The big question is what do we use rcvif for. If it is just a cookie
>> used for preventing cycles, it doesn't matter what the content is.
>
> No, rcvif is used arbitrarily.
>
>> Otherwise we should have a field whether it was initialized completely
>> or not.
>
> We can have IFF_INITIALIZED...oops, there is no space in if_flags :-<
IIUC making such flag work requires some synchronization, a mutex or a psref,
on an ifnet object to avoid race condition between clearing the initialized
flag and proceeding destruction on a writer and checking the flag and
referencing the object on a reader. Am I correct?
ozaki-r
Home |
Main Index |
Thread Index |
Old Index