Project

General

Profile

Actions

Bug #13822

closed

bhyve memory should exert memory pressure

Added by Patrick Mooney 5 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Category:
bhyve
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:

Description

When bhyve allocates memory for a guest (for the guest RAM, specifically) today, it does so in a KM_NOSLEEP manner. This is to avoid the allocation entering an uninterruptable (by signals) sleep, but also results in the allocation bypassing logic which informs the rest of the system about the memory pressure exerted by the allocation. In order to make timely and reliable allocations, those page reservation mechanisms should be updated to allow requests which can apply that memory pressure (implying KM_SLEEP), but are also fallible and interruptable via signal, so that bhyve may be updated to use them.

Actions #1

Updated by Electric Monk 5 months ago

  • Gerrit CR set to 1522
Actions #2

Updated by Patrick Mooney 3 months ago

The canonical example for bhyve applying memory pressure is its ability to shrink the ARC. In order to test this, I booted up a machine with the proposed fix and then incurred disk activity (sequential data reads) until the ARC grew to an appreciable size (12GB out of the 64GB physmem). I then grew the size of the vmm memory reservoir (from #13833), observing it soaking up the remaining freemem on the system. Once freemem ran low, the dtrace probes I had attached to arc_reap_cb began to fire, indicating that an arc reap (and subsequent shrink) was occurring. As I continued to grow the reservoir, making more memory available for bhyve's use, the ARC continued shrinking. This proceeded until the ARC was roughly 6GB in size, and it would not shrink any further. At that point, attempts to put more memory in the reservoir were unsuccessful and the system started to become unresponsive. The pending allocation was cancelled and the system was well again.

Actions #3

Updated by Electric Monk 3 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit b57f5d3e6a2df8d435e606797cf3934811848343

commit  b57f5d3e6a2df8d435e606797cf3934811848343
Author: Patrick Mooney <pmooney@pfmooney.com>
Date:   2021-07-27T19:26:22.000Z

    13833 want bhyve memory reservoir
    13822 bhyve memory should exert memory pressure
    13834 want extensible page_resv
    13821 vmmctl ioctls should have more structure
    Reviewed by: Andy Fiddaman <andy@omnios.org>
    Reviewed by: Jason King <jason.brian.king@gmail.com>
    Reviewed by: Dan Cross <cross@oxidecomputer.com>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Reviewed by: Mike Zeller <mike.zeller@joyent.com>
    Approved by: Dan McDonald <danmcd@joyent.com>

Actions

Also available in: Atom PDF