[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081106080057.GF8459@elte.hu>
Date: Thu, 6 Nov 2008 09:00:57 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Li Zefan <lizf@...fujitsu.com>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched: rewrite SCHED_CPUMASK_ALLOC
* Li Zefan <lizf@...fujitsu.com> wrote:
> #if NR_CPUS > 128
> -#define SCHED_CPUMASK_ALLOC 1
> -#define SCHED_CPUMASK_FREE(v) kfree(v)
> -#define SCHED_CPUMASK_DECLARE(v) struct allmasks *v
> +#define SCHED_CPUMASK_DECLARE(v) struct allmasks *v
> +#define SCHED_CPUMASK_ALLOC(v) v = kmalloc(sizeof(*v), GFP_KERNEL)
> +#define SCHED_CPUMASK_FREE(v) kfree(v)
> #else
> -#define SCHED_CPUMASK_ALLOC 0
> -#define SCHED_CPUMASK_FREE(v)
> -#define SCHED_CPUMASK_DECLARE(v) struct allmasks _v, *v = &_v
> +#define SCHED_CPUMASK_DECLARE(v) struct allmasks _v, *v = &_v
> +#define SCHED_CPUMASK_ALLOC(v)
> +#define SCHED_CPUMASK_FREE(v)
> #endif
ok, the #ifdef removal is nice, but we can make it even cleaner:
please just change it to a sched_cpumask_alloc() inline. That way
SCHED_CPUMASK_DECLARE() can go away as well: just declare the
variable, it will be unused in the <128 CPUs case.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists