From owner-freebsd-current Mon May 14 23:21: 1 2001 Delivered-To: freebsd-current@freebsd.org Received: from fw.wintelcom.net (ns1.wintelcom.net [209.1.153.20]) by hub.freebsd.org (Postfix) with ESMTP id 2461A37B422; Mon, 14 May 2001 23:20:59 -0700 (PDT) (envelope-from bright@fw.wintelcom.net) Received: (from bright@localhost) by fw.wintelcom.net (8.10.0/8.10.0) id f4F6Ku408060; Mon, 14 May 2001 23:20:56 -0700 (PDT) Date: Mon, 14 May 2001 23:20:56 -0700 From: Alfred Perlstein To: Seigo Tanimura Cc: jhb@FreeBSD.ORG, current@FreeBSD.ORG Subject: Re: atomic operation of flags (was: RE: select(2) converted to use a condition variable, and optimis) Message-ID: <20010514232056.O2009@fw.wintelcom.net> References: <200105060731.f467V4g13184@silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp> <200105150614.f4F6E0P53295@rina.r.dl.itc.u-tokyo.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200105150614.f4F6E0P53295@rina.r.dl.itc.u-tokyo.ac.jp>; from tanimura@r.dl.itc.u-tokyo.ac.jp on Tue, May 15, 2001 at 03:14:00PM +0900 X-all-your-base: are belong to us. Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG * Seigo Tanimura [010514 23:14] wrote: > On Mon, 07 May 2001 12:37:22 -0700 (PDT), > John Baldwin said: > > John> You need the lock when clearing the bit in p_flag. That is why the proc locks > John> are there, so all those proc locks need to stay. When you clear a bit, you are > John> writing all the bits, so you need to ensure that you can atomically > John> read/modify/write all the bits in p_flag, hence the need for the proc lock. > > As we now have a set of atomic operation functions in > machine/atomic.h, why do we not use them to read, modify and write > p_flag atomically? Is that more expensive than protecting by PROC_LOCK > and PROC_UNLOCK? That may be useful as an optimization, however afaik PROC_LOCK covers more than just the flags, if we used atomic ops for the flags and PROC_LOCK for the non-flags stuff it could cause a lot more overhead. -- -Alfred Perlstein - [alfred@freebsd.org] Daemon News Magazine in your snail-mail! http://magazine.daemonnews.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message