Packet loss every 30.999 seconds

Scott Long scottl at samsco.org
Mon Dec 17 23:18:23 PST 2007


Bruce Evans wrote:
> On Mon, 17 Dec 2007, David G Lawrence wrote:
> 
>>   One more comment on my last email... The patch that I included is not
>> meant as a real fix - it is just a bandaid. The real problem appears to
>> be that a very large number of vnodes (all of them?) are getting synced
>> (i.e. calling ffs_syncvnode()) every time. This should normally only
>> happen for dirty vnodes. I suspect that something is broken with this
>> check:
>>
>>        if (vp->v_type == VNON || ((ip->i_flag &
>>            (IN_ACCESS | IN_CHANGE | IN_MODIFIED | IN_UPDATE)) == 0 &&
>>             vp->v_bufobj.bo_dirty.bv_cnt == 0)) {
>>                VI_UNLOCK(vp);
>>                continue;
>>        }
> 
> Isn't it just the O(N) algorithm with N quite large?  Under ~5.2, on
> a 2.2GHz A64 UP in 32-bit mode, I see a latency of 3 ms for 17500 vnodes,
> which would be explained by the above (and the VI_LOCK() and loop
> overhead) taking 171 ns per vnode.  I would expect it to take more like
> 20 ns per vnode for UP and 60 for SMP.
> 
> The comment before this code shows that the problem is known, and says
> that a subroutine call cannot be afforded unless there is work to do,
> but the, the locking accesses look like subroutine calls, have subroutine
> calls in their internals, and take longer than simple subroutine calls
> in the SMP case even when they don't make subroutine calls.  (IIRC, on
> A64 a minimal subroutine call takes 4 cycles while a minimal locked
> instructions takes 18 cycles; subroutine calls are only slow when their
> branches are mispredicted.)
> 
> Bruce

Right, it's a non-optimal loop when N is very large, and that's a fairly
well understood problem.  I think what DG was getting at, though, is
that this massive flush happens every time the syncer runs, which
doesn't seem correct.  Sure, maybe you just rsynced 100,000 files 20
seconds ago, so the upcoming flush is going to be expensive.  But the
next flush 30 seconds after that shouldn't be just as expensive, yet it
appears to be so.  This is further supported by the original poster's
claim that it takes many hours of uptime before the problem becomes
noticeable.  If vnodes are never truly getting cleaned, or never getting
their flags cleared so that this loop knows that they are clean, then
it's feasible that they'll accumulate over time, keep on getting flushed
every 30 seconds, keep on bogging down the loop, and so on.

Scott


More information about the freebsd-net mailing list