Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 01 May 2008 08:38:24 -0700
From:      Sam Leffler <sam@freebsd.org>
To:        Alfred Perlstein <alfred@freebsd.org>
Cc:        gnn@freebsd.org, stable@freebsd.org
Subject:   Re: Some odd behaviour of vmstat and vmtotal...
Message-ID:  <4819E3F0.9040308@freebsd.org>
In-Reply-To: <20080501045736.GU30325@elvis.mu.org>
References:  <m2lk2ultc1.wl%gnn@neville-neil.com> <20080501045736.GU30325@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Alfred Perlstein wrote:
> * gnn@freebsd.org <gnn@freebsd.org> [080430 18:13] wrote:
>   
>> Howdy,
>>
>> In deploying 7.0 at work we were finding a persistent problem when
>> running "vmstat 1" on systems.  The problem shows up as a 10ms "pause"
>> in processing, usually packet stamping and forwarding by a user level
>> process.  This is due to the fact that vmstat calls the vmtotal()
>> routine which in turn does a whole lot of locking.  The vmtotal call
>> locks and walks the VM object list twice in a mark and sweep
>> operation.
>>
>> So, the question is, "What is the right way to fix this?"  I could
>> remove the locking since the O_ACTIVE bit is not used by any other
>> routine besides vmtotal, but I'm not too happy about that.
>>
>> The relevant code can be found in src/sys/vm/vm_meter.c in vmtotal().
>>
>> Thoughts?
>>     
>
> Can you _really_ remove the locking?  I don't think that would be safe
> if the list is being manipulated, but I haven't checked.
>
> Typically one uses a sentinal to get around such problems.  Basically
> insert a dummy object that no one should touch other than you, then
> drop the lock periodically and insert it into the list, then resume.
>
>   

net80211 uses a scan generation # to walk it's node lists.  No sentinel.

    Sam





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4819E3F0.9040308>