Re: [PATCH v4 3/3] KVM: x86/mmu: Add detailed page size stats
From: Mingwei Zhang
Date: Thu Aug 12 2021 - 13:44:43 EST
Hi Peter,
On Wed, Aug 11, 2021 at 6:12 AM Peter Xu <peterx@xxxxxxxxxx> wrote:
>
> On Tue, Aug 10, 2021 at 06:06:51PM -0700, Mingwei Zhang wrote:
> > Regarding the pursuit for accuracy, I think there might be several
> > reasons. One of the most critical reasons that I know is that we need
> > to ensure dirty logging works correctly, i.e., when dirty logging is
> > enabled, all huge pages (both 2MB and 1GB) _are_ gone. Hope that
> > clarifies a little bit?
>
> It's just for statistics, right? I mean dirty log should be working even
> without this change.
That's true. What I meant was that the accurate stats might be able to
help verifying a property of dirty logging as a side benefit. Sorry
for the confusion.
>
> But I didn't read closely last night, so we want to have "how many huge pages
> we're mapping", not "how many we've mapped in the history". Yes that makes
> sense to be accurate. I should have looked more carefully, sorry.
>
> PS: it turns out atomic is not that expensive as I thought even on a 200 core
> system, which takes 7ns (but for sure it's still expensive than normal memory
> ops, and bus locking); I thought it'll be bigger as on a 40 core system I got
> 15ns which is 2x of my laptop of 8 cores, but it didn't really grow but shrink.
Thanks for the information about atomic access!
>
> Thanks,
>
> --
> Peter Xu
>