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. Regards, Rui Lopes
# we should only access `proc.p_sflag' when `sched_lock' is locked. # From proc.h: # int p_sflag; /* (j) PS_* flags. */ # and j means: "(j) - locked by sched_lock mtx" # -- Rui Lopes <[EMAIL PROTECTED]> --- vm_glue.c.orig Mon Aug 11 12:41:33 2003 +++ vm_glue.c Mon Aug 11 12:45:58 2003 @@ -596,10 +596,11 @@ sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { struct ksegrp *kg; + mtx_lock_spin(&sched_lock); if (p->p_sflag & (PS_INMEM | PS_SWAPPINGOUT | PS_SWAPPINGIN)) { + mtx_unlock_spin(&sched_lock); continue; } - mtx_lock_spin(&sched_lock); FOREACH_THREAD_IN_PROC(p, td) { /* * An otherwise runnable thread of a process
_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"