From owner-freebsd-hackers@FreeBSD.ORG Mon Aug 11 11:32:37 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0BB5537B401 for ; Mon, 11 Aug 2003 11:32:37 -0700 (PDT) Received: from mail.speakeasy.net (mail14.speakeasy.net [216.254.0.214]) by mx1.FreeBSD.org (Postfix) with ESMTP id 730B743F3F for ; Mon, 11 Aug 2003 11:32:36 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 30655 invoked from network); 11 Aug 2003 18:32:35 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 11 Aug 2003 18:32:35 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h7BIWX9s052459; Mon, 11 Aug 2003 14:32:34 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: <1060603824.650.12.camel@localhost> Date: Mon, 11 Aug 2003 14:32:55 -0400 (EDT) From: John Baldwin To: Rui Lopes cc: freebsd-hackers@freebsd.org Subject: RE: Possible patch for vm/vm_glue.c X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2003 18:32:37 -0000 On 11-Aug-2003 Rui Lopes wrote: > Hello, > > I've been reading vm_glue.c and I think I've found a bug regarding the > lock of `proc.p_sflag' inside `scheduler' function. > >>From proc.h, "int p_sflag; /* (j) PS_* flags. */" and "(j) - locked by > sched_lock mtx"; but the access is done without having the lock. > > > Take a look at the attached patch and tell me if this is ok. > > Patch made against "$FreeBSD: src/sys/vm/vm_glue.c,v 1.172 2003/05/13 > 20:36:02 jhb Exp $", but this is also present in current 1.182. The lock isn't needed in this case for these flags because the proc lock is already held and for these flags, both the proc lock and sched lock are always held when they are set or cleared, so only one of those locks have to be held to check the flags. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/