base-small: CONFIG_BASE_SMALL for small systems
Subsystems (3)
cover base-small: CONFIG_BASE_SMALL for small systems
This patch series introduced a new pair of CONFIG_EMBEDDED options call CONFIG_BASE_FULL/CONFIG_BASE_SMALL. Disabling CONFIG_BASE_FULL sets the boolean CONFIG_BASE_SMALL to 1 and it is used to shrink a number of core data structures. The space savings for the current batch is around 14k.
PATCH 2/8 base-small: shrink major_names hash
In reply to Matt MackallCONFIG_BASE_SMALL degrade genhd major names hash to linked list
drivers/block/genhd.c +2 -1
@@ -15,7 +15,8 @@#include <linux/kmod.h> #include <linux/kobj_map.h> -#define MAX_PROBE_HASH 255/* random */ +/* degrade to linked list for small systems */ +#define MAX_PROBE_HASH (CONFIG_BASE_SMALL ? 1 : 255)static struct subsystem block_subsys;
PATCH 1/8 base-small: introduce the CONFIG_BASE_SMALL flag
In reply to Matt MackallAdd CONFIG_BASE_SMALL for miscellaneous core size that don't warrant their own options. Example users to follow.
init/Kconfig +12 -0
@@ -286,6 +286,18 @@ reported. KALLSYMS_EXTRA_PASS is only a temporary workaround while you wait for kallsyms to be fixed. +config BASE_FULL + default y + bool "Enable full-sized data structures for core" if EMBEDDED + help + Disabling this option reduces the size of miscellaneous core + kernel data structures. + +config BASE_SMALL + int + default 0 if BASE_FULL + default 1 if !BASE_FULL + config FUTEX bool "Enable futex support" if EMBEDDED default y
PATCH 6/8 base-small: shrink futex queues
In reply to Matt MackallCONFIG_BASE_SMALL reduce futex hash table
kernel/futex.c +1 -1
@@ -40,7 +40,7 @@#include <linux/pagemap.h> #include <linux/syscalls.h> -#define FUTEX_HASHBITS 8 +#define FUTEX_HASHBITS (CONFIG_BASE_SMALL ? 4 : 8)/* * Futexes are matched on equal values of this key.
PATCH 5/8 base-small: shrink UID hash
In reply to Matt MackallCONFIG_BASE_SMALL reduce UID lookup hash
kernel/user.c +2 -1
@@ -18,7 +18,8 @@* UID task count cache, to get fast user lookup in "alloc_uid" * when changing user ID's (ie setuid() and friends). */ -#define UIDHASH_BITS 8 + +#define UIDHASH_BITS (CONFIG_BASE_SMALL ? 3 : 8)#define UIDHASH_SZ (1 << UIDHASH_BITS)#define UIDHASH_MASK (UIDHASH_SZ - 1)#define __uidhashfn (uid) (((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK)
PATCH 3/8 base-small: shrink chrdevs hash
In reply to Matt MackallCONFIG_BASE_SMALL degrade char dev hash table to linked list
fs/char_dev.c +2 -1
@@ -26,7 +26,8 @@static struct kobj_map *cdev_map; -#define MAX_PROBE_HASH 255/* random */ +/* degrade to linked list for small systems */ +#define MAX_PROBE_HASH (CONFIG_BASE_SMALL ? 1 : 255)static DEFINE_RWLOCK (chrdevs_lock);
PATCH 8/8 base-small: shrink console buffer
In reply to Matt MackallCONFIG_BASE_SMALL reduce console transfer buffer
include/linux/vt_kern.h +2 -1
@@ -84,7 +84,8 @@* vc_screen.c shares this temporary buffer with the console write code so that * we can easily avoid touching user space while holding the console spinlock. */ -#define CON_BUF_SIZE PAGE_SIZE + +#define CON_BUF_SIZE (CONFIG_BASE_SMALL ? 256 : PAGE_SIZE)extern char con_buf[CON_BUF_SIZE ];extern struct semaphore con_buf_sem;
PATCH 7/8 base-small: shrink timer hashes
In reply to Matt MackallCONFIG_BASE_SMALL reduce timer list hashes
kernel/timer.c +3 -2
@@ -51,8 +51,9 @@/* * per-CPU timer vector definitions: */ -#define TVN_BITS 6 -#define TVR_BITS 8 + +#define TVN_BITS (CONFIG_BASE_SMALL ? 4 : 6) +#define TVR_BITS (CONFIG_BASE_SMALL ? 6 : 8)#define TVN_SIZE (1 << TVN_BITS)#define TVR_SIZE (1 << TVR_BITS)#define TVN_MASK (TVN_SIZE - 1)
PATCH 4/8 base-small: shrink PID tables
In reply to Matt MackallCONFIG_BASE_SMALL reduce size of pidmap table for small machines
include/linux/threads.h +4 -3
@@ -7,7 +7,7 @@* The default limit for the nr of threads is now in * /proc/sys/kernel/threads-max. */ - +/* * Maximum supported processors that can run under SMP. This value is * set via configure setting. The maximum is equal to the size of the
@@ -25,11 +25,12 @@/* * This controls the default maximum pid allocated to a process */ -#define PID_MAX_DEFAULT 0x8000 +#define PID_MAX_DEFAULT (CONFIG_BASE_SMALL ? 0x1000 : 0x8000)/* * A maximum of 4 million PIDs should be enough for a while: */ -#define PID_MAX_LIMIT (sizeof(long) > 4 ? 4*1024*1024 : PID_MAX_DEFAULT) +#define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \ + (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))#endif
Quoted 5 lines · Matt Mackall
This patch series introduced a new pair of
CONFIG_EMBEDDEDoptions call CONFIG_BASE_FULL/CONFIG_BASE_SMALL. DisablingCONFIG_BASE_FULLsets the booleanCONFIG_BASE_SMALLto 1 and it is used to shrink a number of core data structures. The space savings for the current batch is around 14k.
Why _two_ config options?
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
Quoted 8 lines · Horst von Brand
Quoted 5 lines · Matt Mackall
This patch series introduced a new pair of
CONFIG_EMBEDDEDoptions call CONFIG_BASE_FULL/CONFIG_BASE_SMALL. DisablingCONFIG_BASE_FULLsets the booleanCONFIG_BASE_SMALLto 1 and it is used to shrink a number of core data structures. The space savings for the current batch is around 14k.Why _two_ config options?
Um, Andrew made me do it?
One option is an int and is used thusly:
#define FOO (CONFIG_BASE_SMALL ? 1 : 1000)
But it's also sometimes useful to have two opposing options so that you can use:
obj-(CONFIG_OBJ_A) += a.obj obj-(CONFIG_OBJ_B) += b.obj
Signature · 1 line
Mathematics is the supreme nostalgia of our time.