lkml.org 
[lkml]   [2008]   [Nov]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched: rewrite SCHED_CPUMASK_ALLOC

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

Sorry, you are right - keep the SCHED_CPUMASK_DECLARE() macro please.

But the other macros can become an inline function just fine, correct?

Ingo


\
 
 \ /
  Last update: 2008-11-07 09:19    [W:0.048 / U:1.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site