mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org, peterz@infradead.org
Subject: Re: [PATCH] [4/4] SCHED: Use a lookup array in sd_level_to_string
Date: Wed, 12 Nov 2008 15:47:09 +0100	[thread overview]
Message-ID: <20081112144709.GB2672@cmpxchg.org> (raw)
In-Reply-To: <20081112124512.6EEF63E6610@basil.firstfloor.org>

On Wed, Nov 12, 2008 at 01:45:12PM +0100, Andi Kleen wrote:
> 
> Generates better/shorter code. Doesn't matter much because it's only
> a SCHED_DEBUG function. 
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> 
> ---
>  kernel/sched.c |   29 +++++++++++------------------
>  1 file changed, 11 insertions(+), 18 deletions(-)
> 
> Index: linux-2.6.28-rc4-test/kernel/sched.c
> ===================================================================
> --- linux-2.6.28-rc4-test.orig/kernel/sched.c	2008-11-12 12:36:23.000000000 +0100
> +++ linux-2.6.28-rc4-test/kernel/sched.c	2008-11-12 12:43:58.000000000 +0100
> @@ -6629,24 +6629,17 @@
>  
>  static inline const char *sd_level_to_string(enum sched_domain_level lvl)
>  {
> -	switch (lvl) {
> -	case SD_LV_NONE:
> -			return "NONE";
> -	case SD_LV_SIBLING:
> -			return "SIBLING";
> -	case SD_LV_MC:
> -			return "MC";
> -	case SD_LV_CPU:
> -			return "CPU";
> -	case SD_LV_NODE:
> -			return "NODE";
> -	case SD_LV_ALLNODES:
> -			return "ALLNODES";
> -	case SD_LV_MAX:
> -			return "MAX";
> -
> -	}
> -	return "MAX";
> +	static const char *lva[] = {
> +#define T(x) [SD_LV_ ## x ] = #T

Shouldn't                         ^ that be x?

	Hannes

  reply	other threads:[~2008-11-12 14:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-12 12:45 [PATCH] [0/4] SCHED: Trivial scheduler fixes Andi Kleen
2008-11-12 12:45 ` [PATCH] [1/4] SCHED: cache task_hot result Andi Kleen
2008-11-12 12:45 ` [PATCH] [2/4] SCHED: Mark all frequently used sysctls __read_mostly Andi Kleen
2008-11-12 12:45 ` [PATCH] [3/4] SCHED: don't inline idle_balance into schedule() Andi Kleen
2008-11-12 12:45 ` [PATCH] [4/4] SCHED: Use a lookup array in sd_level_to_string Andi Kleen
2008-11-12 14:47   ` Johannes Weiner [this message]
2008-11-12 15:28     ` Andi Kleen
2008-11-12 18:43     ` Ingo Molnar

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=20081112144709.GB2672@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /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

all inboxes | Powered by JetHome®