Re: [Patch v2 3/3] net: Restrict receive packets queuing to housekeeping CPUs

From: Peter Zijlstra
Date: Tue Jun 23 2020 - 05:23:56 EST


On Mon, Jun 22, 2020 at 07:45:10PM -0400, Nitesh Narayan Lal wrote:
> @@ -756,6 +757,13 @@ static ssize_t store_rps_map(struct netdev_rx_queue *queue,
> return err;
> }
>
> + hk_flags = HK_FLAG_DOMAIN | HK_FLAG_WQ;
> + cpumask_and(mask, mask, housekeeping_cpumask(hk_flags));
> + if (cpumask_weight(mask) == 0) {

We have cpumask_empty() for that, which is a much more efficient way of
testing the same.

> + free_cpumask_var(mask);
> + return -EINVAL;
> + }
> +
> map = kzalloc(max_t(unsigned int,
> RPS_MAP_SIZE(cpumask_weight(mask)), L1_CACHE_BYTES),
> GFP_KERNEL);
> --
> 2.18.4
>