Module Name:    src
Committed By:   thorpej
Date:           Wed Sep 23 00:51:59 UTC 2020

Modified Files:
        src/sys/arch/alpha/include: mutex.h

Log Message:
Move the simple lock used for spin mutexes into the sub-structure that
contains the spin lock IPL field.  This shrinks kmutex_t to sizeof(uintptr_t)
on Alpha.

This should have been done in rev 1.3 when the lock ID field was removed,
but better late than never, I guess.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/alpha/include/mutex.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/include/mutex.h
diff -u src/sys/arch/alpha/include/mutex.h:1.6 src/sys/arch/alpha/include/mutex.h:1.7
--- src/sys/arch/alpha/include/mutex.h:1.6	Fri Nov 29 22:55:33 2019
+++ src/sys/arch/alpha/include/mutex.h	Wed Sep 23 00:51:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mutex.h,v 1.6 2019/11/29 22:55:33 riastradh Exp $	*/
+/*	$NetBSD: mutex.h,v 1.7 2020/09/23 00:51:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 The NetBSD Foundation, Inc.
@@ -36,7 +36,6 @@
 
 struct kmutex {
 	uintptr_t	mtx_pad1;
-	uint32_t	mtx_pad2;
 };
 
 #else	/* __MUTEX_PRIVATE */
@@ -48,14 +47,17 @@ struct kmutex {
 			volatile uint8_t	mtxs_flags;
 			ipl_cookie_t		mtxs_ipl;
 			volatile uint16_t	mtxs_unused;
+			__cpu_simple_lock_t	mtxs_lock;
 		} s;
 	} u;
-	__cpu_simple_lock_t	mtx_lock;
 };
 
+__CTASSERT(sizeof(struct kmutex) == sizeof(uintptr_t));
+
 #define	mtx_owner 			u.mtxa_owner
 #define	mtx_flags 			u.s.mtxs_flags
 #define	mtx_ipl 			u.s.mtxs_ipl
+#define	mtx_lock 			u.s.mtxs_lock
 
 #define	__HAVE_SIMPLE_MUTEXES		1
 #define	__HAVE_MUTEX_STUBS		1

Reply via email to