All of lore.kernel.org
 help / color / mirror / Atom feed
* KVM: Questions regarding page_track and memory slots
@ 2018-04-04  8:10 David Hildenbrand
  0 siblings, 0 replies; only message in thread
From: David Hildenbrand @ 2018-04-04  8:10 UTC (permalink / raw)
  To: KVM
  Cc: Zhenyu Wang, Zhi Wang, David Airlie, intel-gvt-dev, linux-kernel,
	Paolo Bonzini, Radim Krčmář

Hi,

I can see that we allocate under x86 for each KVM memslot
"sizeof(unsigned short) * npages" for page_track.

So 1 byte for each 4096 bytes of memory slot size. This doesn't sound a
lot, but if we have very big memory slots (e.g. for NVDIMM), this can
quickly get out of hand. E.g. for 4TB, we would need 1GB. And this just
means somebody created a big memory slot, not even memory would have to
be populated in that slot.

I can see that the only user is right now kvmgt. My assumption is, that
only a fraction of all memory will be tracked.


1. Do we actually need to track on a per-page level, how many trackers
we have? Is it a valid use case that multiple users track the same page?
(e.g. can't we simply use a bitmap)

2. Is my assumption, that this is actually a sparse "bitmap" true?
Wouldn't something like a radix tree, that grows with the number of
tracked pages, be a better fit?


I am looking right now into creating big memory slots and only assigning
a portion at a time to the guest. So initially, most parts of the big
memory slot would not be accessible by the guest and would not have
backing pages. Of course, I want to minimize the involved size of the
memory slot. An alternative is growing a memory slot atomically. Of
course, the current state of page-track is also a problem for growing a
memory slot atomically (having to copy/grow the array).

Thanks or any insight.

-- 

Thanks,

David / dhildenb

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-04  8:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-04  8:10 KVM: Questions regarding page_track and memory slots David Hildenbrand

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.