Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Sep 2000 12:08:19 -0600
From:      Chuck Paterson <cp@bsdi.com>
To:        freebsd-net@freebsd.org, freebsd-arch@freebsd.org
Subject:   Re: mbuf system and SMPng 
Message-ID:  <200009231808.MAA18066@berserker.bsdi.com>
In-Reply-To: Your message of "Fri, 22 Sep 2000 22:17:49 EDT." <Pine.BSF.4.21.0009222207140.1742-100000@jehovah.technokratis.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
Bosko,
	It looks like you can reduce the number of mutex operations
and the number of locked operations if you call m_mballoc and m_mballoc_wait
with the mmbfree mutex held.

	for the interim you may have to drop the lock in m_mballoc
before acquiring Giant and  calling kmem_malloc with the M_NOWAIT flag.
Eventually you should just be able to call kmem_malloc with the
M_NOWAIT flag and not release you lock. 

You will be able to get rid of some of the the atomic_add_long()s.

	For m_mballoc_wait you can get rid of the immediate re-acquire
of the lock on entry. You would need to make a version of MGET which
doesn't acquire the lock for use inside these routines. If you really
want only one version of the code you could do this my creating a
lower level macro the MGET calls, with macro aguments that are non-existance
or (mtx_enter(...) and mtx_exit(...)). 

	You can then replace the asleep and await with a
msleep(&mmbfree.m_mtx). The way the code is now you could end up
with the wakeup occurring before you even call asleep and then
never waking up. Also calling asleep and await are more expensive
than a single call to msleep()

	You also don't want to be calling MBWAKEUP on every MFREE.
You should hold the state you need to decided to do this under the mmbfree
mutex which you are already getting and releasing. You don't
want to call wakeupone if you don't have to, it is yet another
locked operation.

	I put this together real quick so if it isn't clear I'll be
glad to expand.

Chuck



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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