From owner-cvs-all@FreeBSD.ORG Wed Jun 9 18:26:48 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DD1116A4ED; Wed, 9 Jun 2004 18:26:48 +0000 (GMT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1340443D48; Wed, 9 Jun 2004 18:26:48 +0000 (GMT) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.11/8.12.11) with ESMTP id i59IQTFg057370; Wed, 9 Jun 2004 20:26:29 +0200 (CEST) (envelope-from phk@phk.freebsd.dk) To: Pawel Jakub Dawidek From: "Poul-Henning Kamp" In-Reply-To: Your message of "Wed, 09 Jun 2004 20:20:41 +0200." <20040609182041.GV12007@darkness.comp.waw.pl> Date: Wed, 09 Jun 2004 20:26:29 +0200 Message-ID: <57369.1086805589@critter.freebsd.dk> cc: src-committers@FreeBSD.org cc: cvs-src@FreeBSD.org cc: cvs-all@FreeBSD.org cc: Bosko Milekic cc: Nate Lawson cc: "M. Warner Losh" Subject: Re: cvs commit: src/sys/kern kern_proc.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Jun 2004 18:26:49 -0000 In message <20040609182041.GV12007@darkness.comp.waw.pl>, Pawel Jakub Dawidek w rites: >BTW. Do we assume that atomic operations are atomic on MP machines? >I read atomic(9), but I still don't know if I should use it or not for >things like those. Ok, let us dispell the first misconception about atomic operations: Atomic operations are not cheap! In fact, there are architectures where they are significantly more expensive than mutexes. Next: Atomic operations are much harder to grasp mentally, and close to impossible to validate automatically. We have no WITNESS which will tell us about problems with atomic operations. Therefore: Do not use atomic operations, use a mutex. If we find a place where atomics will result in a significant performance increase, we will apply them there after careful consideration and considerable benchmarking. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.