linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny
@ 2005-01-22  0:09 Matt Mackall
  2005-01-22  0:09 ` [PATCH 1/8] core-small: Add option to embedded menu Matt Mackall
  2005-01-23  8:40 ` [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny Andrew Morton
  0 siblings, 2 replies; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

This set of patches introduces a new config option CONFIG_CORE_SMALL
from the -tiny tree for small systems. This series should apply
cleanly against 2.6.11-rc1-mm2.

When selected, it enables various tweaks to miscellaneous core data
structures to shrink their size on small systems. While each tweak is
fairly small, in aggregate they can save a substantial amount of
memory.

1 Add option to embedded menu
2 Collapse major names hash
3 Collapse chrdevs hash
4 Shrink PID lookup tables
5 Shrink uid hash
6 Shrink futex queue hash
7 Shrink timer lists
8 Shrink console buffer

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 5/8] core-small: Shrink uid hash
  2005-01-22  0:09       ` [PATCH 4/8] core-small: Shrink PID lookup tables Matt Mackall
@ 2005-01-22  0:09         ` Matt Mackall
  2005-01-22  0:09           ` [PATCH 6/8] core-small: Shrink futex queue hash Matt Mackall
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

CONFIG_CORE_SMALL reduce UID lookup hash

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny/kernel/user.c
===================================================================
--- tiny.orig/kernel/user.c	2004-12-04 15:42:41.000000000 -0800
+++ tiny/kernel/user.c	2004-12-04 19:42:32.462123939 -0800
@@ -18,7 +18,11 @@
  * UID task count cache, to get fast user lookup in "alloc_uid"
  * when changing user ID's (ie setuid() and friends).
  */
+#ifdef CONFIG_CORE_SMALL
+#define UIDHASH_BITS		3
+#else
 #define UIDHASH_BITS		8
+#endif
 #define UIDHASH_SZ		(1 << UIDHASH_BITS)
 #define UIDHASH_MASK		(UIDHASH_SZ - 1)
 #define __uidhashfn(uid)	(((uid >> UIDHASH_BITS) + uid) & UIDHASH_MASK)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 3/8] core-small: Collapse chrdevs hash
  2005-01-22  0:09   ` [PATCH 2/8] core-small: Collapse major names hash Matt Mackall
@ 2005-01-22  0:09     ` Matt Mackall
  2005-01-22  0:09       ` [PATCH 4/8] core-small: Shrink PID lookup tables Matt Mackall
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

CONFIG_CORE_SMALL degrade char dev hash table to linked list

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny-queue/fs/char_dev.c
===================================================================
--- tiny-queue.orig/fs/char_dev.c	2005-01-21 09:59:45.000000000 -0800
+++ tiny-queue/fs/char_dev.c	2005-01-21 15:31:52.000000000 -0800
@@ -26,7 +26,11 @@
 
 static struct kobj_map *cdev_map;
 
+#ifdef CONFIG_CORE_SMALL
+#define MAX_PROBE_HASH 1 /* degrade to linked list */
+#else
 #define MAX_PROBE_HASH 255	/* random */
+#endif
 
 static DEFINE_RWLOCK(chrdevs_lock);
 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 1/8] core-small: Add option to embedded menu
  2005-01-22  0:09 [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny Matt Mackall
@ 2005-01-22  0:09 ` Matt Mackall
  2005-01-22  0:09   ` [PATCH 2/8] core-small: Collapse major names hash Matt Mackall
  2005-01-23  8:40 ` [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny Andrew Morton
  1 sibling, 1 reply; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

Add CONFIG_CORE_SMALL for miscellaneous core size that don't warrant
their own options. Example users to follow.

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny/init/Kconfig
===================================================================
--- tiny.orig/init/Kconfig	2004-12-04 15:42:40.394703286 -0800
+++ tiny/init/Kconfig	2004-12-04 19:24:36.404346070 -0800
@@ -287,6 +287,12 @@
 	   reported.  KALLSYMS_EXTRA_PASS is only a temporary workaround while
 	   you wait for kallsyms to be fixed.
 
+config CORE_SMALL
+	default n
+	bool "Enable various size reductions for core" if EMBEDDED
+	help
+	  This reduces the size of miscellaneous core kernel data structures.
+
 config FUTEX
 	bool "Enable futex support" if EMBEDDED
 	default y

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 2/8] core-small: Collapse major names hash
  2005-01-22  0:09 ` [PATCH 1/8] core-small: Add option to embedded menu Matt Mackall
@ 2005-01-22  0:09   ` Matt Mackall
  2005-01-22  0:09     ` [PATCH 3/8] core-small: Collapse chrdevs hash Matt Mackall
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

CONFIG_CORE_SMALL degrade genhd major names hash to linked list

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny-new/drivers/block/genhd.c
===================================================================
--- tiny-new.orig/drivers/block/genhd.c	2004-11-17 00:04:36.000000000 -0800
+++ tiny-new/drivers/block/genhd.c	2004-11-17 10:30:10.992098381 -0800
@@ -15,7 +15,11 @@
 #include <linux/kmod.h>
 #include <linux/kobj_map.h>
 
+#ifdef CONFIG_CORE_SMALL
+#define MAX_PROBE_HASH 1 /* degrade to linked list */
+#else
 #define MAX_PROBE_HASH 255	/* random */
+#endif
 
 static struct subsystem block_subsys;
 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 4/8] core-small: Shrink PID lookup tables
  2005-01-22  0:09     ` [PATCH 3/8] core-small: Collapse chrdevs hash Matt Mackall
@ 2005-01-22  0:09       ` Matt Mackall
  2005-01-22  0:09         ` [PATCH 5/8] core-small: Shrink uid hash Matt Mackall
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

CONFIG_CORE_SMALL reduce size of pidmap table for small machines

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny/include/linux/threads.h
===================================================================
--- tiny.orig/include/linux/threads.h	2004-12-04 15:42:35.000000000 -0800
+++ tiny/include/linux/threads.h	2004-12-04 19:42:19.032212529 -0800
@@ -25,11 +25,19 @@
 /*
  * This controls the default maximum pid allocated to a process
  */
+#ifdef CONFIG_CORE_SMALL
+#define PID_MAX_DEFAULT 0x1000
+#else
 #define PID_MAX_DEFAULT 0x8000
+#endif
 
 /*
  * A maximum of 4 million PIDs should be enough for a while:
  */
+#ifdef CONFIG_CORE_SMALL
+#define PID_MAX_LIMIT (PAGE_SIZE*8) /* one pidmap entry */
+#else
 #define PID_MAX_LIMIT (sizeof(long) > 4 ? 4*1024*1024 : PID_MAX_DEFAULT)
+#endif
 
 #endif

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 7/8] core-small: Shrink timer lists
  2005-01-22  0:09           ` [PATCH 6/8] core-small: Shrink futex queue hash Matt Mackall
@ 2005-01-22  0:09             ` Matt Mackall
  2005-01-22  0:09               ` [PATCH 8/8] core-small: Shrink console buffer Matt Mackall
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

CONFIG_CORE_SMALL reduce timer list hashes

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny-queue/kernel/timer.c
===================================================================
--- tiny-queue.orig/kernel/timer.c	2005-01-21 09:59:50.000000000 -0800
+++ tiny-queue/kernel/timer.c	2005-01-21 15:31:58.000000000 -0800
@@ -50,8 +50,14 @@
 /*
  * per-CPU timer vector definitions:
  */
+
+#ifdef CONFIG_CORE_SMALL
+#define TVN_BITS 4
+#define TVR_BITS 6
+#else
 #define TVN_BITS 6
 #define TVR_BITS 8
+#endif
 #define TVN_SIZE (1 << TVN_BITS)
 #define TVR_SIZE (1 << TVR_BITS)
 #define TVN_MASK (TVN_SIZE - 1)

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 8/8] core-small: Shrink console buffer
  2005-01-22  0:09             ` [PATCH 7/8] core-small: Shrink timer lists Matt Mackall
@ 2005-01-22  0:09               ` Matt Mackall
  0 siblings, 0 replies; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

CONFIG_CORE_SMALL reduce console transfer buffer

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny-queue/include/linux/vt_kern.h
===================================================================
--- tiny-queue.orig/include/linux/vt_kern.h	2005-01-21 09:59:49.000000000 -0800
+++ tiny-queue/include/linux/vt_kern.h	2005-01-21 15:48:39.000000000 -0800
@@ -84,7 +84,11 @@
  * 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
+#ifdef CONFIG_CORE_SMALL
+#define CON_BUF_SIZE 512
+#else
+#define CON_BUF_SIZE PAGE_SIZE
+#endif
 extern char con_buf[CON_BUF_SIZE];
 extern struct semaphore con_buf_sem;
 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [PATCH 6/8] core-small: Shrink futex queue hash
  2005-01-22  0:09         ` [PATCH 5/8] core-small: Shrink uid hash Matt Mackall
@ 2005-01-22  0:09           ` Matt Mackall
  2005-01-22  0:09             ` [PATCH 7/8] core-small: Shrink timer lists Matt Mackall
  0 siblings, 1 reply; 15+ messages in thread
From: Matt Mackall @ 2005-01-22  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Linux Kernel

CONFIG_CORE_SMALL reduce futex hash table

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: tiny-new/kernel/futex.c
===================================================================
--- tiny-new.orig/kernel/futex.c	2004-11-17 00:04:03.000000000 -0800
+++ tiny-new/kernel/futex.c	2004-11-17 10:30:20.749824672 -0800
@@ -40,7 +40,11 @@
 #include <linux/pagemap.h>
 #include <linux/syscalls.h>
 
+#ifdef CONFIG_CORE_SMALL
+#define FUTEX_HASHBITS 4
+#else
 #define FUTEX_HASHBITS 8
+#endif
 
 /*
  * Futexes are matched on equal values of this key.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny
  2005-01-22  0:09 [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny Matt Mackall
  2005-01-22  0:09 ` [PATCH 1/8] core-small: Add option to embedded menu Matt Mackall
@ 2005-01-23  8:40 ` Andrew Morton
  2005-01-23 17:52   ` Matt Mackall
  1 sibling, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2005-01-23  8:40 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel

Matt Mackall <mpm@selenic.com> wrote:
>
> This set of patches introduces a new config option CONFIG_CORE_SMALL
> from the -tiny tree for small systems. This series should apply
> cleanly against 2.6.11-rc1-mm2.
> 
> When selected, it enables various tweaks to miscellaneous core data
> structures to shrink their size on small systems. While each tweak is
> fairly small, in aggregate they can save a substantial amount of
> memory.

You know what I'm going to ask ;)  How much memory?

I wish it didn't have "core" in the name.  A little misleading.

Did you think of making CONFIG_CORE_SMALL an integer which has values zero
or one?

Then you can lose all those ifdefs:

#define MAX_PROBE_HASH (255 - CONFIG_CORE_SMALL * 254)	/* dorky */

#define PID_MAX_DEFAULT (CONFIG_CORE_SMALL ? 0x1000 : 0x8000)
#define UIDHASH_BITS (CONFIG_CORE_SMALL ? 3 : 8)
#define FUTEX_HASHBITS (CONFIG_CORE_SMALL ? 4 : 8)
etc.

I think the ?: thing will work everywhere:

	#define XX 1
	char xx[XX ? 10 : 20];

even this works...

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny
  2005-01-23  8:40 ` [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny Andrew Morton
@ 2005-01-23 17:52   ` Matt Mackall
  2005-01-23 21:05     ` Andrew Morton
  2005-01-24 20:00     ` Alan Cox
  0 siblings, 2 replies; 15+ messages in thread
From: Matt Mackall @ 2005-01-23 17:52 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Sun, Jan 23, 2005 at 12:40:42AM -0800, Andrew Morton wrote:
> Matt Mackall <mpm@selenic.com> wrote:
> >
> > This set of patches introduces a new config option CONFIG_CORE_SMALL
> > from the -tiny tree for small systems. This series should apply
> > cleanly against 2.6.11-rc1-mm2.
> > 
> > When selected, it enables various tweaks to miscellaneous core data
> > structures to shrink their size on small systems. While each tweak is
> > fairly small, in aggregate they can save a substantial amount of
> > memory.
> 
> You know what I'm going to ask ;)  How much memory?

This stuff is mostly pretty small, a few K per patch. I think these 8
are about 40k total but my notes are several months old. 

> I wish it didn't have "core" in the name.  A little misleading.

Well I've got another set called NET_SMALL. BASE?

> Did you think of making CONFIG_CORE_SMALL an integer which has values zero
> or one?
> 
> Then you can lose all those ifdefs:
> 
> #define MAX_PROBE_HASH (255 - CONFIG_CORE_SMALL * 254)	/* dorky */

Ew.

> #define PID_MAX_DEFAULT (CONFIG_CORE_SMALL ? 0x1000 : 0x8000)
> #define UIDHASH_BITS (CONFIG_CORE_SMALL ? 3 : 8)
> #define FUTEX_HASHBITS (CONFIG_CORE_SMALL ? 4 : 8)
> etc.

Hmm. I think we'd want a hidden config variable for this and I'm not
sure how well the config language allows setting an int from a bool.
And then it would need another name. On the whole, seems more complex
than what I've done.

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny
  2005-01-23 17:52   ` Matt Mackall
@ 2005-01-23 21:05     ` Andrew Morton
  2005-01-24  2:50       ` Matt Mackall
  2005-01-24 20:00     ` Alan Cox
  1 sibling, 1 reply; 15+ messages in thread
From: Andrew Morton @ 2005-01-23 21:05 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel

Matt Mackall <mpm@selenic.com> wrote:
>
> > I wish it didn't have "core" in the name.  A little misleading.
> 
>  Well I've got another set called NET_SMALL. BASE?

BASE works, I guess.

>  > #define PID_MAX_DEFAULT (CONFIG_CORE_SMALL ? 0x1000 : 0x8000)
>  > #define UIDHASH_BITS (CONFIG_CORE_SMALL ? 3 : 8)
>  > #define FUTEX_HASHBITS (CONFIG_CORE_SMALL ? 4 : 8)
>  > etc.
> 
>  Hmm. I think we'd want a hidden config variable for this and I'm not
>  sure how well the config language allows setting an int from a bool.

config AKPM_BOOL
        bool "akpm"

config AKPM_INT
        int
        default 1 if AKPM_BOOL
        default 0 if !AKPM_BOOL

seems to do everything which it should.

>  And then it would need another name. On the whole, seems more complex
>  than what I've done.

No, it's quite simple and avoids lots of ifdeffing.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny
  2005-01-23 21:05     ` Andrew Morton
@ 2005-01-24  2:50       ` Matt Mackall
  0 siblings, 0 replies; 15+ messages in thread
From: Matt Mackall @ 2005-01-24  2:50 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

On Sun, Jan 23, 2005 at 01:05:14PM -0800, Andrew Morton wrote:
> Matt Mackall <mpm@selenic.com> wrote:
> >
> > > I wish it didn't have "core" in the name.  A little misleading.
> > 
> >  Well I've got another set called NET_SMALL. BASE?
> 
> BASE works, I guess.
> 
> >  > #define PID_MAX_DEFAULT (CONFIG_CORE_SMALL ? 0x1000 : 0x8000)
> >  > #define UIDHASH_BITS (CONFIG_CORE_SMALL ? 3 : 8)
> >  > #define FUTEX_HASHBITS (CONFIG_CORE_SMALL ? 4 : 8)
> >  > etc.
> > 
> >  Hmm. I think we'd want a hidden config variable for this and I'm not
> >  sure how well the config language allows setting an int from a bool.
> 
> config AKPM_BOOL
>         bool "akpm"
> 
> config AKPM_INT
>         int
>         default 1 if AKPM_BOOL
>         default 0 if !AKPM_BOOL
> 
> seems to do everything which it should.
> 
> >  And then it would need another name. On the whole, seems more complex
> >  than what I've done.
> 
> No, it's quite simple and avoids lots of ifdeffing.

Ok, will respin these Monday.

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny
  2005-01-23 17:52   ` Matt Mackall
  2005-01-23 21:05     ` Andrew Morton
@ 2005-01-24 20:00     ` Alan Cox
  2005-01-24 22:47       ` Tim Bird
  1 sibling, 1 reply; 15+ messages in thread
From: Alan Cox @ 2005-01-24 20:00 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Andrew Morton, Linux Kernel Mailing List

On Sul, 2005-01-23 at 17:52, Matt Mackall wrote:
> > Then you can lose all those ifdefs:
> > 
> > #define MAX_PROBE_HASH (255 - CONFIG_CORE_SMALL * 254)	/* dorky */
> 
> Ew.

#define		SIZE_HASH(small, large)    CONFIG_CORE_SMALL ? (small):(large)

Perhaps ?



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny
  2005-01-24 20:00     ` Alan Cox
@ 2005-01-24 22:47       ` Tim Bird
  0 siblings, 0 replies; 15+ messages in thread
From: Tim Bird @ 2005-01-24 22:47 UTC (permalink / raw)
  To: Alan Cox; +Cc: Matt Mackall, Andrew Morton, Linux Kernel Mailing List

Alan Cox wrote:
> #define		SIZE_HASH(small, large)    CONFIG_CORE_SMALL ? (small):(large)

I hate to be a "ditto-head", but I like this a lot.

=============================
Tim Bird
Architecture Group Chair, CE Linux Forum
Senior Staff Engineer, Sony Electronics
=============================

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2005-01-24 22:50 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-22  0:09 [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny Matt Mackall
2005-01-22  0:09 ` [PATCH 1/8] core-small: Add option to embedded menu Matt Mackall
2005-01-22  0:09   ` [PATCH 2/8] core-small: Collapse major names hash Matt Mackall
2005-01-22  0:09     ` [PATCH 3/8] core-small: Collapse chrdevs hash Matt Mackall
2005-01-22  0:09       ` [PATCH 4/8] core-small: Shrink PID lookup tables Matt Mackall
2005-01-22  0:09         ` [PATCH 5/8] core-small: Shrink uid hash Matt Mackall
2005-01-22  0:09           ` [PATCH 6/8] core-small: Shrink futex queue hash Matt Mackall
2005-01-22  0:09             ` [PATCH 7/8] core-small: Shrink timer lists Matt Mackall
2005-01-22  0:09               ` [PATCH 8/8] core-small: Shrink console buffer Matt Mackall
2005-01-23  8:40 ` [PATCH 0/8] core-small: Introduce CONFIG_CORE_SMALL from -tiny Andrew Morton
2005-01-23 17:52   ` Matt Mackall
2005-01-23 21:05     ` Andrew Morton
2005-01-24  2:50       ` Matt Mackall
2005-01-24 20:00     ` Alan Cox
2005-01-24 22:47       ` Tim Bird

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).