On Fri, Sep 10, 2021 at 09:11:09AM +0000, Wang, Wei W wrote: > On Friday, September 10, 2021 4:48 PM, Ashish Kalra wrote: > > On Fri, Sep 10, 2021 at 07:54:10AM +0000, Wang, Wei W wrote: > > There has been a long discussion on this implementation on KVM mailing list. > > Tracking shared memory via a list of ranges instead of using bitmap is more > > optimal. Most of the guest memory will be private and the unencrypted/shared > > regions are basically ranges/intervals, so easy to implement and maintain > > using > > lists. > > OK. At which version did you discuss this or do you have a link? (I didn't > find it in v9 KVM patches) >
You can follow this email thread: https://lore.kernel.org/kvm/20201211225542.GA30409@ashkalra_ubuntu_server/ > > A list will consume much less memory than a bitmap. > > > > The bitmap will consume more memory as it will need to be sized as per guest > > RAM size and will remain sparsely populated due to limited amount of > > shared/unencrypted guest memory regions. > > I also thought about this. It depends on the guest. > I think "A list will consume much less memory" is true when we assume most of > guest pages are private pages. > From design perspective, what if guest chooses to have most of its pages > being shared? > Lists might consume much more memory than bitmaps in some cases, I think. > (Probably I can check your previous discussions first) > This will probably depend on the most common use case and scenario, i think that most common use case will be a mostly encrypted guest. Thanks, Ashish