lkml.org 
[lkml]   [2008]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Bug #11342] Linux 2.6.27-rc3: kernel BUG at mm/vmalloc.c - bisected

* Rusty Russell <rusty@rustcorp.com.au> wrote:

> I can't see a neater way down this path, and I don't want to lose
> const.
>
> I can see three alternatives:
> 1) An ONSTACK_CPUMASK(name) macro which declares "struct cpumask name[1]" or
> "struct cpumask *name". Same idea as yours, without the typedef.
> 2) Use a normal struct for cpumask, make everyone use pointers, but have an
> struct cpumask *alloc_stack_cpumask() which uses alloca() for small
> NR_CPUS.
> 3) Same, but just use kmalloc everywhere. Optimize important cases by hand.
>
> Anyone see a better way?

since most of the important cpumasks in high-perf codepaths are already
pre-constructed and embedded in some existing object (say task_struct),
i think a variant of #3 is the best approach:

- get rid of cpumask_t and use 'struct cpumask' everywhere.

- do not expose normal kernel code to struct cpumask's definition, only
declare the type via 'struct cpumask;' in sched.h - a'la
kmem_cache_t.

- even hide the structure from sched.h - use an extra indirection for
struct cpumask *cpus_allowed in task_struct and be done with it.

- have normal cpumask object alloc/free codepaths.

- optimize any remaining important cases by hand, if needed. (the
scheduler mostly)

(wrt. #2, alloca() is a nightmare i think.)

Ingo


\
 
 \ /
  Last update: 2008-09-25 10:59    [W:0.558 / U:0.536 seconds]
©2003-2014 Jasper Spaans. Advertise on this site