From: Ingo Molnar <mingo@elte.hu>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: rewrite SCHED_CPUMASK_ALLOC
Date: Thu, 6 Nov 2008 09:00:57 +0100 [thread overview]
Message-ID: <20081106080057.GF8459@elte.hu> (raw)
In-Reply-To: <4911341C.7020207@cn.fujitsu.com>
* Li Zefan <lizf@cn.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
next prev parent reply other threads:[~2008-11-06 8:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-05 5:50 Li Zefan
2008-11-06 8:00 ` Ingo Molnar [this message]
2008-11-07 7:17 ` Li Zefan
2008-11-07 8:16 ` Ingo Molnar
2008-11-07 9:03 ` Li Zefan
2008-11-07 9:30 ` 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=20081106080057.GF8459@elte.hu \
--to=mingo@elte.hu \
--cc=a.p.zijlstra@chello.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
/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®