On 5/6/21 8:54 AM, Philippe Mathieu-Daudé wrote:
static void notify_guest_bh(void *opaque)
{
VirtIOBlockDataPlane *s = opaque;
- unsigned nvqs = s->conf->num_queues;
- unsigned long bitmap[BITS_TO_LONGS(nvqs)];
- unsigned j;
- memcpy(bitmap, s->batch_notify_vqs, sizeof(bitmap));
- memset(s->batch_notify_vqs, 0, sizeof(bitmap));
-
- for (j = 0; j < nvqs; j += BITS_PER_LONG) {
- unsigned long bits = bitmap[j / BITS_PER_LONG];
-
- while (bits != 0) {
- unsigned i = j + ctzl(bits);
+ for (unsigned i = 0; i < s->conf->num_queues; i++) {
Is this bitmap dense enough that you want to iterate by index, or is it sparse
enough to iterate via find_first_bit/find_next_bit?
In either case, leave the copy of s->conf->num_queues to a local variable.
r~