David Miller wrote: >>> Otherwise you have to modify cpumask_t objects and thus pluck >>> them onto the stack where they take up silly amounts of space. >> Yes, I had proposed either modifying, or supplementing a new >> smp_call function to pass the cpumask_t as a pointer (similar >> to set_cpus_allowed_ptr.) But an ABI change such as this was >> not well received at the time. > > What it seems to come down to is that any cpumask_t not inside of > a dynamically allocated object should be marked const. > > And that is something we can enforce at compile time. > > Linus has just suggested dynamically allocating cpumask_t's > for such cases but I don't see that as the fix either. > > Just mark them const and enforce that cpumask_t objects can only > be modified when they appear in dynamically allocated objects. Dave and others, Sorry if I jump into the middle of the thread. Stopped subscribing to lkml for a while, so this is through the archives. Ran into some of these issues with KVM too, and noticed just how much we pass cpumask_t around in the smp_call functions :-( In fact, the only arch that did pretty well on this front was sparc64. I totally agree, that marking them const makes a ton of sense, but at the same time I suggest we convert smp_call_function_mask() to take a pointer to the cpumask_t. I whipped up the following patch, which cuts down the amont of memcpy calls emitted quite a fair bit. I have only tested this on ia64, but it boots, so it's obviously perfect :-) Comments, suggestions welcome. I have a followup patch that makes virt/kvm/kvm_main.c use the new interface. Cheers, Jes