Sasha Levin <[email protected]> writes:
> Due to MQ support we may allocate a whole bunch of rx queues but
> never use them. With this patch we'll safe the space used by
> the receive buffers until they are actually in use:
Idea is good, implementation needs a tiny tweak:
> @@ -912,8 +913,13 @@ static int virtnet_set_queues(struct virtnet_info *vi,
> u16 queue_pairs)
> dev_warn(&dev->dev, "Fail to set num of queue pairs to %d\n",
> queue_pairs);
> return -EINVAL;
> - } else
> + } else {
> + if (queue_pairs > vi->curr_queue_pairs)
> + for (i = 0; i < queue_pairs; i++)
> + if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
> + schedule_delayed_work(&vi->refill, 0);
> vi->curr_queue_pairs = queue_pairs;
> + }
>
> return 0;
> }
You don't want to refill existing queues, so you don't need the "if".
for (i = vi->curr_queue_pairs; i < queue_pairs; i++) {
if (!try_fill_recv(&vi->rq[i], GFP_KERNEL))
schedule_delayed_work(&vi->refill, 0);
We don't free up buffers when we're reducing queues, but I consider that
a corner case.
Thanks,
Rusty.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html