# Patent

## Title
High availability for persistent memory

## Abstract

Techniques for implementing high availability for persistent memory are provided. In one embodiment, a first computer system can detect an alternating current (AC) power loss/cycle event and, in response to the event, can save data in a persistent memory of the first computer system to a memory or storage device that is remote from the first computer system and is accessible by a second computer system. The first computer system can then generate a signal for the second computer system subsequently to initiating or completing the save process, thereby allowing the second computer system to restore the saved data from the memory or storage device into its own persistent memory.

## Background
CROSS-REFERENCES TO RELATED APPLICATIONS
The present application is a continuation of U.S. patent application Ser. No. 16/584,857 filed Sep. 26, 2019, now U.S. Pat. No. 11,163,656 issued Nov. 2, 2021, which is a continuation of U.S. patent application Ser. No. 15/586,020 filed May 3, 2017, now U.S. Pat. No. 10,474,550 issued Nov. 12, 2019. These applications are incorporated herein by reference in their entireties for all purposes. In addition, the present application is related to commonly-owned U.S. patent application Ser. No. 15/586,109, now U.S. Pat. No. 10,496,443, entitled “OS/Hypervisor-Based Persistent Memory.” This related application, referred to herein as “D382,” is incorporated by reference in its entirety for all purposes.


BACKGROUND
Unless otherwise indicated, the approaches described in this section are not prior art to the claims of the present application and are not admitted to be prior art by inclusion in this section.
Traditional computer systems include byte-addressable volatile memory (e.g., dynamic random access memory, or DRAM) and block-addressable nonvolatile storage devices such as solid state disks (SSDs) and magnetic disks. A typical program reads data from nonvolatile storage, stores and modifies the data in volatile memory, and then writes the modified data back to nonvolatile storage using block-based commands.
Persistent memory is an emerging technology that offers fast, byte-level access to data in a manner similar to DRAM, but is nonvolatile in nature. Thus, with persistent memory, software applications can access and modify individual bytes of data in-place using regular memory load and store instructions, and at the same time be assured that the data will be preserved and can continue to be accessed after, e.g., an AC (alternating current) power failure or other event that causes the system motherboard to lose or cycle AC power (e.g., a cold or hot reboot).
There are a number of implementations of persistent memory that are based on new physical memory types, such as phase-change memory (PCM) and magnetoresistive RAM. There are also approaches that implement persistent memory using a battery, conventional DRAM, and a conventional nonvolatile storage or memory device. These approaches are collectively referred to herein as “battery-backed persistent memory.” With battery-backed persistent memory, a portion of the computer system's DRAM is allocated and exposed to running applications as persistent memory. This exposed allocation is not “true” persistent memory in the sense that the DRAM itself is still volatile. However, when an AC power loss/cycle event occurs, the contents of the persistent memory allocation in DRAM are saved to the nonvolatile storage device while the computer system continues to run on battery power. Then, when AC power is restored and the system is powered on again, the saved data is read from the nonvolatile storage device and placed back into the persistent memory allocation in DRAM, thereby restoring that data for use by applications.
One type of battery-backed persistent memory, known as “OS/hypervisor-based persistent memory,” relies on the operating system (OS) or hypervisor of the computer system to perform the save and restore operations described above. Additional details regarding the OS/hypervisor-based approach are described in related application D382.
One limitation with persistent memory implementations in general is that they are not explicitly designed to make persistent memory data highly available—in other words, they are not designed to allow the contents of a persistent memory of a first computer system to be restored on, and thus accessible by, a second computer system while the first computer system is in a failed state (e.g., suffering from an AC power failure). As a result, users and applications cannot access that data until the first computer system recovers from the failure and is restarted.
SUMMARY
Techniques for implementing high availability for persistent memory are provided. In one embodiment, a first computer system can detect an alternating current (AC) power loss/cycle event and, in response to the event, can save data in a persistent memory of the first computer system to a memory or storage device that is remote from the first computer system and is accessible by a second computer system. The first computer system can then generate a signal for the second computer system subsequently to initiating or completing the save process, thereby allowing the second computer system to restore the saved data from the memory or storage device into its own persistent memory.
The following detailed description and accompanying drawings provide a better understanding of the nature and advantages of particular embodiments.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 depicts a computer system that implements battery-backed persistent memory according to an embodiment.
FIG. 2 depicts a high-level workflow for implementing HA for persistent memory according to an embodiment.
FIGS. 3A and 3B depict workflows for optimizing the saving of persistent memory data according to an embodiment.
FIG. 4 depicts a workflow for implementing a dirty data limit within the workflow of FIG. 3A according to an embodiment.
FIG. 5 depicts a workflow for optimizing the restoration of persistent memory data according to an embodiment.



DETAILED DESCRIPTION
In the following description, for purposes of explanation, numerous examples and details are set forth in order to provide an understanding of various embodiments. It will be evident, however, to one skilled in the art that certain embodiments can be practiced without some of these details, or can be practiced with modifications or equivalents thereof.
1. Overview
Embodiments of the present disclosure provide techniques that enable computer systems that implement persistent memory (and in particular, battery-backed persistent memory) to also support high availability (HA) of their respective persistent memory allocations. Stated another way, these techniques allow the persistent memory of a first computer system to be restored on a second computer system when the first computer system fails (e.g., loses AC power). This, in turn, enables applications, virtual machines (VMs), and/or other processes on the first computer system that require access to that persistent memory to be resumed on the second computer system.
At a high level, the HA techniques of the present disclosure can involve connecting the first and second computer systems to a storage or memory device that is not local to (i.e., is remote from) the first computer system. One example of such a device is a shared nonvolatile storage device, such as a dual or multi-ported SSD or magnetic disk, an NFS (Network File System) array/server, a SAN (storage area network) array/server, or the like. Another example of such a device is a nonvolatile storage or volatile memory that is resides in the second computer system. When an AC power loss/cycle event occurs on the first computer system, the first computer system can save the data in its persistent memory to the non-local storage/memory device in an optimized manner. The first computer system can also provide a signal to the second computer system indicating that this save process is in progress (or has been completed). In response to this signal the second computer system can restore the saved data from the storage/memory device to its own persistent memory.
These and other aspects of the present disclosure are described in further detail below. It should be noted that, for illustrative purposes, the following sections describe the implementation of HA with respect to battery-backed persistent memory, such as OS/hypervisor-based persistent memory. However, one of ordinary skill in the art will appreciate that the same or substantially similar techniques may also be applied to persistent memory technologies that do not rely on a battery for persistence, such as memristors, phase change memory, Intel's 3D XPoint, and so on. Accordingly, the HA techniques of the present disclosure should be broadly construed as being applicable to all types of persistent memory known in the art.
2. Example Computer System and High-Level HA Workflow
FIG. 1 is a simplified block diagram of a computer system 100 that implements battery-backed persistent memory according to an embodiment. On the hardware side, computer system 100 includes a battery 102 and one or more central processing units (CPUs) 104. CPU(s) 104 are connected, via a memory bus 106, to a byte-addressable volatile memory (i.e., DRAM) 108. CPU(s) 104 are also connected, via one or more peripheral buses 110, to a nonvolatile ROM (e.g., EEPROM or flash-based ROM) 112, a local nonvolatile storage device 114, and a network interface card (NIC) 115). Nonvolatile storage device 114 may be, e.g., an NVM Express (NVMe)-based SSD, a magnetic hard disk, or any other type of storage device known in the art.
On the firmware/software side, computer system 100 includes a system BIOS 116, which may run from nonvolatile ROM 112, and an OS/hypervisor 118, which may run from DRAM 108. Although not shown, computer system 100 can also include one or more applications or VMs that run on top of OS/hypervisor 118.
In a particular embodiment, computer system 100 can implement OS/hypervisor-based persistent memory, which is a type of battery-backed persistent memory that relies on OS/hypervisor 118 to allocate and expose a portion of DRAM 108 as persistent memory to applications. In these embodiments, OS/hypervisor 118 can detect (via, e.g., the receipt of an interrupt from BIOS 116) when an event occurs that causes computer system 100 (or more particularly, the motherboard of computer system 100) to lose AC power on a short or long term basis (e.g., an AC power failure, hot or cold reboot, etc.). In response, OS/hypervisor 118 can save the contents of the persistent memory allocation from DRAM 108 to storage device 114 while computer system 100 operates on power provided by battery 102. Then, when AC power is restored and computer system 100 is restarted, OS/hypervisor 118 can execute a corresponding restore operation that moves the saved data from the storage device 114 back into the allocated portion of DRAM 108 (described in related application D382).
In other embodiments, computer system 100 may implement or make use of other types of persistent memory, which may not necessarily be backed by a battery (e.g., Intel's 3D XPoint, phase change memory, etc.).
As noted in the Background section, although existing battery-backed and non-battery-backed persistent memory implementations work well for ensuring data persistence on a single computer system, they are not specifically designed to support persistent memory high availability (HA) across systems. Thus, if computer system 100 fails due to, e.g., an AC power failure, the persistent memory data of the system cannot be accessed by another computer system, or by computer system 100 itself, until AC power is restored and system 100 is restarted.
To address this deficiency, FIG. 2 depicts a novel HA workflow 200 that may be performed by two computer systems 202 and 204 according to an embodiment. In this example, computer systems 202 and 204 are assumed to implement battery-backed persistent memory (e.g., OS/hypervisor-based persistent memory), but in other embodiments they may implement non-battery-backed persistent memory. As shown, each computer system 202/204, which can be substantially similar to computer system 100 of FIG. 1, is connected (via, e.g., NIC 215) to a memory/storage device 206 that is not local to (i.e., is remote from) computer system 202. In one embodiment, memory/storage device 206 may be a shared storage device, such as a dual or multi-ported SSD or magnetic hard disk, a networked storage device/array (e.g., NFS-based, SAN-based, etc.), or the like. In other embodiments, memory/storage device 206 may be a device that is local to computer system 204 (e.g., a local hard disk/SSD or a local memory device/allocation of system 204). For example, memory/storage device 206 may be a persistent memory device or allocation that is resident on computer system 204.
Starting with step (1) (block 208), computer system 202 can allocate and expose a portion of its nonvolatile memory (e.g., DRAM) to running applications/VMs as persistent memory. In the case where computer system 202 implements OS/hypervisor-based persistent memory, this step can be performed by system 202's OS/hypervisor.
At step (2) (block 210), computer system 202 can detect the occurrence of an event that causes the motherboard of the system to lose or cycle AC power and thus potentially lose the contents of the persistent memory allocation in its DRAM (i.e., an “AC power loss/cycle event”). In response, computer system 202 can save one or more portions of the persistent memory allocation from DRAM to memory/storage device 206 (step (3); block 212). In certain embodiments, as part of this step, computer system 202 may only save portions of the persistent memory allocation that have been modified during system runtime in order to minimize the overall time needed for the save operation (explained in further detail below).
While computer system 202 is executing the save operation (or after it has completed the save operation), system 202 can generate a signal for computer system 204 indicating that the persistent memory allocation is being (or has been) written to memory/storage device 206 (step (4); block 214). In one embodiment, this step can comprise writing a particular marker or flag to a portion of shared storage device 206 that is monitored by computer system 204. In another embodiment, this step can comprise sending a predefined network packet or message to computer system 204.
At steps (5) and (6) (blocks 216 and 218), computer system 204 can receive the signal generated at step 214 and can begin restoring the saved data from shared storage device 206 to a persistent memory allocation within system 204's DRAM. If computer system 202 is still in the progress of saving the persistent memory data to memory/storage device 206 at this step, computer system 204 may proceed with restoring the data that has been saved and restore the remaining data on demand. Finally, at step (7) (block 218), one or more processes (e.g., application or VMs) that previously ran on computer system 202 can be started/resumed on computer system 204 and can access the restored persistent memory data.
With the high-level workflow shown in FIG. 2, HA can be achieved for the persistent memory allocation maintained on computer system 202, such that the persistent memory data in the allocation can be made available on computer system 204 while system 202 remains in a failed state. Further, a similar HA process can be performed in reverse (i.e., from computer system 204 to computer system 202) if a subsequent failure occurs on computer system 204. Additional details for optimizing this high-level workflow are presented in the sections that follow.
3. Optimizing HA
There are a number of challenges and difficulties with respect to implementing HA workflow 200 of FIG. 2 in particular scenarios, such as a scenario where memory/storage device 206 is specifically a shared storage device. First, since shared storage devices typically have a lower sustained write bandwidth than local/dedicated memory or storage devices, the total amount of time needed to execute the save operation at block 212 of workflow 200 can be very high, which is not ideal in a HA failover scenario.
Second, with battery-backed persistent memory, the maximum amount of persistent memory that can be supported is generally a function of (1) battery capacity and (2) the write bandwidth of the nonvolatile backing store. As noted above, shared storage devices typically have lower sustained write bandwidth than local/dedicated devices (due to a number of factors such as network latency, concurrent access by other storage clients, etc.). Thus, if computer system 202 is configured to save persistent memory data to a shared storage device rather than a local storage device (as in workflow 200), the maximum amount of persistent memory that can be supported will be substantially lower for a given battery size/capacity.
Third, even if the persistent memory allocation can be efficiently saved to a shared storage device, there should be a way to restore the saved persistent memory data from disk to the DRAM at destination computer system 204 without requiring a reboot of the system.
To address these and other similar issues, computer systems 202/204 can apply a number of optimizations which are described in turn below.
3.1 Optimizing Save
FIGS. 3A and 3B depict workflows 300 and 350 that may be executed by computer system 202 of FIG. 2 for optimizing the save operation described at block 212 according to an embodiment. These workflows assume that memory/storage device 206 is a shared storage device. With this optimization, OS/hypervisor 118 can track portions of the persistent memory allocation in DRAM that are modified (i.e., dirtied) during system runtime and flush those modified portions to shared storage device 206 on a periodic basis. Then, at the time of an AC power loss/cycle event, the computer system only needs to persist the portions of the persistent memory allocation that have been modified since the last flush operation, leading to significantly less time for completing the save operation (and thus addressing the bandwidth deficiencies of shared storage device 206).
Workflow 300 of FIG. 3A can be executed on a continuous basis while computer system 202 is running (i.e., before the occurrence of an AC power loss/cycle event per block 210 of workflow 200). Starting with block 302, the OS/hypervisor of computer system 202 can first initiate a save timer that is configured to run for a predefined time interval (e.g., 1 minute, 5 minutes, etc.). This time interval may be set automatically by the OS/hypervisor or may be user-configurable.
At block 304, while the save timer is running, the OS/hypervisor can monitor for the occurrence of an event that causes one or more portions of the persistent memory allocation in DRAM to be modified (or suggests that the one or more portions will be modified). Upon detecting such an event, the OS/hypervisor can identify the modified portion(s) and store information regarding these modified portion(s) in a local data structure (block 306).
The specific types of events that the OS/hypervisor can look for at block 304 can differ depending upon the granularity at which the OS/hypervisor is configured to track modifications to the persistent memory allocation. For example, in one set of embodiments, the OS/hypervisor may be configured to track modifications at file granularity. In these embodiments, the OS/hypervisor can monitor for a file open or modification event (by, e.g., communicating with its file system layer) and, upon detecting such an event, can store an identifier of the opened/modified file in the local data structure.
In another set of embodiments, the OS/hypervisor may be configured to track modifications at memory page granularity. In these embodiments, the OS/hypervisor can monitor for a memory page write (by, e.g., examining the dirty page bits in the OS/hypervisor's page tables) and can store an identifier of the dirty memory page in the local data structure.
At block 308, the OS/hypervisor can check whether the save timer has expired. If not, the OS/hypervisor can return to block 304 in order to monitor for further memory modification events.
If the save timer has expired at block 308, the OS/hypervisor can flush (i.e., write) all of the dirty or potentially dirty data in the persistent memory allocation (as identified in the local data structure) to the shared storage device (block 310). The OS/hypervisor can then clear the local data structure (block 312) and return to block 302 in order to re-initialize the save timer and restart the entire process.
Moving on to workflow 350 of FIG. 3B, while the main loop of workflow 300 is running, the BIOS of computer system 202 can detect that an AC power loss/cycle event has occurred (block 352). In response to this, the BIOS can send a signal (e.g., a high-priority interrupt) to the OS/hypervisor (block 354), which can cause the OS/hypervisor to determine a list of the portions (e.g., pages) of the persistent memory allocation that have been modified since the last flush operation (block 358).
Finally, at block 360, the OS/hypervisor (or some other component of the computer system) can save the dirty data identified in the list (rather than the entirety of the persistent memory allocation) to shared storage device 206. Note that the total amount of this dirty data should be relatively small because the OS/hypervisor will have already flushed the dirty data from previous time intervals, and thus the remaining dirty data will only comprise data modified in the most recent time interval.
3.2 Increasing Maximum Size of Persistent Memory
As mentioned previously, with battery-backed persistent memory, the maximum amount of DRAM than can be allocated and exposed as persistent memory is generally a function of (1) battery capacity and (2) the write bandwidth of the nonvolatile backing store. This is because the system needs to ensure that the entirety of the persistent memory allocation can be saved within the window of operational time afforded by the system's battery, and thus the allocation size is limited to X times Y, where X is the amount of data per second that the backing store can write in a sustained manner (i.e., the device's sustained write bandwidth) and Y is the number of seconds the battery can keep the system running.
In order to circumvent this cap on persistent memory size for the purposes of HA, the OS/hypervisor of computer system 202 can build upon workflow 300 of FIG. 3A and limit, via a “dirty data limit,” the amount of persistent memory that is allowed to be modified by applications/VMs before those modified memory portions are flushed to storage per block 310 of workflow 300. For example, assume this dirty data limit is set to 100 gigabytes (GBs). This means that the OS/hypervisor will not allow more than 100 GBs of data in the persistent memory allocation to be dirty at any point in time, even though the total size of the persistent memory allocation may be significantly larger. As a result, the battery of computer system 202 and shared storage device 206 only need to provide enough wattage and write bandwidth respectively to ensure that 100 GB of data can be written to disk at the time of an AC power loss/cycle event. This effectively removes the physical characteristics of the battery and the backing store as limiting factors on the persistent memory size.
FIG. 4 depicts a workflow 400 that can be executed by the OS/hypervisor of computer system 202 for implementing the dirty data limit according to an embodiment. Workflow 400 is similar to workflow 300 and is based on the same general principle of tracking portions of the persistent memory allocation that have been modified and flushing those modified portions to disk on a periodic basis. However, prior to checking whether the save timer has expired, the OS/hypervisor can check whether the dirty data limit has been reached (block 402). If the dirty data limit has not been reached, the OS/hypervisor can move on to checking the expiry of the save timer (block 308).
On the other hand, if the dirty data limit has been reached at block 402, the OS/hypervisor can immediately proceed with flushing all of the dirty data in the persistent memory allocation (block 310). In this way, the OS/hypervisor can ensure that the total amount of dirty data in the allocation does not exceed the limit. As part of this, the OS/hypervisor can slow down or suspend running processes/threads until the flushing is complete in order to avoid any additional memory writes during this period.
In certain embodiments, the value of the dirty data limit can be static. In other embodiments, the OS/hypervisor can dynamically change this value on an as-needed basis. For instance, assume that the typical sustained write bandwidth of shared storage device 206 is 3 GB per second, but the bandwidth fails to 1 GB per second for some reason (e.g., another storage client starts reading from or writing to the storage). In this scenario, the OS/hypervisor of computer system 202 can detect the drop in bandwidth and can dynamically reduce the value of the dirty data limit so that the total amount of dirty data does not exceed what can be written to device 206 using this reduced bandwidth figure (and given the system battery size). Once the write bandwidth returns to the typical 3 GB per second, the OS/hypervisor can increase the dirty data limit back to its original value. In this way, the OS/hypervisor can dynamically account for fluctuations in the write bandwidth of shared storage device 206.
3.3 Optimizing Restore
Once computer system 202 of FIG. 2 has saved its persistent memory data to memory/storage device 206, that saved data needs to be restored in the DRAM of computer system 204 so that it can accessed in a byte-addressable manner (assuming system 204 uses battery-backed persistent memory). However, some battery-backed persistent memory implementations only allow such saved data to be restored at the time of system boot.
To overcome this, in certain embodiments the BIOS/hypervisor of computer system 204 can perform the task of restoring persistent memory data from memory/storage device 206 to the system's DRAM. This offers a number of advantages; first, since the OS/hypervisor can dynamically begin the restore process at any point during system runtime, there is no need to manually boot or reboot computer system 204 in order to initiate the restore. For instance, the OS/hypervisor of computer system 204 can actively monitor for the signal generated by computer system 202 at block 214 of workflow 200 and, in response to receiving the signal, can immediately begin the process of reading the saved persistent memory data from memory/storage device 206.
Second, since the OS/hypervisor has inherent knowledge and control over how system memory is allocated and used by applications, it can carry out the restore process in an intelligent manner. For example, consider a scenario where the amount of persistent memory data saved to memory/storage device 206 by computer system 202 is 10 GB, but computer system 204 only has 4 GB of free memory in its persistent memory allocation. In this case, the OS/hypervisor of computer system 204 can dynamically change the size of the persistent memory allocation (as, e.g., a percentage of total physical DRAM) in order to accommodate the 10 GB of saved data. This can involve dynamically converting an appropriate amount of the DRAM of computer system 204 (e.g., 4 GB) to persistent memory. Alternatively, the OS/hypervisor can communicate with one or more other computer systems in order to determine their respective free persistent memory allocations and offload the restore process to a particular system that has a sufficient amount of free persistent memory.
As another example, rather than restoring all of the saved data from memory/storage device 206 at block 218 of workflow 200, the OS/hypervisor of computer system 204 can retrieve this data in a “lazy” manner while the system is running (i.e., on demand, in response to a particular memory access request).
FIG. 5 depicts a workflow 500 illustrating this optimized restore process according to an embodiment. At block 502, the OS/hypervisor of computer system 204 can receive the signal generated at step 214 of workflow 200 indicating that computer system 202 is saving (or has saved) its persistent memory data to memory/storage device 206. However, rather than restoring the saved data from device 206 to DRAM at this point, the data can be kept on disk. The OS/hypervisor can then start/resume one or more applications or VMs that previously ran on computer system 202 (block 504).
At block 506, an application or VM can issue a memory access request for a particular portion of memory (e.g., one or more memory pages) that is in the saved persistent memory data. In response, the OS/hypervisor can intercept the memory access request (block 508), identify the requested portion(s) (block 510), and restore (i.e., fault) those specific portion(s) from memory/storage device 206 into the DRAM of computer system 204 (block 512). The OS/hypervisor can then continue with servicing the request (block 514), and this process can repeat until all of the persistent memory data is restored in DRAM.
Certain embodiments described herein can employ various computer-implemented operations involving data stored in computer systems. For example, these operations can require physical manipulation of physical quantities—usually, though not necessarily, these quantities take the form of electrical or magnetic signals, where they (or representations of them) are capable of being stored, transferred, combined, compared, or otherwise manipulated. Such manipulations are often referred to in terms such as producing, identifying, determining, comparing, etc. Any operations described herein that form part of one or more embodiments can be useful machine operations.
Further, one or more embodiments can relate to a device or an apparatus for performing the foregoing operations. The apparatus can be specially constructed for specific required purposes, or it can be a general purpose computer system selectively activated or configured by program code stored in the computer system. In particular, various general purpose machines may be used with computer programs written in accordance with the teachings herein, or it may be more convenient to construct a more specialized apparatus to perform the required operations. The various embodiments described herein can be practiced with other computer system configurations including handheld devices, microprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, mainframe computers, and the like.
Yet further, one or more embodiments can be implemented as one or more computer programs or as one or more computer program modules embodied in one or more non-transitory computer readable storage media. The term non-transitory computer readable storage medium refers to any data storage device that can store data which can thereafter be input to a computer system. The non-transitory computer readable media may be based on any existing or subsequently developed technology for embodying computer programs in a manner that enables them to be read by a computer system. Examples of non-transitory computer readable media include a hard drive, network attached storage (NAS), read-only memory, random-access memory, flash-based nonvolatile memory (e.g., a flash memory card or a solid state disk), a CD (Compact Disc) (e.g., CD-ROM, CD-R, CD-RW, etc.), a DVD (Digital Versatile Disc), a magnetic tape, and other optical and non-optical data storage devices. The non-transitory computer readable media can also be distributed over a network coupled computer system so that the computer readable code is stored and executed in a distributed fashion.
Finally, boundaries between various components, operations, and data stores are somewhat arbitrary, and particular operations are illustrated in the context of specific illustrative configurations. Other allocations of functionality are envisioned and may fall within the scope of the invention(s). In general, structures and functionality presented as separate components in exemplary configurations can be implemented as a combined structure or component. Similarly, structures and functionality presented as a single component can be implemented as separate components.
As used in the description herein and throughout the claims that follow, “a,” “an,” and “the” includes plural references unless the context clearly dictates otherwise. Also, as used in the description herein and throughout the claims that follow, the meaning of “in” includes “in” and “on” unless the context clearly dictates otherwise.
The above description illustrates various embodiments along with examples of how aspects of particular embodiments may be implemented. These examples and embodiments should not be deemed to be the only embodiments, and are presented to illustrate the flexibility and advantages of particular embodiments as defined by the following claims. Other arrangements, embodiments, implementations and equivalents can be employed without departing from the scope hereof as defined by the claims.

## Claims

1. A method comprising:
on a periodic basis during runtime of a first computer system and prior to occurrence of an alternating current (AC) power loss or cycle event at the first computer system:
determining, by an operating system (OS) or hypervisor of the first computer system, one or more portions of a persistent memory of the first computer system that have been modified during the runtime; and
flushing, by the OS or hypervisor, the one or more portions to a memory or storage device that is remote from the first computer system and is accessible by a second computer system;

detecting, by the OS or hypervisor, the occurrence of the AC power loss or cycle event; and
in response to the detecting:
determining, by the OS or hypervisor, one or more further portions of the persistent memory that have been modified since a last occurrence of the flushing; and
saving, by the OS or hypervisor, the one or more further portions to the memory or storage device.

2. The method of claim 1 wherein the persistent memory is allocated from a volatile memory of the first computer system, and wherein the determining and the saving of the one or more further portions are executed by the OS or hypervisor while the first computer system runs on battery power.

3. The method of claim 1 wherein the determining and the flushing of the one or more portions comprises:
initiating a save timer;
monitoring for occurrence of an event that indicates a portion of the persistent memory has been modified;
upon detecting the event, storing information identifying the portion in a data structure;
checking whether the save timer has expired;
upon determining that the save timer has not expired, returning to the monitoring; and
upon determining that the save timer has expired, flushing the portion to the memory or storage device and clearing the data structure.

4. The method of claim 1 wherein the OS or hypervisor ensures that an amount of modified data in the persistent memory that has not been flushed to the memory or storage device does not exceed a threshold during the runtime of the first computer system.

5. The method of claim 4 wherein the OS or hypervisor dynamically adjusts the threshold during the runtime of the first computer system in response to changes in available write bandwidth of the memory or storage device.

6. The method of claim 1 further comprising:
generating, by the OS or hypervisor, a signal indicating that the one or more further portions have been saved in the memory or storage device.

7. The method of claim 6 wherein the second computer system detects the signal and restores the one or more further portions from the memory or storage device to a persistent memory of the second computer system.

8. A non-transitory computer readable storage medium having stored thereon program code executable by an operating system (OS) or hypervisor of a first computer system, the program code embodying a method comprising:
on a periodic basis during runtime of the first computer system and prior to occurrence of an alternating current (AC) power loss or cycle event at the first computer system:
determining one or more portions of a persistent memory of the first computer system that have been modified during the runtime; and
flushing the one or more portions to a memory or storage device that is remote from the first computer system and is accessible by a second computer system;

detecting the occurrence of the AC power loss or cycle event; and
in response to the detecting:
determining one or more further portions of the persistent memory that have been modified since a last occurrence of the flushing; and
saving the one or more further portions to the memory or storage device.

9. A non-transitory computer readable storage medium of claim 8 wherein the persistent memory is allocated from a volatile memory of the first computer system, and wherein the determining and the saving of the one or more further portions are executed by the OS or hypervisor while the first computer system runs on battery power.

10. A non-transitory computer readable storage medium of claim 8 wherein the determining and the flushing of the one or more portions comprises:
initiating a save timer;
monitoring for occurrence of an event that indicates a portion of the persistent memory has been modified;
upon detecting the event, storing information identifying the portion in a data structure;
checking whether the save timer has expired;
upon determining that the save timer has not expired, returning to the monitoring; and
upon determining that the save timer has expired, flushing the portion to the memory or storage device and clearing the data structure.

11. A non-transitory computer readable storage medium of claim 8 wherein the OS or hypervisor ensures that an amount of modified data in the persistent memory that has not been flushed to the memory or storage device does not exceed a threshold during the runtime of the first computer system.

12. A non-transitory computer readable storage medium of claim 11 wherein the OS or hypervisor dynamically adjusts the threshold during the runtime of the first computer system in response to changes in available write bandwidth of the memory or storage device.

13. A non-transitory computer readable storage medium of claim 8 wherein the method further comprises:
generating, by the OS or hypervisor, a signal indicating that the one or more further portions have been saved in the memory or storage device.

14. A non-transitory computer readable storage medium of claim 13 wherein the second computer system detects the signal and restores the one or more further portions from the memory or storage device to a persistent memory of the second computer system.

15. A computer system comprising:
an operating system (OS) or hypervisor;
a persistent memory; and
a non-transitory computer readable medium having stored thereon program code executable by the OS or hypervisor, the program code causing the OS or hypervisor to:
on a periodic basis during runtime of the computer system and prior to occurrence of an alternating current (AC) power loss or cycle event at the computer system:
determine one or more portions of the persistent memory that have been modified during the runtime; and
flush the one or more portions to a memory or storage device that is remote from the computer system and is accessible by another computer system;

detect the occurrence of the AC power loss or cycle event; and
in response to the detecting:
determine one or more further portions of the persistent memory that have been modified since a last occurrence of the flushing; and
save the one or more further portions to the memory or storage device.

16. The computer system of claim 15 wherein the persistent memory is allocated from a volatile memory of the computer system, and wherein the determining and the saving of the one or more further portions are executed by the OS or hypervisor while the computer system runs on battery power.

17. The computer system of claim 15 wherein the program code that causes the OS or hypervisor to determine and flush of the one or more portions comprises program code that causes the OS or hypervisor to:
initiate a save timer;
monitor for occurrence of an event that indicates a portion of the persistent memory has been modified;
upon detecting the event, store information identifying the portion in a data structure;
check whether the save timer has expired;
upon determining that the save timer has not expired, return to the monitoring; and
upon determining that the save timer has expired, flush the portion to the memory or storage device and clear the data structure.

18. The computer system of claim 15 wherein the OS or hypervisor ensures that an amount of modified data in the persistent memory that has not been flushed to the memory or storage device does not exceed a threshold during the runtime of the computer system.

19. The computer system of claim 18 wherein the OS or hypervisor dynamically adjusts the threshold during the runtime of the computer system in response to changes in available write bandwidth of the memory or storage device.

20. The computer system of claim 15 wherein the program code further causes the OS or hypervisor to:
generate a signal indicating that the one or more further portions have been saved in the memory or storage device.

21. The computer system of claim 20 wherein the said another computer system detects the signal and restores the one or more further portions from the memory or storage device to a persistent memory of said another computer system.