Arrange for all kernel printks to be no-ops. Only available if CONFIG_EMBEDDED. This patch saves about 375k on my laptop config and nearly 100k on minimal configs.
Showing the changes to kernel (1 of 4 files). Show all
Unified · Split
| @@ -85,10 +85,6 @@ static int console_locked; · 84 unmodified lines | ||
| 85 | 85 | */ |
| 86 | 86 | static DEFINE_SPINLOCK(logbuf_lock); |
| 87 | 87 | |
| 88 | −static char __log_buf[__LOG_BUF_LEN]; | |
| 89 | −static char *log_buf = __log_buf; | |
| 90 | −static int log_buf_len = __LOG_BUF_LEN; | |
| 91 | − | |
| 92 | 88 | #define LOG_BUF_MASK (log_buf_len-1) |
| 93 | 89 | #define LOG_BUF(idx) (log_buf[(idx) & LOG_BUF_MASK]) |
| 94 | 90 | |
| @@ -99,7 +95,6 @@ static int log_buf_len = __LOG_BUF_LEN; · 4 unmodified lines | ||
| 99 | 95 | static unsigned long log_start; /* Index into log_buf: next char to be read by syslog() */ |
| 100 | 96 | static unsigned long con_start; /* Index into log_buf: next char to be sent to consoles */ |
| 101 | 97 | static unsigned long log_end; /* Index into log_buf: most-recently-written-char + 1 */ |
| 102 | −static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */ | |
| 103 | 98 | |
| 104 | 99 | /* |
| 105 | 100 | * Array of consoles built from command line options (console=) |
| @@ -120,6 +115,13 @@ static int preferred_console = -1; · 14 unmodified lines | ||
| 120 | 115 | /* Flag: console code may call schedule() */ |
| 121 | 116 | static int console_may_schedule; |
| 122 | 117 | |
| 118 | +#ifdef CONFIG_PRINTK | |
| 119 | + | |
| 120 | +static char __log_buf[__LOG_BUF_LEN]; | |
| 121 | +static char *log_buf = __log_buf; | |
| 122 | +static int log_buf_len = __LOG_BUF_LEN; | |
| 123 | +static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */ | |
| 124 | + | |
| 123 | 125 | /* |
| 124 | 126 | * Setup a list of consoles. Called from init/main.c |
| 125 | 127 | */ |
| @@ -535,6 +537,7 @@ __setup("time", printk_time_setup); · 409 unmodified lines | ||
| 535 | 537 | * then changes console_loglevel may break. This is because console_loglevel |
| 536 | 538 | * is inspected when the actual printing occurs. |
| 537 | 539 | */ |
| 540 | + | |
| 538 | 541 | asmlinkage int printk(const char *fmt, ...) |
| 539 | 542 | { |
| 540 | 543 | va_list args; |
| @@ -655,6 +658,18 @@ out: · 114 unmodified lines | ||
| 655 | 658 | EXPORT_SYMBOL(printk); |
| 656 | 659 | EXPORT_SYMBOL(vprintk); |
| 657 | 660 | |
| 661 | +#else | |
| 662 | + | |
| 663 | +asmlinkage long sys_syslog(int type, char __user * buf, int len) | |
| 664 | +{ | |
| 665 | + return 0; | |
| 666 | +} | |
| 667 | + | |
| 668 | +int do_syslog(int type, char __user * buf, int len) { return 0; } | |
| 669 | +static void call_console_drivers(unsigned long start, unsigned long end) {} | |
| 670 | + | |
| 671 | +#endif | |
| 672 | + | |
| 658 | 673 | /** |
| 659 | 674 | * acquire_console_sem - lock the console system for exclusive use. |
| 660 | 675 | * |
| @@ -931,7 +946,7 @@ int unregister_console(struct console * console) · 270 unmodified lines | ||
| 931 | 946 | return res; |
| 932 | 947 | } |
| 933 | 948 | EXPORT_SYMBOL(unregister_console); |
| 934 | − | |
| 949 | + | |
| 935 | 950 | /** |
| 936 | 951 | * tty_write_message - write a message to a certain tty, not just the console. |
| 937 | 952 | * |