lkml.org 
[lkml]   [2008]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] [4/4] SCHED: Use a lookup array in sd_level_to_string

    * Johannes Weiner <hannes@cmpxchg.org> wrote:

    > 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?

    hasnt been tested i guess. Note that the patch is moot: an equivalent
    change has been done in the scheduler tree already, in a cleaner way.
    It's all in linux-next.

    Ingo


    \
     
     \ /
      Last update: 2008-11-12 19:45    [W:0.039 / U:58.492 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site