linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elladan <elladan@eskimo.com>
To: Rasmus Andersen <rasmus@jaquet.dk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC] CONFIG_TINY
Date: Wed, 23 Oct 2002 20:01:43 -0700	[thread overview]
Message-ID: <20021024030143.GA13661@eskimo.com> (raw)
In-Reply-To: <20021023215117.A29134@jaquet.dk>

On Wed, Oct 23, 2002 at 09:51:17PM +0200, Rasmus Andersen wrote:
> Hi,
> 
> Inspired by the recent lowmem threads on l-k and in loose
> conjunction with acme, I am trying to do a CONFIG_TINY
> patchset which would reduce the kernel image size and memory
> footprint. Below is my list of ideas, collected from the
> aforementioned threads and from acme's input. Note that some
> of these are already being persued by other people (notably
> [by me] Andrew Morton).
> 
> [...]
>
> o reduce usage of prinkt in kernel by #defining iprintk for
>   INFO messages etc and let the desired (minimum) logging 
>   level be decided at compile time.

Instead of doing it this way, why not use a preprocessor scheme like
this one which doesn't require you to patch anything (my apologies for
it being somewhat obtuse):

#define DBG_LVL 1
#define UNTAGGED_DBG_LVL 0

#define KERN_MSG_LVL 5
#define KERN_MSG_STRING "<5>"


#define printk(a, arg...) do { \
        { \
		if(DBG_LVL < UNTAGGED_DBG_LVL) \
			switch(UNTAGGED_DBG_LVL) { \
				default: \
					_printk("" a, ##arg); \
			} \
		} \
	} while(0)

#define KERN_WARNING 				); \
				case UNTAGGED_DBG_LVL: \
			} \
			if(DBG_LVL < KERN_MSG_LVL) { \
				_printk(KERN_MSG_STRING


(Yes, I enjoyed writing these macros)

The strings themselves will still be included, but you should be able to
run a string pruning program on the output objects since there is no
longer any reference to them at all.

Does this make more sense?  Maintaining a patch that changes all the
printks in the world is going to hurt!

-J

  parent reply	other threads:[~2002-10-24  2:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-23 19:51 [RFC] CONFIG_TINY Rasmus Andersen
2002-10-23 17:11 ` Joe Perches
2002-10-24 20:40   ` Rasmus Andersen
2002-10-23 20:08 ` Christoph Hellwig
2002-10-23 20:39   ` Rasmus Andersen
2002-10-24  3:01 ` Elladan [this message]
2002-10-25  5:19   ` Untested patch 1/2 - add ugly printk macros to kernel (was Re: [RFC] CONFIG_TINY) Elladan
2002-10-25  5:20   ` Untested patch 2/2 - Fix some kernel sources for macro printk " Elladan
2002-10-24 20:38 ` [RFC] CONFIG_TINY Rasmus Andersen
2002-10-25 21:45 ` Daniel Phillips

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021024030143.GA13661@eskimo.com \
    --to=elladan@eskimo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rasmus@jaquet.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).