Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Feb 2002 20:43:36 -0800 (PST)
From:      Julian Elischer <julian@elischer.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        current@freebsd.org
Subject:   RE: ucred for threads
Message-ID:  <20020212021158.33B129EFB2@okeeffe.bestweb.net>

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


On Thu, 7 Feb 2002, John Baldwin wrote:

> 
> 
> This code is not safe on SMP non-i386 machines (i.e. ia64, sparc64, alpha, and
> possibly p3 and later i386's) because the p_ucred value you read could easily
> be a stale value, thus rendering the test invalid.  You need the lock for the
> compare.  Conceptually minimizing the crfree's isn't bad I guess.  However, the
> td_ucred pointer should nto be read if the thread is not in the kernel, and
> having it set to NULL when we leave the kernel provides a conveninet way of
> ensuring this doesn't happen since we will panic if we do.


if the ucred is stale or not is completely unimportant.
if you wish to ensure that all your threads get the new ID that you are
setting then you need to synchronise them at the program level
to ensure teh order in which they enter the kernel on their next system
calls. There is no point is sychronising with locks because
the threads in question may have run in any order anyhow.




> 
> -- 
> 
> John Baldwin <jhb@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
> "Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message
> 


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




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