xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/8] Memory scrubbing from idle loop
@ 2017-02-27  0:22 Boris Ostrovsky
  2017-02-27  0:22 ` [PATCH RFC 1/8] mm: Separate free page chunk merging into its own routine Boris Ostrovsky
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Boris Ostrovsky @ 2017-02-27  0:22 UTC (permalink / raw)
  To: xen-devel
  Cc: sstabellini, wei.liu2, George.Dunlap, andrew.cooper3, ian.jackson,
	jbeulich, tim, Boris Ostrovsky

When a domain is destroyed the hypervisor must scrub domain's pages before
giving them to another guest in order to prevent leaking the deceased
guest's data. Currently this is done during guest's destruction, possibly
causing very lengthy cleanup process.

This series adds support for scrubbing released pages from idle loop,
making guest destruction significantly faster. For example, destroying a
1TB guest can now be completed in slightly over 1 minute as opposed to
about 9 minutes using existing scrubbing algorithm.

The downside of this series is that we sometimes fail to allocate high-order
sets of pages since dirty pages may not yet be merged into higher-order sets
while they are waiting to be scrubbed.

Briefly, the new algorithm places dirty pages at the end of heap's page list
for each node/zone/order to avoid having to scan full list while searching
for dirty pages. One processor form each node checks whether the node has any
dirty pages and, if such pages are found, scrubs them. Scrubbing itself
happens without holding heap lock so other users may access heap in the
meantime. If while idle loop is scrubbing a particular chunk of pages this
chunk is requested by the heap allocator, scrubbing is immediately stopped.

On the allocation side, alloc_heap_pages() first tries to satisfy allocation
request using only clean pages. If this is not possible, the search is
repeated and dirty pages are scrubbed by the allocator.

This series needs to be fixed up for ARM and may have a few optimizations
added (and possibly some cleanup). I also need to decide what to do about
nodes without processors.

I originally intended to add per-node heap locks and AVX-based scrubbing but
decided that this should be done separately.

This series is somewhat based on earlier work by Bob Liu.

Boris Ostrovsky (8):
  mm: Separate free page chunk merging into its own routine
  mm: Place unscrubbed pages at the end of pagelist
  mm: Scrub pages in alloc_heap_pages() if needed
  mm: Scrub memory from idle loop
  mm: Do not discard already-scrubbed pages softirqs are pending
  spinlock: Introduce _spin_lock_cond()
  mm: Keep pages available for allocation while scrubbing
  mm: Print number of unscrubbed pages in 'H' debug handler

 xen/arch/x86/domain.c      |    3 +-
 xen/common/page_alloc.c    |  373 ++++++++++++++++++++++++++++++++++++--------
 xen/common/spinlock.c      |   25 +++
 xen/include/asm-x86/mm.h   |    8 +
 xen/include/xen/mm.h       |    1 +
 xen/include/xen/spinlock.h |    3 +
 6 files changed, 344 insertions(+), 69 deletions(-)


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2017-02-27  0:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-27  0:22 [PATCH RFC 0/8] Memory scrubbing from idle loop Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 1/8] mm: Separate free page chunk merging into its own routine Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 2/8] mm: Place unscrubbed pages at the end of pagelist Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 3/8] mm: Scrub pages in alloc_heap_pages() if needed Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 4/8] mm: Scrub memory from idle loop Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 5/8] mm: Do not discard already-scrubbed pages softirqs are pending Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 6/8] spinlock: Introduce _spin_lock_cond() Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 7/8] mm: Keep pages available for allocation while scrubbing Boris Ostrovsky
2017-02-27  0:22 ` [PATCH RFC 8/8] mm: Print number of unscrubbed pages in 'H' debug handler Boris Ostrovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).