• Mike Travis's avatar
    x86: Add performance variants of cpumask operators · 41df0d61
    Mike Travis authored
      * Increase performance for systems with large count NR_CPUS by limiting
        the range of the cpumask operators that loop over the bits in a cpumask_t
        variable.  This removes a large amount of wasted cpu cycles.
    
      * Add performance variants of the cpumask operators:
    
        int cpus_weight_nr(mask)	     Same using nr_cpu_ids instead of NR_CPUS
        int first_cpu_nr(mask)	     Number lowest set bit, or nr_cpu_ids
        int next_cpu_nr(cpu, mask)	     Next cpu past 'cpu', or nr_cpu_ids
        for_each_cpu_mask_nr(cpu, mask)  for-loop cpu over mask using nr_cpu_ids
    
      * Modify following to use performance variants:
    
        #define num_online_cpus()	cpus_weight_nr(cpu_online_map)
        #define num_possible_cpus()	cpus_weight_nr(cpu_possible_map)
        #define num_present_cpus()	cpus_weight_nr(cpu_present_map)
    
        #define for_each_possible_cpu(cpu) for_each_cpu_mask_nr((cpu), ...)
        #define for_each_online_cpu(cpu)   for_each_cpu_mask_nr((cpu), ...)
        #define for_e...
    41df0d61
cpumask.c 752 Bytes