svn commit: r207219 - in user/kmacy/head_page_lock_2/sys/amd64: amd64 include

John Baldwin jhb at freebsd.org
Mon Apr 26 14:33:33 UTC 2010


On Sunday 25 April 2010 11:16:01 pm Kip Macy wrote:
> Author: kmacy
> Date: Mon Apr 26 03:16:00 2010
> New Revision: 207219
> URL: http://svn.freebsd.org/changeset/base/207219
> 
> Log:
>   - remove ugly lock_object casts by creating LOCKOBJPTR macros
>   - replace if (pa) PA_UNLOCK(pa) with PA_UNLOCK_COND(pa)
>   - avoid LOR in pmap_pv_demote_pde - the initial pa is already locked and 
subsequent pages need to
>     be locked with pa_tryrelock
> 
> Modified:
>   user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
>   user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
> 
> Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
> 
==============================================================================
> --- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 02:35:37 
2010	(r207218)
> +++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 26 03:16:00 
2010	(r207219)
> @@ -177,10 +177,18 @@ struct vp_lock {
>  #define	pa_to_pvh(pa)	(&pv_table[pa_index(pa)])
>  
>  #define	PA_LOCKPTR(pa)	&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].vp_lock
> +#define	PA_LOCKOBJPTR(pa)	((struct lock_object *)PA_LOCKPTR((pa)))
>  #define	PA_LOCK(pa)	mtx_lock(PA_LOCKPTR(pa))
>  #define	PA_TRYLOCK(pa)	mtx_trylock(PA_LOCKPTR(pa))
>  #define	PA_UNLOCK(pa)	mtx_unlock(PA_LOCKPTR(pa))
> +#define PA_UNLOCK_COND(pa) 			\
> +	do {		   			\
> +		if (pa) 			\
> +			PA_UNLOCK(pa);		\
> +	} while (0)
> +
>  #define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
> +#define	PMAP_LOCKOBJPTR(pmap)	((struct lock_object *)(&(pmap)->pm_mtx))

FWIW, I would actually prefer to use something like &PA_LOCKPTR(pa)->lo_object 
rather than casts.

-- 
John Baldwin


More information about the svn-src-user mailing list