Re: [SSI] openssi/kernel/cluster/ssi/vproc vp_subr.c, 1.15, 1.16

John Hughes <[email protected]> Sun, 08 Feb 2009 11:34:28 +0100
Newsgroups gmane.linux.cluster.ssic.devel
Message-ID <[email protected]>
Roger Tsang wrote:
> --- vp_subr.c	3 Feb 2009 06:18:13 -0000	1.15
> +++ vp_subr.c	8 Feb 2009 02:44:43 -0000	1.16
> @@ -249,10 +249,7 @@
>  		VPROC_REFCNT_UNLOCK(v);
>  	}
>  #else
> -	BUG_ON(READ_ATOMIC_INT(&v->vp_ref_cnt) < 1);
> -
> -	if (atomic_read(&v->vp_ref_cnt) == 1)
> -		might_sleep();
> +	might_sleep_if(atomic_read(&v->vp_ref_cnt) == 1);
>  #ifdef VPROC_LIST_SPINLOCK
>  	if (!atomic_dec_and_lock(&v->vp_ref_cnt, &(&vproc_list_lock)->sp_lock))
>  #else
>   
What's your opinion of the OpenSSI/CI synch.h macros?  Should we be 
using READ_ATOMIC_INT or atomic_read?

I've made an ATOMIC_DEC_AND_LOCK_SPIN_LOCK to avoid exposing the
sp_lock field of our SPIN_LOCK_T:

#define ATOMIC_DEC_AND_LOCK_SPIN_LOCK(_atomic, _lockp) \
        ssi_atomic_dec_and_lock_spin_lock(_atomic, _lockp)

static inline int ssi_atomic_dec_and_lock_spin_lock(
        atomic_t *atomic, SPIN_LOCK_T *lockp)
{
        SSI_LOCK_ASSERT_INITED(lockp);
        SSI_LOCK_ASSERT(lockp->sp_owner != current);
        SSI_LOCK_ASSERT(!in_interrupt());
        if (atomic_dec_and_lock(atomic, &lockp->sp_lock)) {
                lockp->sp_owner = current;
                return 1;
        }
        return 0;
}



------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com