From owner-cvs-all Wed Dec 13 15:22:57 2000 From owner-cvs-all@FreeBSD.ORG Wed Dec 13 15:22:51 2000 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from pike.osd.bsdi.com (pike.osd.bsdi.com [204.216.28.222]) by hub.freebsd.org (Postfix) with ESMTP id 884A537B400; Wed, 13 Dec 2000 15:22:50 -0800 (PST) Received: from laptop.baldwin.cx (john@jhb-laptop.osd.bsdi.com [204.216.28.241]) by pike.osd.bsdi.com (8.11.1/8.9.3) with ESMTP id eBDNMVE46441; Wed, 13 Dec 2000 15:22:32 -0800 (PST) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.4.0 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Wed, 13 Dec 2000 15:22:41 -0800 (PST) From: John Baldwin To: Bosko Milekic Subject: RE: cvs commit: src/sys/sys mbuf.h Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On 13-Dec-00 Bosko Milekic wrote: > > On Wed, 13 Dec 2000, John Baldwin wrote: > >> >> On 13-Dec-00 Bosko Milekic wrote: >> > bmilekic 2000/12/12 21:13:03 PST >> > >> > Modified files: >> > sys/sys mbuf.h >> > Log: >> > Eliminate a race in MEXTFREE(). The reference counter decrement and test >> > was not atomic. We now make sure that we free the ext buf if the >> > reference >> > count is about to reach 0 but also make sure that nobody else has done >> > it >> > before us. >> > >> > While I'm here, change refcnt to u_int (from long). This fixes a >> > compiler >> > warning regarding use of atomic_cmpset_long on i386. >> >> If you are using atomic_cmpset_long, then use u_long for the refcount >> instead >> of u_int please. Eitehr that, or use atomic_cmpset_int. > > I don't know if you actually looked at the diff. > > I'm not using atomic_cmpset_long because strictly speaking, it > doesn't exist on i386 (it's defined to just atomic_cmpset_int) and > the compiler complains when you pass a long as the first argument to > atomic_cmpset_int. > The refcnt is now of type u_int. On the alpha and ia64, these are two different functions, and the atomic operations _really_ assume that the types are identical. If atomic_cmpset_long(long foo) generates a warning, then I need to fix the atomic operations. Changing to a u_int is wrong, and will result in memory corruption on other arch's. Hmm, you are using atomic_cmpset_int(), so don't say you are using atomic_cmpset_long() in the log message, please, as that is most confusing. -- John Baldwin -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message