All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] cpumask: Replace/optimize cpumask_of_cpu & cpumask_t operations
@ 2008-07-15 21:14 Mike Travis
  2008-07-15 21:14 ` [PATCH 1/8] cpumask: Replace cpumask_of_cpu with cpumask_of_cpu_ptr Mike Travis
                   ` (8 more replies)
  0 siblings, 9 replies; 26+ messages in thread
From: Mike Travis @ 2008-07-15 21:14 UTC (permalink / raw)
  To: Rusty Russell, Ingo Molnar, Andrew Morton
  Cc: H. Peter Anvin, Christoph Lameter, Jack Steiner, linux-kernel


> From Rusty Russell <rusty@rustcorp.com.au>:
>  
>    Hi Christoph/Mike,
>    
>      Looked at cpumask_of_cpu as introduced in 
>    9f0e8d0400d925c3acd5f4e01dbeb736e4011882 (x86: convert cpumask_of_cpu
>    macro to allocated array), and I don't think it's safe:
>    
>      #define cpumask_of_cpu(cpu)					\
>      (*({								\
>    	typeof(_unused_cpumask_arg_) m;					\
>    	if (sizeof(m) == sizeof(unsigned long)) {			\
>    		m.bits[0] = 1UL<<(cpu);					\
>    	} else {							\
>    		cpus_clear(m);						\
>    		cpu_set((cpu), m);					\
>    	}								\
>    	&m;								\
>      }))
>    
>    Referring to &m once out of scope is invalid, and I can't find any
>    evidence that it's legal here.  In particular, the change 
>    b53e921ba1cff8453dc9a87a84052fa12d5b30bd (generic: reduce stack pressure
>    in sched_affinity) which passes &m to other functions seems highly risky.

  * Patch 1 replaces the dangerous lvalue version of cpumask_of_cpu
    with new cpumask_of_cpu_ptr macros.  These are patterned after the
    node_to_cpumask_ptr macros.

  * Patches 2..6 optimizes various places where a pointer to the cpumask_of_cpu
    value will result in reducing stack pressure.

  * Patch 7 provides a generic set of CPUMASK_ALLOC macros patterned after
    the SCHED_CPUMASK_ALLOC macros.  This is used where multiple cpumask_t
    variables are declared on the stack to reduce the amount of stack space
    required.

  * Patch 8 uses the CPUMASK_ALLOC macros in the centrino_target() function.

Based on linux-2.6.tip/master at the following commit:

    commit 0a91813e16ebd5c2d9b5c2acd5b7c91742112c4f
    Merge: 9a635fa... 724dce0...
    Author: Ingo Molnar <mingo@elte.hu>
    Date:   Tue Jul 15 14:55:17 2008 +0200


Signed-off-by: Mike Travis <travis@sgi.com>
Cc: Tigran Aivazian <tigran@aivazian.fsnet.co.uk>
Cc: Greg Banks <gnb@sgi.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Adrian Bunk <bunk@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Paul Jackson <pj@sgi.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Dean Nelson <dcn@sgi.com>
Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Robert Richter <robert.richter@amd.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
---

-- 

^ permalink raw reply	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2008-07-24  3:45 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-15 21:14 [PATCH 0/8] cpumask: Replace/optimize cpumask_of_cpu & cpumask_t operations Mike Travis
2008-07-15 21:14 ` [PATCH 1/8] cpumask: Replace cpumask_of_cpu with cpumask_of_cpu_ptr Mike Travis
2008-07-18  5:30   ` Rusty Russell
2008-07-18 13:43     ` Mike Travis
2008-07-20 10:03       ` Rusty Russell
2008-07-23 11:20         ` Ingo Molnar
2008-07-23 11:23           ` Ingo Molnar
2008-07-23 14:26             ` Mike Travis
2008-07-24  0:46               ` Rusty Russell
2008-07-23 14:16           ` Mike Travis
2008-07-23 17:45         ` Mike Travis
2008-07-15 21:14 ` [PATCH 2/8] cpumask: Optimize cpumask_of_cpu in arch/x86/kernel/io_apic_64.c Mike Travis
2008-07-15 21:14 ` [PATCH 3/8] cpumask: Optimize cpumask_of_cpu in arch/x86/kernel/ldt.c Mike Travis
2008-07-15 21:14 ` [PATCH 4/8] cpumask: Optimize cpumask_of_cpu in drivers/misc/sgi-xp/xpc_main.c Mike Travis
2008-07-16 11:17   ` Dean Nelson
2008-07-15 21:14 ` [PATCH 5/8] cpumask: Optimize cpumask_of_cpu in kernel/time/tick-common.c Mike Travis
2008-07-15 21:14 ` [PATCH 6/8] cpumask: Optimize cpumask_of_cpu in lib/smp_processor_id.c Mike Travis
2008-07-18 20:33   ` Ingo Molnar
2008-07-18 20:35     ` Ingo Molnar
2008-07-18 22:36       ` Mike Travis
2008-07-15 21:14 ` [PATCH 7/8] cpumask: Provide a generic set of CPUMASK_ALLOC macros Mike Travis
2008-07-16  6:41   ` Bert Wesarg
2008-07-16 12:25     ` Mike Travis
2008-07-16 13:01       ` Mike Travis
2008-07-15 21:14 ` [PATCH 8/8] cpumask: Use optimized CPUMASK_ALLOC macros in the centrino_target Mike Travis
2008-07-18 20:04 ` [PATCH 0/8] cpumask: Replace/optimize cpumask_of_cpu & cpumask_t operations Ingo Molnar

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.