All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] [RFC] KVM: Guest page hinting
@ 2017-08-01 20:48 Nitesh Narayan Lal
  2017-08-01 20:48 ` [PATCH 1/3] KVM: Support for guest " Nitesh Narayan Lal
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Nitesh Narayan Lal @ 2017-08-01 20:48 UTC (permalink / raw)
  To: kvm; +Cc: riel, mst, david, yang.zhang.wz, pagupta, wei.w.wang

The following patch-set proposes an efficient mechanism for handing freed memory between the guest and the host. This approach has some different trade-offs compared to ballooning:
-For guests with DAX (no page cache) it rapidly hands back all free memory to the host.
-Resolves the complexity of ballooning policy as the whole process is transparent and occurs automatically.
-More frequent hypercalls than ballooning. More efficient memory use at the cost of higher CPU use.
-Guest can quickly re-use memory if it is needed again, with MADV_FREE use on the host side.

This patch set is divided into three parts and this is just the first part which contains the implementation used for preparing the list of guest free pages which will be sent to the host via hypercall.
The patch-set leverages the existing arch_free_page() and arch_alloc_page() to add this functionality. It uses two lists one cpu-local and other cpu-global.  Whenever a page is freed it is added to the respective cpu-local list until it is full. Once the list is full a seqlock is taken to prevent any further page allocations and the per cpu-local list is traversed in order to check for any fragmentation due to reallocations. If present those entries are defragmented and are added to the cpu-global list until it is full. Once the cpu-global list is full it is parsed and compressed. 
A hypercall is made only if the total number of entries are above the specified threshold value. A hypercall may affect the performance if done frequently and hence it needs to be minimized. This is the primary reason for compression, as it ensures replacement of multiple consecutive entries to a single one and removal of all duplicate entries causing frequent exhaustion of cpu-global list. After compressing the hyperlist there could be three following possibilities:
*If the number of entries in this cpu-global list is greater than the threshold required for hypercall value then a hypercall is issued.
*If the parsing of the cpu-local list is complete but the number of cpu-global list entries is less than the threshold then they are copied to a cpu-local list.
*In case the parsing of the cpu-local list is yet not complete and the number of entries in the cpu-global list is less than the threshold then the parsing of the cpu-local list is continued and entries in the cpu-global list are added from the newly available index acquired after compression.

-
Regards
Nitesh 

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-08-04 11:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-01 20:48 [PATCH 0/3] [RFC] KVM: Guest page hinting Nitesh Narayan Lal
2017-08-01 20:48 ` [PATCH 1/3] KVM: Support for guest " Nitesh Narayan Lal
2017-08-02  7:12   ` kbuild test robot
2017-08-01 20:48 ` [PATCH 2/3] KVM: Guest page hinting functionality Nitesh Narayan Lal
2017-08-02  7:01   ` Pankaj Gupta
2017-08-02 18:59     ` Nitesh Narayan Lal
2017-08-02 19:20       ` Rik van Riel
2017-08-02 20:37         ` Nitesh Narayan Lal
2017-08-02 12:19   ` Pankaj Gupta
2017-08-02 15:02     ` Rik van Riel
2017-08-01 20:48 ` [PATCH 3/3] KVM: Adding tracepoints for guest page hinting Nitesh Narayan Lal
2017-08-04  5:16 ` [PATCH 0/3] [RFC] KVM: Guest " Yang Zhang
2017-08-04 11:59   ` 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.