On 04/23/2013 12:13 AM, Rusty Russell wrote:
> Sasha Levin <sasha.le...@oracle.com> 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);

That makes more sense, I'll resend.

> We don't free up buffers when we're reducing queues, but I consider that
> a corner case.

It didn't bother anyone up until now, and the spec doesn't state anything
about it - so I preferred to just leave that alone. Unless the ARM folks
would find it useful?


Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to