From owner-freebsd-current Mon May 14 23:14:12 2001 Delivered-To: freebsd-current@freebsd.org Received: from rina.r.dl.itc.u-tokyo.ac.jp (cvsup2.r.dl.itc.u-tokyo.ac.jp [133.11.199.247]) by hub.freebsd.org (Postfix) with ESMTP id BD4CB37B424; Mon, 14 May 2001 23:14:08 -0700 (PDT) (envelope-from tanimura@r.dl.itc.u-tokyo.ac.jp) Received: from rina.r.dl.itc.u-tokyo.ac.jp (localhost [127.0.0.1]) by rina.r.dl.itc.u-tokyo.ac.jp (8.11.3+3.4W/3.7W-rina.r-20010412) with ESMTP id f4F6E0P53295 ; Tue, 15 May 2001 15:14:01 +0900 (JST) Message-Id: <200105150614.f4F6E0P53295@rina.r.dl.itc.u-tokyo.ac.jp> Date: Tue, 15 May 2001 15:14:00 +0900 From: Seigo Tanimura To: jhb@FreeBSD.org Cc: tanimura@r.dl.itc.u-tokyo.ac.jp, current@FreeBSD.org Subject: atomic operation of flags (was: RE: select(2) converted to use a condition variable, and optimis) In-Reply-To: In your message of "Mon, 07 May 2001 12:37:22 -0700 (PDT)" References: <200105060731.f467V4g13184@silver.carrots.uucp.r.dl.itc.u-tokyo.ac.jp> User-Agent: Wanderlust/1.1.1 (Purple Rain) SEMI/1.13.7 (Awazu) FLIM/1.13.2 (Kasanui) MULE XEmacs/21.1 (patch 14) (Cuyahoga Valley) (i386--freebsd) Organization: Digital Library Research Division, Information Techinology Centre, The University of Tokyo MIME-Version: 1.0 (generated by SEMI 1.13.7 - "Awazu") Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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? -- Seigo Tanimura To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message