Date: Sun, 17 Dec 2000 12:56:52 -0800 From: Julian Elischer <julian@elischer.org> To: Chuck Paterson <cp@bsdi.com> Cc: smp@FreeBSD.ORG Subject: Re: Netgraph locking primatives. take 1. Message-ID: <3A3D2894.CEA08776@elischer.org> References: <200012171849.eBHInbP14473@berserker.bsdi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Chuck Paterson wrote: > > Julian > > The release (leave_{read,write}) operations don't have anything > to actually run the queues. What mechanism do you plan to use > dequeue the stuff which is backed up on the queueu. For instance > 20 read operatons backed up while a write was held. > > Chuck you loop on the dequeue after having been called in some manner the release is if you have finished processing a packet, approximate pseudocode follows: [called from interrupt driven driver with packet to process] packet = aquire_read(node->lock, packet) /* May not get same packet */ if (!packet) return; node->rcvdata(node,packet) release_reader(node->lock) /* * now we've handled the packet we brought, (or a friend of it) * let's look for any other packets that may have been queued up */ for (;;) { if ((node->lock.flags & (WRITE_PENDING|READ_PENDING)) == 0) return; mtx_get(node->lock.mtx, MTX_SPIN) packet = dequeue(node->lock) /* dequeue aquires and adjusts the locks as it dequeues packets */ mtx_exit(..) if (!packet) { return node->rcvdata(node,packet) release_reader(node->lock) } -- __--_|\ Julian Elischer / \ julian@elischer.org ( OZ ) World tour 2000 ---> X_.---._/ presently in: Budapest v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3A3D2894.CEA08776>