All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched: rewrite SCHED_CPUMASK_ALLOC
Date: Fri, 07 Nov 2008 15:17:32 +0800	[thread overview]
Message-ID: <4913EB8C.8010003@cn.fujitsu.com> (raw)
In-Reply-To: <20081106080057.GF8459@elte.hu>

>>  #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.
> 

I don't catch you. :(

In the <128 CPUs case, SCHED_CPUMASK_DECLARE is needed to declare a local
variable(struct allmasks) and a pointer pointing to it. So I don't know
what you mean by 'unused' and how to remove the DECLARE macro..


  reply	other threads:[~2008-11-07  7:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-05  5:50 [PATCH] sched: rewrite SCHED_CPUMASK_ALLOC Li Zefan
2008-11-06  8:00 ` Ingo Molnar
2008-11-07  7:17   ` Li Zefan [this message]
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=4913EB8C.8010003@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.