Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 08 Nov 2012 11:48:21 +0100
From:      Andre Oppermann <andre@freebsd.org>
To:        "Alexander V. Chernikov" <melifaro@FreeBSD.org>
Cc:        freebsd-net@FreeBSD.org, freebsd-hackers@FreeBSD.org
Subject:   Re: [patch] reducing arp locking
Message-ID:  <509B8DF5.5010101@freebsd.org>
In-Reply-To: <509B88B1.3070905@FreeBSD.org>
References:  <509AEDAC.10002@FreeBSD.org> <509B884F.7040106@networx.ch> <509B88B1.3070905@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 08.11.2012 11:25, Alexander V. Chernikov wrote:
> On 08.11.2012 14:24, Andre Oppermann wrote:
>> On 08.11.2012 00:24, Alexander V. Chernikov wrote:
>>> Hello list!
>>>
>>> Currently we need to acquire 2 read locks to perform simple 6-byte
>>> copying from arp record to packet
>>> ethernet header.
>>>
>>> It seems that acquiring lle lock for fast path (main traffic flow) is
>>> not necessary even with
>>> current code.
>>>
>>> My tests shows ~10% improvement with this patch applied.
>>>
>>> If nobody objects I plan to commit this change at the end of next week.
>>
>> This is risky and prone to race conditions.  The copy of the MAC address
>> should be done while the table read lock is held to protect against the
> It is done exactly as you say: table read lock is held.

Right.  Sorry.  I didn't immediately get that the IF_AFDATA_LOCK is the
table lock.

-- 
Andre

>> entry going away.  You can either return with table lock held and drop
>> it after the copy, or you could a modified lookup function that takes a
>> pointer for the copy destination, do the copy with the read lock, and then
>> return.  If no entry is found an error is returned and obviously no copy
>> is done.
>>
>
>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?509B8DF5.5010101>