Discussion:
RFC: make UMTX hash table size configurable
Adrian Chadd
2015-05-20 16:28:24 UTC
Permalink
Hi,

This patch makes the umtx hash table size configurable. It saves ~40k
of footprint from embedded images.

(I can't seem to get phabricator to create a diff based on a set of
files, rather than the whole tree. Sigh.)

***@lucy-11i386:~/work/freebsd/head-embedded/src % svn diff
sys/kern/ sys/conf/options
Index: sys/kern/kern_umtx.c
===================================================================
--- sys/kern/kern_umtx.c (revision 282934)
+++ sys/kern/kern_umtx.c (working copy)
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD$");

#include "opt_compat.h"
-#include "opt_umtx_profiling.h"
+#include "opt_umtx.h"

#include <sys/param.h>
#include <sys/kernel.h>
@@ -184,7 +184,11 @@
PRI_MAX_TIMESHARE : (td)->td_user_pri)

#define GOLDEN_RATIO_PRIME 2654404609U
+#ifdef UMTX_NUM_CHAINS
+#define UMTX_CHAINS UMTX_NUM_CHAINS
+#else
#define UMTX_CHAINS 512
+#endif /* UMTX_NUM_CHAINS */
#define UMTX_SHIFTS (__WORD_BIT - 9)

#define GET_SHARE(flags) \
Index: sys/conf/options
===================================================================
--- sys/conf/options (revision 282934)
+++ sys/conf/options (working copy)
@@ -209,7 +209,8 @@
SYSVSHM opt_sysvipc.h
SW_WATCHDOG opt_watchdog.h
TURNSTILE_PROFILING
-UMTX_PROFILING
+UMTX_PROFILING opt_umtx.h
+UMTX_NUM_CHAINS opt_umtx.h
VFS_AIO
VERBOSE_SYSINIT
WLCACHE opt_wavelan.h
Eric van Gyzen
2015-05-20 16:36:07 UTC
Permalink
Adrian,

Good idea. Looks good to me.

Eric
Post by Adrian Chadd
Hi,
This patch makes the umtx hash table size configurable. It saves ~40k
of footprint from embedded images.
(I can't seem to get phabricator to create a diff based on a set of
files, rather than the whole tree. Sigh.)
sys/kern/ sys/conf/options
Index: sys/kern/kern_umtx.c
===================================================================
--- sys/kern/kern_umtx.c (revision 282934)
+++ sys/kern/kern_umtx.c (working copy)
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD$");
#include "opt_compat.h"
-#include "opt_umtx_profiling.h"
+#include "opt_umtx.h"
#include <sys/param.h>
#include <sys/kernel.h>
@@ -184,7 +184,11 @@
PRI_MAX_TIMESHARE : (td)->td_user_pri)
#define GOLDEN_RATIO_PRIME 2654404609U
+#ifdef UMTX_NUM_CHAINS
+#define UMTX_CHAINS UMTX_NUM_CHAINS
+#else
#define UMTX_CHAINS 512
+#endif /* UMTX_NUM_CHAINS */
#define UMTX_SHIFTS (__WORD_BIT - 9)
#define GET_SHARE(flags) \
Index: sys/conf/options
===================================================================
--- sys/conf/options (revision 282934)
+++ sys/conf/options (working copy)
@@ -209,7 +209,8 @@
SYSVSHM opt_sysvipc.h
SW_WATCHDOG opt_watchdog.h
TURNSTILE_PROFILING
-UMTX_PROFILING
+UMTX_PROFILING opt_umtx.h
+UMTX_NUM_CHAINS opt_umtx.h
VFS_AIO
VERBOSE_SYSINIT
WLCACHE opt_wavelan.h
_______________________________________________
http://lists.freebsd.org/mailman/listinfo/freebsd-arch
Konstantin Belousov
2015-05-20 16:57:38 UTC
Permalink
Post by Eric van Gyzen
Adrian,
Good idea. Looks good to me.
Eric
Post by Adrian Chadd
Hi,
This patch makes the umtx hash table size configurable. It saves ~40k
of footprint from embedded images.
(I can't seem to get phabricator to create a diff based on a set of
files, rather than the whole tree. Sigh.)
sys/kern/ sys/conf/options
Index: sys/kern/kern_umtx.c
===================================================================
--- sys/kern/kern_umtx.c (revision 282934)
+++ sys/kern/kern_umtx.c (working copy)
@@ -29,7 +29,7 @@
__FBSDID("$FreeBSD$");
#include "opt_compat.h"
-#include "opt_umtx_profiling.h"
+#include "opt_umtx.h"
#include <sys/param.h>
#include <sys/kernel.h>
@@ -184,7 +184,11 @@
PRI_MAX_TIMESHARE : (td)->td_user_pri)
#define GOLDEN_RATIO_PRIME 2654404609U
+#ifdef UMTX_NUM_CHAINS
+#define UMTX_CHAINS UMTX_NUM_CHAINS
+#else
#define UMTX_CHAINS 512
+#endif /* UMTX_NUM_CHAINS */
#define UMTX_SHIFTS (__WORD_BIT - 9)
#define GET_SHARE(flags) \
Index: sys/conf/options
===================================================================
--- sys/conf/options (revision 282934)
+++ sys/conf/options (working copy)
@@ -209,7 +209,8 @@
SYSVSHM opt_sysvipc.h
SW_WATCHDOG opt_watchdog.h
TURNSTILE_PROFILING
-UMTX_PROFILING
+UMTX_PROFILING opt_umtx.h
+UMTX_NUM_CHAINS opt_umtx.h
VFS_AIO
VERBOSE_SYSINIT
WLCACHE opt_wavelan.h
It makes more sense to make the hash size a tunable. The hash mask
would also need to be a variable.

Loading...