DragonFly kernel List (threaded) for 2008-01
DragonFly BSD
DragonFly kernel List (threaded) for 2008-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: should we use atomic instructions to manipulate vmstats.v_wire_count?


From: "Simon 'corecode' Schubert" <corecode@xxxxxxxxxxxx>
Date: Sun, 13 Jan 2008 14:32:10 +0100

Nicolas Thery wrote:
I noticed that vmstats.v_wire_count is incremented and decremented w/o
protection.  In contrast, atomic instructions (from <atomic.h>) are
used in freebsd.
Is it a bug in dfly or is it intentional?
As far as I understand, we're requiring the mplock for vm operations, so that should be covered.
Ok but what about zget() called from zalloc() which increments
v_wire_count?   I reckon zalloc() can be called w/o holding the
mplock.

I don't think you're allowed to call zalloc() without the mplock. However there is a comment stating exactly this. But following the function calls, you could wind up like this:


zalloc
zget
vm_page_alloc or kmem_alloc3
. ..

Now this for sure isn't mp safe. I believe the comment is wrong, but of course I'm no authority in this area.

cheers
 simon

--
Serve - BSD     +++  RENT this banner advert  +++    ASCII Ribbon   /"\
Work - Mac      +++  space for low €€€ NOW!1  +++      Campaign     \ /
Party Enjoy Relax   |   http://dragonflybsd.org      Against  HTML   \
Dude 2c 2 the max   !   http://golden-apple.biz       Mail + News   / \



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