[lkml]   [2004]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    SubjectRe: [PATCH] cpumask 5/10 rewrite cpumask.h - single bitmap based implementation
    Rusty wrote:
    > > +/* No static inline type checking - see Subtlety (1) above. */
    > > +#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
    > How about something really grungy like:
    > #define cpu_isset(cpu, cpumask) \
    > ({ __typeof__(cpumask) __cpumask; \
    > (void)(&__cpumask) == (cpumask_t *)0); \
    > test_bit((cpu), (cpumask).bits); })

    Well ... we agree on the "grungy" part ... ;).

    Your flavor has the same problem as I saw with the static inline nested
    inside a #define macro flavor. On i386, SMP, gcc 3.3.2, when the
    cpu_isset() is part of a for-loop control, both the normal and 'grungy'
    flavors cost one extra jump instruction, whereas the flavor I ended up
    using places one chunk of code more optimally, saving a hard jump

    This saves 196 bytes of kernel text space.

    If you can show me a type checked cpu_isset() that generates code
    as tight as what I ended up using, let me know.

    Or if you would prefer I spend the 196 bytes to get this type checked,
    that's worthy of consideration as well.

    I won't rest till it's the best ...
    Programmer, Linux Scalability
    Paul Jackson <> 1.650.933.1373
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2005-03-22 14:03    [W:0.026 / U:3.644 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site