File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2967,7 +2967,7 @@ static bool blk_mq_hctx_has_requests(struct blk_mq_hw_ctx *hctx)
29672967static inline bool blk_mq_last_cpu_in_hctx (unsigned int cpu ,
29682968 struct blk_mq_hw_ctx * hctx )
29692969{
2970- if (cpumask_next_and ( -1 , hctx -> cpumask , cpu_online_mask ) != cpu )
2970+ if (cpumask_first_and ( hctx -> cpumask , cpu_online_mask ) != cpu )
29712971 return false;
29722972 if (cpumask_next_and (cpu , hctx -> cpumask , cpu_online_mask ) < nr_cpu_ids )
29732973 return false;
Original file line number Diff line number Diff line change @@ -2101,7 +2101,7 @@ static void virtnet_set_affinity(struct virtnet_info *vi)
21012101 stragglers = num_cpu >= vi -> curr_queue_pairs ?
21022102 num_cpu % vi -> curr_queue_pairs :
21032103 0 ;
2104- cpu = cpumask_next ( -1 , cpu_online_mask );
2104+ cpu = cpumask_first ( cpu_online_mask );
21052105
21062106 for (i = 0 ; i < vi -> curr_queue_pairs ; i ++ ) {
21072107 group_size = stride + (i < stragglers ? 1 : 0 );
Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ static int bman_portal_probe(struct platform_device *pdev)
155155 }
156156
157157 spin_lock (& bman_lock );
158- cpu = cpumask_next_zero ( -1 , & portal_cpus );
158+ cpu = cpumask_first_zero ( & portal_cpus );
159159 if (cpu >= nr_cpu_ids ) {
160160 __bman_portals_probed = 1 ;
161161 /* unassigned portal, skip init */
Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ static int qman_portal_probe(struct platform_device *pdev)
248248 pcfg -> pools = qm_get_pools_sdqcr ();
249249
250250 spin_lock (& qman_lock );
251- cpu = cpumask_next_zero ( -1 , & portal_cpus );
251+ cpu = cpumask_first_zero ( & portal_cpus );
252252 if (cpu >= nr_cpu_ids ) {
253253 __qman_portals_probed = 1 ;
254254 /* unassigned portal, skip init */
Original file line number Diff line number Diff line change @@ -123,6 +123,11 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
123123 return 0 ;
124124}
125125
126+ static inline unsigned int cpumask_first_zero (const struct cpumask * srcp )
127+ {
128+ return 0 ;
129+ }
130+
126131static inline unsigned int cpumask_first_and (const struct cpumask * srcp1 ,
127132 const struct cpumask * srcp2 )
128133{
@@ -201,6 +206,17 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp)
201206 return find_first_bit (cpumask_bits (srcp ), nr_cpumask_bits );
202207}
203208
209+ /**
210+ * cpumask_first_zero - get the first unset cpu in a cpumask
211+ * @srcp: the cpumask pointer
212+ *
213+ * Returns >= nr_cpu_ids if all cpus are set.
214+ */
215+ static inline unsigned int cpumask_first_zero (const struct cpumask * srcp )
216+ {
217+ return find_first_zero_bit (cpumask_bits (srcp ), nr_cpumask_bits );
218+ }
219+
204220/**
205221 * cpumask_first_and - return the first cpu from *srcp1 & *srcp2
206222 * @src1p: the first input
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ static void clocksource_verify_choose_cpus(void)
257257 return ;
258258
259259 /* Make sure to select at least one CPU other than the current CPU. */
260- cpu = cpumask_next ( -1 , cpu_online_mask );
260+ cpu = cpumask_first ( cpu_online_mask );
261261 if (cpu == smp_processor_id ())
262262 cpu = cpumask_next (cpu , cpu_online_mask );
263263 if (WARN_ON_ONCE (cpu >= nr_cpu_ids ))
@@ -279,7 +279,7 @@ static void clocksource_verify_choose_cpus(void)
279279 cpu = prandom_u32 () % nr_cpu_ids ;
280280 cpu = cpumask_next (cpu - 1 , cpu_online_mask );
281281 if (cpu >= nr_cpu_ids )
282- cpu = cpumask_next ( -1 , cpu_online_mask );
282+ cpu = cpumask_first ( cpu_online_mask );
283283 if (!WARN_ON_ONCE (cpu >= nr_cpu_ids ))
284284 cpumask_set_cpu (cpu , & cpus_chosen );
285285 }
You can’t perform that action at this time.
0 commit comments