Re: [PATCH 2/4] KVM: Avoid checking huge page mappings inget_dirty_log()

From: Takuya Yoshikawa
Date: Thu Mar 01 2012 - 21:50:04 EST


Takuya Yoshikawa <yoshikawa.takuya@xxxxxxxxxxxxx> wrote:

> + while (mask) {
> + rmapp = &slot->rmap[gfn_offset + __ffs(mask)];
> + __rmap_write_protect(kvm, rmapp, PT_PAGE_TABLE_LEVEL);
>
> - return write_protected;
> + /* clear the first set bit */
> + mask &= mask - 1;
> + }
> }

while (mask) {
fsbit = __ffs(mask);
gfn_offset += fsbit;
mask >>= fsbit + 1;

rmapp = &slot->rmap[gfn_offset];
__rmap_write_protect(kvm, rmapp, PT_PAGE_TABLE_LEVEL);
}

Seems to be better: BSF friendly.

I will update this function and post the result with dirty-log-perf output!

Takuya
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/