Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Aug 2003 14:32:55 -0400 (EDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Rui Lopes <rui@ruilopes.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   RE: Possible patch for vm/vm_glue.c
Message-ID:  <XFMail.20030811143255.jhb@FreeBSD.org>
In-Reply-To: <1060603824.650.12.camel@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help

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 <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.20030811143255.jhb>