WO2012083695A1 - 内存迁移的实现方法和装置 - Google Patents

内存迁移的实现方法和装置 Download PDF

Info

Publication number
WO2012083695A1
WO2012083695A1 PCT/CN2011/077748 CN2011077748W WO2012083695A1 WO 2012083695 A1 WO2012083695 A1 WO 2012083695A1 CN 2011077748 W CN2011077748 W CN 2011077748W WO 2012083695 A1 WO2012083695 A1 WO 2012083695A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
physical address
operating system
migrated
computer
Prior art date
Application number
PCT/CN2011/077748
Other languages
English (en)
French (fr)
Inventor
裘稀石
王伟
韩高淮
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2011/077748 priority Critical patent/WO2012083695A1/zh
Priority to KR1020137024310A priority patent/KR101534540B1/ko
Priority to CN2011800011693A priority patent/CN102326149B/zh
Priority to JP2014501397A priority patent/JP5712451B2/ja
Priority to BR112013021548A priority patent/BR112013021548A2/pt
Priority to AU2011348835A priority patent/AU2011348835B2/en
Priority to EP11851937.0A priority patent/EP2664990A4/en
Publication of WO2012083695A1 publication Critical patent/WO2012083695A1/zh
Priority to US14/035,545 priority patent/US9600202B2/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/0292User address space allocation, e.g. contiguous or non contiguous base addressing using tables or multilevel address translation means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1456Hardware arrangements for backup
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/10Providing a specific technical effect
    • G06F2212/1032Reliability improvement, data loss prevention, degraded operation etc
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/25Using a specific main memory architecture
    • G06F2212/254Distributed memory
    • G06F2212/2542Non-uniform memory access [NUMA] architecture

Definitions

  • the present invention relates to computer technology, and in particular, to a method and apparatus for implementing memory migration. Background technique
  • Memory is one of the important components of a computer, and its performance has a very large impact on the computer; and with the rapid increase in server memory capacity, the probability of memory error has also increased significantly.
  • an error occurs in the memory, it will cause business interruption or system downtime, causing huge loss to the user.
  • multiple memory areas with errors can be migrated and isolated. This is usually a memory page or a few memory page granularity migration; memory migration can also reduce system power consumption.
  • a large-grained migration usually at the level of a dual in-line memory module (Dua Bu Inline_Mem.ry_M.dules, DIMM).
  • the specific process of implementing the memory migration includes: when receiving the memory migration instruction issued by the management program in the operating system (OS), the related controller of the system initializes the backup memory, and the initialization is used. Re-addressing the backup memory and the address space of the memory to be migrated, etc., so that the backup memory and the memory to be migrated use the same address bus; the Basic Input Output System (BIOS) copies the data in the memory to be migrated. When the copy is complete, the memory to be migrated is disabled and the backup memory is enabled. When the OS accesses the memory to be migrated again, the data stored in the backup memory can be directly accessed through the physical address of the original memory to be migrated.
  • OS operating system
  • BIOS Basic Input Output System
  • Embodiments of the present invention provide a method and apparatus for implementing memory migration to implement memory migration through a simple operation process.
  • a method for implementing memory migration including: when migrating memory to be migrated, a basic input/output system of a computer migrates data of the memory to be migrated to a first unavailable memory of an operating system of the computer
  • the first unavailable memory is pre-converted by the operating system's original available memory, and is reserved for the operating system, the operation
  • the memory that the system cannot modify and access the basic input/output system stores a mapping relationship between the memory to be migrated and the physical address of the first unavailable memory.
  • an apparatus for implementing memory migration including:
  • a first migration module configured to: when the memory to be migrated is migrated, the basic input/output system of the computer migrates the data of the to-be-migrated memory to the first unavailable memory of the operating system of the computer; the first unavailable memory a memory that is pre-converted for the operating system's original available memory and that is reserved for the operating system and that cannot be modified and accessed by the operating system;
  • a storage module configured to store, by the basic input/output system, a mapping relationship between the memory to be migrated and a physical address of the first unavailable memory.
  • the method and device for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated is first unavailable.
  • the mapping of the physical addresses of the memory is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • FIG. 1 is a flowchart of a method for implementing memory migration according to Embodiment 1 of the present invention
  • FIG. 2 is a flowchart of a method for implementing memory migration according to Embodiment 2 of the present invention
  • FIG. 3 is a flowchart of a method for implementing memory migration according to Embodiment 3 of the present invention.
  • FIG. 6 is a flowchart of a method for implementing memory migration according to Embodiment 6 of the present invention.
  • FIG. 9 is a flowchart of a method for implementing memory migration according to Embodiment 8 of the present invention. Flow chart of the law;
  • FIG. 12 is a schematic structural diagram of a 4-node NUMA architecture system according to Embodiment 10 of the present invention.
  • FIG. 15 is a first schematic structural diagram of an apparatus for implementing memory migration according to Embodiment 11 of the present invention
  • FIG. 16 is a second schematic structural diagram of an apparatus for implementing memory migration according to Embodiment 11 of the present invention
  • FIG. 18 is a schematic structural diagram of a memory module in an apparatus for implementing memory migration shown in FIG. 15
  • FIG. 19 is a schematic diagram of a memory migration implementation apparatus according to Embodiment 11 of the present invention
  • FIG. 20 is a schematic structural diagram of a second migration module in the apparatus for implementing memory migration shown in FIG. 19
  • FIG. 21 is a schematic structural diagram of a memory migration implementation apparatus according to Embodiment 11 of the present invention
  • FIG. 23 is a schematic structural diagram of an access module in an apparatus for implementing memory migration shown in FIG. 21;
  • FIG. 24 is a schematic structural diagram of an access module in an apparatus for implementing memory migration shown in FIG.
  • the structure diagram of the memory migration implementation device is six. detailed description
  • the embodiment of the present invention provides a method and an apparatus for implementing memory migration.
  • the method for implementing the memory migration includes: Step 101: When migrating the memory to be migrated, the basic input/output system of the computer migrates the data of the memory to be migrated to the operating system of the computer. The first is not available in memory.
  • the process of migrating the data of the memory to be migrated to the first unavailable memory of the operating system (OS) of the computer in step 101 may be used to copy the data of the memory to be migrated to the first non-
  • the memory is medium, and there is no limitation here; wherein the first unavailable memory can be pre-converted for the original available memory of the OS, and the OS is reserved, and the OS cannot tamper with and access the memory.
  • the BIOS can generate the e820 map when the system starts to address the memory. The storage is uniformly addressed, so that some of the memory is OS available memory, and the other part of the memory is OS unavailable memory.
  • the first unavailable memory of the OS in step 101 may be part of the memory of the OS's original available memory pre-converted. It is also possible for the OS to be part of the newly configured memory in other ways, which is no longer mentioned here. That is: the data of the memory to be migrated is migrated to the first unavailable memory of the OS, and the data of the memory to be migrated may be migrated to any position in the pre-converted memory of the original available memory; or may be based on the original available memory.
  • the physical address order of the pre-converted memory is sequentially transferred to the memory of the pre-converted memory of the original available memory, which will not be described here.
  • the memory to be migrated in step 101 may be a small-grained memory that needs to be migrated and isolated when the hypervisor in the OS finds that a memory has multiple errors; or may be non-uniform access.
  • NUMA Non Uniform Memory Access Achitecture
  • Step 102 The basic input/output system stores a mapping relationship between the memory to be migrated and the physical address of the first unavailable memory.
  • the mapping relationship between the memory to be migrated and the physical address of the first unavailable memory in step 102 may be a mapping relationship between the memory to be migrated and the physical address after the first unavailable memory is aligned with the memory page. This is no longer - repeat.
  • the mapping relationship may be stored in any location of the computer; or may be stored in a storage device such as a flash memory that is separately set for the mapping relationship; the mapping relationship may also be stored in other manners, and is not described here.
  • the method for implementing memory migration can be implemented by using a basic input output system (BIOS) in combination with corresponding computer hardware, and is not described here.
  • BIOS basic input output system
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the method for implementing memory migration includes: Step 201: The basic input/output system initializes a memory of the computer, so that part of the memory in the original available memory of the computer is converted into an unavailable memory of the operating system.
  • the process of initializing the memory of the computer through step 201 may be performed when the computer system is started; the process of initializing the memory of the computer through step 201 may pass through the memory. Addressing the way to generate the e820 map; it can also be implemented by other means, no longer here - repeat.
  • the initialization of the memory of the computer in step 201 may include converting the memory in the original available memory of the computer into the unavailable memory of the OS, and may also include setting the size of the unavailable memory of the OS, which is not limited herein.
  • the size of the unavailable memory of the OS may be set to set the unavailable memory of the OS to a fixed size memory; or the memory of the OS may be set to a size adjustable memory, that is, in the BIOS according to the system.
  • the memory size sets the size of the OS's unavailable memory, and so on.
  • Step 202 to step 203 the memory to be migrated is migrated through the basic input/output system of the computer, and the mapping relationship between the memory to be migrated and the physical address of the first unavailable memory is stored.
  • the first unavailable memory in step 202 to step 203 may be part of the unavailable memory converted by the step 201, and is not described here again.
  • the specific process from step 202 to step 203 can be referred to step 101 to step 102 shown in Fig. 1, and is not described here.
  • the implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • Step 301 The basic input/output system initializes the memory of the computer, and the specific process may refer to step 201 shown in FIG. Again - repeat.
  • Step 302 The basic input/output system acquires the first unavailable memory from the unavailable memory of the operating system.
  • the first unavailable memory is obtained from the unavailable memory in step 302.
  • the BIOS may obtain the first unavailable memory size from the unavailable memory in sequence according to the physical address of the unavailable memory. RAM.
  • Step 303 The basic input/output system migrates data of the memory to be migrated to the first unavailable memory.
  • the process of migrating the data of the memory to be migrated to the first unavailable memory in step 303 may be used to copy the data of the memory to be migrated to the first unavailable memory, which is not limited herein.
  • Step 304 The basic input/output system stores the mapping relationship between the memory to be migrated and the physical address of the first unavailable memory. For the specific process, refer to step 102 shown in FIG. 1, which is not repeated here.
  • the implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the method for implementing the memory migration includes: Step 401: The basic input/output system of the computer migrates the data of the memory to be migrated to the first unavailable memory, and the specific process may refer to the figure. Step 101 shown in Figure 1 is not repeated here.
  • Step 402 The basic input/output system aligns the physical address of the memory to be migrated into a memory page to obtain a first physical address.
  • Step 403 The basic input/output system stores the mapping relationship between the first physical address and the physical address of the first unavailable memory.
  • the physical address of the memory to be migrated may be first aligned in step 402, and then the physical address of the aligned remaining memory and the first unavailable memory are stored in step 403.
  • the mapping of physical addresses may be first aligned in step 402, and then the physical address of the aligned remaining memory and the first unavailable memory are stored in step 403.
  • the method for implementing memory migration provided by this embodiment can be combined with a corresponding computer through a BIOS. Hardware implementation, no longer here - repeat.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the method for implementing the memory migration includes: Step 501: The operating system of the computer migrates data of the operating system migratable memory in the memory to be migrated to the first free memory of the computer. .
  • the operating system migratable memory in step 501 can include: a large amount of user state memory and/or a small number of kernels. State memory.
  • the first free memory in step 501 may be part of the unoccupied memory of the current computer, that is, the data of the OS migratable memory is migrated to the first free memory, and the OS may be migrated.
  • the data is migrated to any location in the unoccupied memory of the current computer. It is also possible to sequentially migrate the data of the OS migratable memory to the unoccupied memory of the current computer according to the physical address order of the memory that is not occupied by the current computer. , no longer here - repeat.
  • the migration of the data of the OS migratable memory to the first free memory in step 501 may include: first, the OS sleeps all processes that reference the OS migratable memory; and secondly, the OS is unoccupied in the current computer.
  • a memory is allocated in the memory, that is, the first free memory, and the data of the OS migratable memory is migrated to the first free memory; then the OS deletes the page table entry corresponding to the OS migratable memory, and updates the reference to the OS migratable memory.
  • the page table entry in all processes points to the first free memory; finally, the OS reawakens the sleep process.
  • Step 501 can also migrate the data of the OS migratable memory to the first free memory in other manners, which is not limited herein.
  • the OS allocates a piece of memory in the unoccupied memory of the current computer, and may be a fixed-size memory set in advance, a memory allocated according to the size of the OS-migtable memory, or a memory allocated by other means. , no longer here - praise.
  • the data of the OS migratable memory is migrated to the first free memory in step 501, and the data of the OS migratable memory can be directly migrated to the first free memory.
  • the OS migrating memory is being used, and if it is being used, the OS migrating memory data is migrated to the first free memory; and the OS migratable memory data can be migrated to the first idle by other means. In memory, no longer here - repeat.
  • the memory to be migrated in step 501 may be a small-grained memory that needs to be migrated and isolated when the hypervisor in the OS finds that a certain error occurs in a certain memory; or in the NUMA architecture, in order to reduce system power consumption.
  • Step 502 The basic input/output system of the computer migrates the data of the remaining memory into the second unavailable memory.
  • the migration of the data of the OS migratable memory to the first free memory in step 501 is implemented by the OS
  • the migration of the remaining memory data to the second unavailable memory in step 502 is implemented by the BIOS.
  • the remaining memory in step 502 may be memory other than OS migratable memory in the memory to be migrated.
  • the process of migrating the data of the remaining memory to the second unavailable memory in step 501 may be used to copy the data of the remaining memory to the second unavailable memory, which is not limited herein; Unusable memory can be part of the first unavailable memory.
  • Step 503 The basic input/output system stores a mapping relationship between the remaining memory and the physical address of the second unavailable memory.
  • step 503. the process of storing the mapping relationship between the remaining memory and the physical address of the second unavailable memory is performed in step 503.
  • the implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing memory migration provided by the embodiment of the present invention implements memory migration by combining the OS of the computer with the BIOS, thereby improving the flexibility of memory migration.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are The mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can During the memory migration, the process of initializing the first unavailable memory is omitted, which solves the problem that the operation process of the memory migration in the prior art is complicated.
  • the method for implementing the memory migration includes the following steps: Step 601: When the memory to be migrated is migrated, the operating system obtains an operating system that can be migrated by the operating system from the memory to be migrated.
  • the OS migrating memory in step 601 is mostly user state memory, and may also include a small amount of kernel state memory.
  • the OS migrating memory that the OS supports migration is obtained from the memory to be migrated in step 601, and the OS can be directly migrated from the memory to be migrated by the OS; or the OS can be used to determine the migration memory. Then, the OS can be migrated from the memory to be migrated according to the judgment result; and the OS can be migrated from the memory to be migrated by the OS in other ways, and details are not described herein again.
  • step 602 the operating system performs sleep processing on all processes that reference the operating system's migratable memory.
  • Step 603 The operating system allocates the first free memory in the unoccupied memory of the computer.
  • the first free memory is allocated in the unoccupied memory of the computer through step 603, and the first free memory may be allocated at any position of the unoccupied memory of the computer;
  • the physical address order of the occupied memory, the first free memory, etc. are allocated in turn, and are not repeated here.
  • Step 604 The operating system copies the data of the migratable memory into the first free memory.
  • Step 605 The operating system deletes all page table entries corresponding to the operating system migratable memory.
  • Step 606 The operating system updates the page table entry of all processes that reference the operating system migratable memory, so that the updated related page table entry points to the first free memory.
  • Step 607 The operating system wakes up the process of performing sleep processing.
  • the process of performing sleep processing in step 602 can be awakened by step 607, so that the processes can continue to perform related operations.
  • Step 608 to step 609 the basic input/output system migrates the data of the remaining memory into the first unavailable memory, and stores the mapping relationship between the remaining memory and the physical address of the first unavailable memory.
  • step 502 to step 503 in FIG. 5, which is not repeated here The implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the method for implementing the memory migration includes: Step 701 to Step 702:
  • the basic input/output system migrates the data of the memory to be migrated to the first unavailable memory.
  • the storage relationship between the memory to be migrated and the physical address of the first unavailable memory is stored.
  • step 101 to step 102 shown in FIG. 1 which is not repeated here.
  • Step 703 When the operating system accesses the target physical address, it is determined whether the mapping relationship corresponding to the target physical address exists in the mapping relationship stored by the computer.
  • mapping relationship between the memory to be migrated and the physical address of the first unavailable memory is stored in step 702
  • the computer storage content is a mapping relationship between the memory to be migrated and the original physical address of the first unavailable memory.
  • the process of determining whether the mapping relationship corresponding to the target physical address exists in the mapping relationship stored by the computer may include: first, respectively, mapping the stored relationship of the computer to the memory page alignment; and then performing the physical address of the first unavailable memory in the memory. Page alignment; Finally, the mapping relationship between the stored nodes of the computer and the physical address of the first unusable memory for the memory page alignment is obtained in the mapping relationship obtained by the memory page alignment.
  • the process of determining whether the mapping relationship corresponding to the target physical address exists in the mapping relationship stored by the computer may include: First, the target physical address is aligned with the memory page; and then the physical address obtained by the target physical address for the memory page alignment is determined in the mapping relationship stored by the computer. In step 703, it is also possible to determine whether there is a mapping relationship corresponding to the target physical address in the mapping relationship stored by the computer, and no further description is provided herein.
  • the OS may directly access the mapping relationship.
  • Step 704 When the mapping relationship corresponding to the target physical address exists, the operating system accesses the data of the first unavailable memory according to the mapping relationship corresponding to the target physical address.
  • step 703 when it is determined in step 703 whether there is a mapping relationship corresponding to the target physical address in the mapping relationship stored by the computer, if the mapping relationship stored by the computer is a mapping relationship between the remaining memory and the original physical address of the first unavailable memory.
  • the specific process of accessing the data of the first unavailable memory according to the mapping relationship corresponding to the target physical address in step 704 may include: first, aligning the original physical address of the memory to be migrated with the memory page to obtain an offset of the memory to be migrated.
  • the operating system obtains the second physical address of the first unavailable memory corresponding to the target physical address according to the mapping relationship corresponding to the target physical address; the operating system accesses the data of the first unavailable memory according to the sum of the offset and the second physical address; .
  • the mapping relationship stored by the computer is a mapping relationship between the remaining memory and the physical address of the first unavailable memory
  • the first unusable memory is accessed according to the mapping relationship corresponding to the target physical address.
  • the process may include: first, the OS acquires an offset of the target physical address; and then the OS acquires a second physical address of the first unavailable memory corresponding to the target physical address according to the mapping relationship corresponding to the target physical address; the OS according to the offset and the second The sum of the physical addresses accesses the data of the first unavailable memory.
  • the method for implementing the memory migration may further include:
  • Step 705 Determine whether the memory where the target physical address is located is user state memory or kernel state memory.
  • step 705 may be first passed.
  • the memory of the target physical address is user-mode memory or kernel-mode memory.
  • the memory of the target physical address is user-mode memory
  • the memory is directly accessed through the page table entry; and the memory of the target physical address is kernel-mode memory.
  • step 703 it is determined whether there is a mapping relationship between the address-aligned addresses of the target object in the mapping relationship table.
  • step 703 if the memory of the target physical address is kernel-mode memory, it is determined whether there is a mapping relationship corresponding to the target physical address in the mapping relationship stored by the computer.
  • the implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the method for implementing the memory migration includes: Step 901 to Step 902, when the memory to be migrated is migrated, the basic input/output system migrates the data of the memory to be migrated to the first unavailable memory.
  • the storage relationship between the memory to be migrated and the physical address of the first unavailable memory is stored.
  • step 101 to step 102 shown in FIG. 1 which is not repeated here.
  • Step 903 When the target node is hot-added, the basic input/output system performs memory addressing on the target node to obtain a physical address corresponding to the target node.
  • the target node is memory-addressed by step 903, and the target node is the original hot-removed node, and the physical address corresponding to the target node is unchanged; when the target node is not the originally hot-removed node
  • the physical address corresponding to the target node may be in the address space of each original node.
  • Step 904 The basic input/output system checks whether a physical address corresponding to the target node exists in the mapping relationship stored by the computer.
  • step 904 it is checked in step 904 whether the physical address corresponding to the target node exists in the mapping relationship stored in the computer, and the physical address corresponding to the target node does not exist in the mapping relationship stored in the computer, and the target node is directly added.
  • the target node is hot-added through step 905.
  • Step 905 When the physical address corresponding to the target node exists in the mapping relationship stored by the computer, the basic input/output system acquires the third physical address of the first unavailable memory corresponding to the physical address corresponding to the target node according to the mapping relationship.
  • Step 906 The basic input/output system migrates the data of the memory where the third physical address is located to the memory where the physical address corresponding to the target node is located.
  • Step 907 The basic input/output system deletes the mapping relationship of the physical address corresponding to the target node in the mapping relationship stored by the computer.
  • the implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the prior art.
  • the device will be specifically described.
  • the method for implementing the memory migration includes the following:
  • the following is a small-grained memory that needs to be migrated and isolated when the memory to be migrated is a management program in the OS that finds that some memory has multiple errors. Give an example for explanation.
  • Step 1001 The basic input/output system initializes the memory of the computer, so that part of the memory in the original available memory of the operating system in the computer is converted into the unavailable memory of the operating system.
  • the process of initializing the memory of the computer through the step 1001 may be performed when the computer system is started; the process of initializing the memory of the computer through the step 1001 may pass the memory Addressing the way to generate the e820 map; it can also be implemented by other means, no longer here - repeat.
  • the initialization of the memory of the computer in step 1001 may include converting the memory in the original available memory of the computer into the unavailable memory of the OS, and may also include setting the size of the unavailable memory of the OS, etc., which is not limited herein. Among them, set the size of the OS's unavailable memory, which can be used to set the OS's unavailable memory. Set to a fixed size of memory; can also set the OS's unavailable memory to size adjustable memory, that is, in the BIOS according to the system memory size to set the size of the OS's unavailable memory.
  • the size of the unavailable memory of the OS should be an integer multiple of the memory page, and in the memory migration, the memory page should also be migrated.
  • Step 1002 When the memory to be migrated is migrated, the operating system determines whether the memory to be migrated is idle. In this embodiment, when it is determined in step 1002 that the memory to be migrated is idle, the system can directly return, that is, the memory to be migrated does not need to be migrated. If it is determined in step 1002 that the memory to be migrated is being used, step 1003 can be performed. The memory to be migrated is processed.
  • Step 1003 If the memory to be migrated is being used, the operating system determines whether it supports the migration of the memory of the memory type to be migrated.
  • step 1003 it is determined in step 1003 whether the OS supports the migration of the memory of the memory type to be migrated. If not, the system can directly return. If yes, the OS can be migrated through step 1004.
  • Step 1004 When the operating system supports the memory of the memory type to be migrated, the operating system that supports the migration of the operating system can be migrated from the memory to be migrated.
  • the OS migrating memory in step 1004 is mostly user state memory, and may also include a small amount of kernel state memory.
  • the OS migrateable memory that the OS supports for migration is obtained from the memory to be migrated in step 1004, and the OS can be directly migrated from the memory to be migrated by the OS; or the OS can be used to determine the migrated memory. Then, the OS can be migrated from the memory to be migrated according to the judgment result; and the OS can be migrated from the memory to be migrated by the OS in other ways, and details are not described herein again.
  • step 1005 the operating system sleeps all processes that reference the operating system's migratable memory.
  • Step 1006 The operating system allocates the first free memory in the unoccupied memory of the computer.
  • the first free memory is allocated in the unoccupied memory of the computer by step 1006, and the first free memory may be allocated at any position of the unoccupied memory of the computer;
  • the physical address order of the occupied memory, and the first idle is allocated in turn Memory, etc., no longer here - repeat.
  • Step 1007 The operating system copies the data of the migratable memory into the first free memory.
  • Step 1008 The operating system deletes all page table entries corresponding to the operating system migratable memory.
  • Step 1009 The operating system updates the page table entries of all processes that reference the operating system's migratable memory, so that the updated related page table entries point to the first free memory.
  • Step 1010 The operating system wakes up the process of performing sleep processing.
  • Step 1011 The operating system determines whether the memory to be migrated is successfully migrated.
  • the memory to be migrated in step 1011 is successfully migrated, and the memory to be migrated is copied to other memory in the system. If only the partial copy is used, the migration of the memory to be migrated fails.
  • the direct return is performed; when the failure occurs, the control of the computer system is transferred from the OS to the BIOS through step 1012.
  • Step 1012 the operating system sleeps, and the control is transferred to the BIOS to take over.
  • Step 1013 The basic input/output system acquires the first unavailable memory from the operating system unavailable memory.
  • the first unavailable memory is obtained from the OS unavailable memory in step 1013, and the BIOS may sequentially obtain the size of the memory to be migrated from the 0S unavailable memory according to the order of the physical addresses of the 0S unavailable memory. One is not available memory.
  • the first unavailable memory is obtained from the OS unavailable memory through step 1013. If the acquisition fails, that is, the OS unavailable memory has been used up, the BIOS prompts the user that the memory migration fails; if the acquisition succeeds, the step is successful. 1014 Migrate data of the memory to be migrated to the first unavailable memory.
  • Step 1014 The basic input/output system migrates data of the memory to be migrated into the first unavailable memory.
  • the process of migrating the data of the memory to be migrated to the first unavailable memory in step 1014 may be used to copy the data of the memory to be migrated to the first unavailable memory, which is not limited herein.
  • Step 1015 The basic input/output system aligns the physical address of the memory to be migrated to obtain a first physical address.
  • the physical address of the memory to be migrated in step 1015 may be recorded in the storage device of the computer, or may be recorded in other locations of the computer, and is not described here.
  • Step 1016 The basic input/output system uses the first physical address and the first unavailable memory. The mapping relationship of the address is stored.
  • the physical address of the memory to be migrated may be aligned first by step 1015, and then the physical address of the aligned remaining memory and the first unavailable memory are stored by step 1016.
  • Step 1017 When the migration of the memory to be migrated ends, the basic input/output system re-controls the control of the system to be taken over by the operating system.
  • Step 1018 When the operating system accesses the target physical address, it is determined whether the mapping relationship corresponding to the target physical address exists in the mapping relationship stored by the computer.
  • the system may directly access the content of the memory where the target physical address is located without performing address translation; if yes, the system may pass Step 1019 obtains an offset of the target physical address.
  • Step 1019 The operating system acquires an offset of the target physical address.
  • Step 1020 The operating system acquires, according to the mapping relationship corresponding to the target physical address, a second physical address of the first unavailable memory corresponding to the target physical address.
  • Step 1021 The operating system accesses data of the first unavailable memory according to the sum of the offset and the second physical address.
  • the memory to be migrated may be the command to be migrated by the management program in the OS, where the physical address is to be migrated; or the user may manually input the virtual address that needs to be migrated, and obtain the corresponding waiting according to the virtual address.
  • Migrate memory The memory to be migrated is usually in units of one memory page.
  • the implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing the memory migration provided by the embodiment of the present invention, when the memory to be migrated is migrated, the data of the memory to be migrated is migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are
  • the mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the method for implementing memory migration provided by Embodiment 10 of the present invention includes:
  • the memory to be migrated is in the NUMA architecture.
  • the node memory needs to be hot removed as an example.
  • Step 1101 The basic input/output system initializes the memory of the computer, so that part of the memory in the original available memory of the operating system in the computer is converted into the unavailable memory of the operating system.
  • a 4-node NUMA architecture is taken as an example.
  • Each node in the NUMA architecture includes a central processing unit, an input/output device, and a memory. Since the node 0 is set as the master node, the OS of the entire system is run, so it cannot be hot removed.
  • Step 1101 Convert some memory in the original available memory to the operating system's unavailable memory, and set the memory in node 1 to be OS unavailable memory; in order to facilitate other nodes to find the data migrated to node 1, node 1 can be The memory is divided into two parts, corresponding to the OS non-migtable memory in node 2 and node 3.
  • Step 1102 The operating system migrates data of the operating system migratable memory in the memory to be migrated to the first free memory of the computer.
  • the first free memory in step 1102 may be a node with a lighter load than the hot removal node.
  • Step 1102 The process of migrating data of the OS migrating memory to the first free memory may be referred to step 501 shown in FIG. 5, and is not described here.
  • Step 1103 The BIOS migrates the data of the remaining memory to the second unavailable memory. For the specific process, refer to step 502 shown in FIG. 5, which is not repeated here.
  • Step 1104 The mapping relationship between the remaining memory and the physical address of the second unavailable memory is stored. For the specific process, reference may be made to step 503 shown in FIG. 5, which is not repeated here.
  • Step 1105 When the migration of the memory to be migrated is completed, the other devices of the node where the memory to be migrated are hot removed.
  • the memory migration implementation method provided in this embodiment may also perform hot addition on the node, as shown in FIG. 13, including:
  • Step 1301 When the target node is hot-added, the basic input/output system performs memory addressing on the target node to obtain a physical address corresponding to the target node.
  • the target node is memory-addressed by step 1301, and the target node is the original hot-removed node, and the physical address corresponding to the target node is unchanged; when the target node is not the originally hot-removed node
  • the physical address corresponding to the target node may be in the address space of each original node.
  • Step 1302 The basic input/output system checks whether there is a physical address corresponding to the target node in the mapping relationship stored by the computer.
  • the physical address corresponding to the target node exists in the mapping relationship stored in the computer, and the physical address corresponding to the target node does not exist in the mapping relationship stored in the computer, and the target node is directly added.
  • the target node is hot added through step 905.
  • Step 1303 When the physical address corresponding to the target node exists in the mapping relationship stored by the computer, the basic input/output system acquires the third physical address of the first unavailable memory corresponding to the physical address corresponding to the target node according to the mapping relationship.
  • Step 1304 The basic input/output system migrates the data of the memory where the third physical address is located to the memory where the physical address corresponding to the target node is located.
  • Step 1305 The basic input/output system deletes the mapping relationship between the physical addresses corresponding to the target nodes in the mapping relationship stored by the computer.
  • the memory migration implementation method provided in this embodiment may also perform cross-node access, as shown in FIG. 14, including:
  • Step 1401 node 0 sends an address signal to node 2 that needs to access node 2.
  • Step 1402 Determine whether the node 2 is hot removed by the address signal.
  • the node 0 can directly access the memory in the node 2; if it is determined that the node 2 is hot removed, the storage stored in the computer is obtained through step 1403. Mapping relations.
  • Step 1403 Obtain a mapping relationship stored in the computer.
  • Step 1404 according to the mapping relationship stored by the computer, the address signal is subjected to address conversion, and the memory in the node 2 is accessed.
  • the system can directly access, and is not described here.
  • the implementation method of the memory migration provided in this embodiment can be implemented by using a BIOS in combination with a corresponding computer hardware, and is not described here.
  • the method for implementing memory migration provided by the embodiment of the present invention, when migrating the memory to be migrated, The input/output system migrates the data of the memory to be migrated to the first unavailable memory, and stores the mapping relationship between the memory to be migrated and the physical address of the first unavailable memory, thereby implementing memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the apparatus for implementing memory migration according to Embodiment 11 of the present invention includes: a first migration module 1501, configured to: when a memory to be migrated is migrated, a basic input/output system of a computer stores data of the memory to be migrated Migrating to the first unavailable memory of the operating system of the computer; the first unavailable memory is pre-converted by the operating system's original available memory, reserved for the operating system, and the operating system may not modify and access the memory .
  • a first migration module 1501 configured to: when a memory to be migrated is migrated, a basic input/output system of a computer stores data of the memory to be migrated Migrating to the first unavailable memory of the operating system of the computer; the first unavailable memory is pre-converted by the operating system's original available memory, reserved for the operating system, and the operating system may not modify and access the memory .
  • the process of migrating data of the memory to be migrated to the first unavailable memory of the OS of the computer by using the first migration module 1501 may copy the data of the memory to be migrated to the first unavailable memory.
  • the first unavailable memory can be pre-converted for the original available memory.
  • the BIOS can uniformly address the memory so that some of the memory is OS available memory, and the other part is OS unavailable memory.
  • the first unavailable memory in the first migration module 1501 may be part of the memory that is previously converted by the original available memory, or may be 0S. Some of the newly configured memory by other means will not be described here. That is: the data of the memory to be migrated is migrated to the first unavailable memory, and the data of the memory to be migrated may be migrated to any position in the pre-converted memory of the original available memory; or may be pre-converted according to the original available memory. The physical address order of the memory, in turn, the data of the remaining memory is migrated to the memory of the pre-converted memory of the original available memory, which is no longer described here.
  • the memory to be migrated in the first migration module 1501 may be a small-grained memory that needs to be migrated and isolated when the hypervisor in the OS finds that there are multiple errors in a certain memory; or in the NUMA architecture, System power consumption, node memory that needs to be hot removed; it can also be memory that needs to be migrated in other cases, no longer here - repeat.
  • the storage module 1502 is configured to store, by the basic input/output system, a mapping relationship between the memory to be migrated and a physical address of the first unavailable memory.
  • the mapping relationship between the memory to be migrated and the physical address of the first unavailable memory in the storage module 1502 may be that the memory to be migrated is aligned with the first unavailable memory.
  • the mapping relationship of the address, etc., is no longer mentioned here.
  • the mapping relationship may be stored in any location on the computer; or may be stored in a storage device such as a flash memory that is separately set for the mapping relationship; the mapping relationship may also be stored in other manners, and is not described here.
  • the apparatus for implementing memory migration in this embodiment may further include: an initialization module 1500, configured to initialize the memory of the computer by the basic input/output system, so that the original in the computer Part of the available memory is converted to the operating system's unavailable memory.
  • an initialization module 1500 configured to initialize the memory of the computer by the basic input/output system, so that the original in the computer Part of the available memory is converted to the operating system's unavailable memory.
  • the process of initializing the memory of the computer by the initialization module 1500 may be performed when the computer system is started; the process of initializing the memory of the computer by the initialization module 1500 may pass The implementation of the memory addressing method to generate the e820 map; can also be achieved by other means, no longer here - repeat.
  • the initializing module 1500 initializes the memory of the computer, and may include converting the memory in the original available memory of the computer into the unavailable memory of the OS, and may also include setting the size of the unavailable memory of the OS, etc., and is not limited herein. .
  • the size of the unavailable memory of the OS may be set to set the memory of the OS to a fixed amount of memory; or the memory of the OS may be set to a size adjustable memory, that is, in the BIOS according to the system.
  • the memory size sets the size of the OS's unavailable memory, and so on.
  • the first migration module 1501 in this embodiment may include: a first memory acquisition submodule 15011, where the basic input/output system acquires the memory from the operating system unavailable memory. The first unavailable memory.
  • the first memory acquisition sub-module 15011 obtains the first unavailable memory from the 0S unavailable memory, and the BIOS may sequentially acquire the memory from the 0S unavailable memory according to the order of the physical addresses of the 0S unavailable memory. The first unavailable memory to migrate memory size.
  • the migration sub-module 15012 is configured to migrate, by the basic input/output system, data of the to-be-migrated memory into the first unavailable memory.
  • the process of migrating the data of the memory to be migrated to the first unavailable memory by the migration sub-module 15012 may be used to copy the data of the memory to be migrated into the first unavailable memory, etc., and is not limited herein.
  • the storage module 1502 in this embodiment may include: a memory page alignment sub-module 15021, where the basic input/output system stores the to-be-migrated memory The physical address is aligned with the memory page to obtain the first physical address.
  • the storage submodule 15022 is configured to store, by the basic input/output system, a mapping relationship between the first physical address and a physical address of the first unavailable memory.
  • the physical address of the memory to be migrated may be first aligned by the memory page alignment sub-module 15021, and then the physical address of the aligned remaining memory is stored by the storage sub-module 15022.
  • a mapping relationship with the physical address of the first unavailable memory may be first aligned by the memory page alignment sub-module 15021, and then the physical address of the aligned remaining memory is stored by the storage sub-module 15022.
  • the apparatus for implementing memory migration in this embodiment may further include: a second migration module 1503, wherein an operating system of the computer uses the operating system in the memory to be migrated to migrate memory The data is migrated to the first free memory of the computer.
  • the operating system migratable memory in the second migration module 1503 may include: a large amount of user state memory and/or A small amount of kernel state memory.
  • the first free memory in the second migration module 1503 may be part of the unoccupied memory of the current computer, that is, the data of the OS migratable memory is migrated to the first free memory, and the OS may be used.
  • the data of the migratable memory is migrated to any position in the unoccupied memory of the current computer; or the data of the OS migratable memory is sequentially migrated to the current computer unoccupied according to the physical address order of the memory that is not occupied by the current computer.
  • the memory is medium, no longer here - repeat.
  • the migration of the OS migratable memory data to the first free memory in the second migration module 1503 may include: First, the OS will sleep all the processes that reference the OS migratable memory; secondly, the OS is currently A piece of memory is allocated in the unoccupied memory of the computer, that is, the first free memory, and the data of the OS migratable memory is migrated to the first free memory; then the OS deletes the page table entry corresponding to the OS migratable memory, and updates the reference The OS can migrate the page table entries in all processes of memory to point to the first free memory; finally, the OS wakes up the sleep process again.
  • the second migration module 1503 can also migrate the data of the OS migratable memory to the first free memory by other means, which is not limited herein.
  • the OS allocates a piece of memory in the unoccupied memory of the current computer, and may be a fixed-size memory set in advance, or a memory allocated according to the size of the OS migratable memory, or a memory allocated by other means. , no longer here - repeat.
  • the data of the OS migratable memory is migrated to the second migration module 1503.
  • the data of the OS migratable memory can be directly migrated to the first free memory; or the OS migratable memory can be first queried whether it is being used, and if the OS is being used, the OS can be migrated.
  • the data is migrated to the first free memory; the data of the OS migratable memory can also be migrated to the first free memory by other means, which is not repeated here.
  • the first migration module 1501 the basic input/output system for the computer migrates the data of the remaining memory into the second unavailable memory, where the remaining memory is the operation in the memory to be migrated.
  • the system can migrate memory outside the memory, and the second unavailable memory is part of the first unavailable memory.
  • the second migration module 1503, as shown in FIG. 20, includes:
  • the second memory acquisition sub-module 15031 is configured to obtain, by the operating system, the operating system loadable memory that the operating system supports migration from the memory to be migrated.
  • the OS migratable memory in the second memory acquisition submodule 15031 is mostly user state memory, and may also include a small amount. Kernel state memory.
  • the second memory acquisition sub-module 15031 obtains the OS migratable memory that the OS supports migration from the memory to be migrated, and the OS can directly obtain the OS migratable memory from the memory to be migrated; The memory is migrated for judgment, and then the OS can be migrated from the memory to be migrated according to the judgment result; and the OS can be migrated from the memory to be migrated by the OS in other ways, and is not described here.
  • the sleep processing sub-module 15032 is configured to perform sleep processing on all processes that reference the operating system loadable memory of the operating system.
  • the memory allocation sub-module 15033 is configured to allocate, by the operating system, the first free memory in a memory that is not occupied by the computer.
  • the first free memory is allocated in the unoccupied memory of the computer by the memory allocation sub-module 15033, and the first free memory may be allocated at any position of the unoccupied memory of the computer;
  • the physical address order of the unoccupied memory of the computer, the first free memory and the like are sequentially allocated, and are not repeated here.
  • the memory copy sub-module 15034 is configured to copy, by the operating system, data of the operating system migratable memory into the first free memory.
  • a page table entry deletion sub-module 15035 configured for the operating system to delete the operating system to be migrated Save all corresponding page table entries.
  • the page table entry update sub-module 15036 is configured to update, by the operating system, a page table entry of all processes that reference the operating system migratable memory, so that the updated page table entry points to the first idle memory.
  • the wakeup submodule 15037 is configured to wake up the process of performing the sleep processing by the operating system. Further, as shown in FIG. 21, the apparatus for implementing memory migration in this embodiment may further include: a control module 1504, configured to determine, when the operating system accesses the target physical address, whether the mapping relationship stored by the computer exists Mapping relationship corresponding to the target physical address.
  • the storage module 1502 when the storage module 1502 stores the mapping relationship between the memory to be migrated and the physical address of the first unavailable memory, if the computer storage content is the mapping between the memory to be migrated and the original physical address of the first unavailable memory.
  • the process of determining, by the control module 1504, whether there is a mapping relationship corresponding to the target physical address in the mapping relationship stored by the computer may include: first, respectively, mapping the stored relationship of the computer to the memory page alignment; and then the physical address of the first unavailable memory. Perform memory page alignment; Finally, determine the mapping relationship between the stored nodes of the computer for the memory page alignment to obtain the physical address of the first unavailable memory physical address for memory page alignment.
  • the process of determining, by the control module 1504, whether a mapping relationship corresponding to the target physical address exists in the mapping relationship stored by the computer may include, if the computer storage content is a mapping relationship between the physical address of the memory to be migrated and the memory address of the first unavailable memory. : First, the target physical address is aligned with the memory page; then it is determined whether there is a physical address obtained by the target physical address for the memory page alignment in the mapping relationship stored by the computer. The control module 1504 can also determine whether there is a mapping relationship corresponding to the target physical address in the mapping relationship stored by the computer in other manners, and details are not described herein again.
  • the OS can directly access the memory where the target physical address is located; for example, computer storage
  • the mapping relationship between the target physical addresses exists in the mapping relationship, and the OS can access the memory after the target physical address conversion through the access module 1505.
  • the access module 1505 is configured to: when the mapping relationship corresponding to the target physical address exists, the operating system accesses data of the first unavailable memory according to a mapping relationship corresponding to the target physical address. In this embodiment, when the control module 1504 determines whether there is a mapping relationship corresponding to the target physical address in the mapping relationship stored by the computer, if the mapping relationship stored by the computer is the mapping between the remaining memory and the original physical address of the first unavailable memory.
  • the specific process of accessing the data of the first unavailable memory according to the mapping relationship corresponding to the target physical address by the accessing module 1505 may include: first, aligning the original physical address of the memory to be migrated with the memory page to obtain a partiality of the memory to be migrated The operating system obtains the second physical address of the first unavailable memory corresponding to the target physical address according to the mapping relationship corresponding to the target physical address; the operating system accesses the first unavailable memory according to the sum of the offset and the second physical address The data. If the mapping relationship stored by the computer is a mapping relationship between the remaining memory and the physical address of the first unavailable memory that has been aligned with the memory page, the access module 1505 accesses the data of the first unavailable memory according to the mapping relationship corresponding to the target physical address.
  • the specific process may include: first, the OS acquires an offset of the target physical address; and then the OS acquires a second physical address of the first unavailable memory corresponding to the target physical address according to the mapping relationship corresponding to the target physical address; The sum of the two physical addresses accesses the data of the first unavailable memory.
  • the memory migration implementation device may further include: a memory judging module 1506, configured to determine whether the memory where the target physical address is located is user state memory or kernel state memory.
  • the kernel state memory is not migrating for the OS, and the kernel state memory can only be migrated through the BIOS, and the mapping in the table is performed.
  • the relationship obtains the memory location after the kernel state memory migration, and for the OS migration user state memory, the access can be directly accessed through the updated page table entry; therefore, in order to simplify the judgment process in the memory control module 1504, it may first pass
  • the memory judging module 1506 determines whether the memory of the target physical address is user-mode memory or kernel-mode memory, so that when the memory of the target physical address is user-mode memory, the memory is directly accessed through the page table entry; and the memory of the target physical address is located.
  • the memory judging module 1506 re-determines whether there is a mapping relationship between the address of the target object and the address after the page alignment.
  • the control module 1504 is configured to determine whether a mapping relationship corresponding to the target physical address exists in the mapping relationship stored by the computer when the memory where the target physical address is located is the kernel state.
  • the access module 1505, as shown in FIG. 23, may include:
  • the offset obtaining submodule 15051 is configured to acquire, by the operating system, an offset of the target physical address.
  • the second physical address obtaining sub-module 15052 is configured to obtain, by the operating system, a second physical address of the first unavailable memory corresponding to the target physical address according to a mapping relationship corresponding to the target physical address.
  • the access sub-module 15053 is configured to, by the operating system, access data of the first unavailable memory according to the sum of the offset and the second physical address.
  • the device for implementing memory migration in this embodiment may further include: an address obtaining module 1507, configured to perform hot add on the target node, where the basic input/output system performs the target node Memory addressing, obtaining the physical address corresponding to the target node.
  • the address obtaining module 1507 performs memory addressing on the target node, so that when the target node is the originally hot removed node, the physical address corresponding to the target node is unchanged; the target node is not originally removed by heat.
  • the physical address corresponding to the target node may be after the address space of each original node.
  • the address checking module 1508 is configured to check, by the basic input/output system, whether a physical address corresponding to the target node exists in a mapping relationship stored by the computer.
  • the address check module 1508 checks whether the physical address corresponding to the target node exists in the mapping relationship stored in the computer, and can directly perform the physical address on the target node when the physical address corresponding to the target node does not exist in the mapping relationship stored by the computer. Hot Addition; When there is a physical address corresponding to the target node in the mapping relationship of the computer storage, the target node is hot added by the address checking module 1508.
  • a third physical address obtaining module 1509 when the physical address corresponding to the target node exists in the mapping relationship stored by the computer, the basic input/output system acquires a physical address corresponding to the target node according to the mapping relationship.
  • the third physical address of the first unavailable memory when the physical address corresponding to the target node exists in the mapping relationship stored by the computer, the basic input/output system acquires a physical address corresponding to the target node according to the mapping relationship. The third physical address of the first unavailable memory.
  • the third migration module 1510 is configured to migrate, by the basic input/output system, data of the memory in which the third physical address is located to a memory in which the physical address corresponding to the target node is located.
  • the mapping relationship deleting module 1511 is configured to delete, by the basic input/output system, a mapping relationship of a physical address corresponding to the target node in the mapping relationship of the computer storage.
  • the memory migration implementation device provided in this embodiment can be combined with a corresponding computer through a BIOS. Hardware implementation, no longer here - repeat.
  • the device for implementing the memory migration migrates the data of the memory to be migrated to the first unavailable memory through the basic input/output system, and the memory to be migrated and the first unavailable memory are The mapping of physical addresses is stored to implement memory migration.
  • the first unusable memory is pre-converted, so that the technical solution provided by the embodiment of the present invention can save the process of initializing the first unavailable memory during memory migration, and solve the operation process of memory migration in the prior art. More complicated problems.
  • the method and apparatus for implementing memory migration provided by the embodiments of the present invention can be applied to a computer system under a common computer system and a NUMA architecture.
  • the software module can be placed in random access memory (RAM), memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or technical field. Any other form of storage medium known.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)
  • Memory System (AREA)

Description

内存迁移的实现方法和装置 技术领域
本发明涉及计算机技术, 尤其涉及一种内存迁移的实现方法和装置。 背景技术
内存作为计算机的重要组成部分之一, 其性能对计算机有非常大的 影响; 而随着服务器内存容量的急速增长, 内存的出错概率也大幅度增 加。 当内存发生错误时, 会导致业务中断或系统宕机, 造成用户的巨大 损失。 为了增强系统的容错率, 可以将多次发生错误的内存区域进行迁 移并隔离, 该情况通常为一个内存页或几个内存页粒度大小的迁移; 内 存迁移也可以降低系统的功耗, 该情况通常为大粒度的迁移, 通常可以 达到双列直插式存储模块( Dua卜 Inline_Mem。ry_M。dules, DIMM)条的 级别。
现有技术中, 实现内存迁移的具体过程包括: 当接收到操作系统 ( Operation System, OS ) 中的管理程序下发的内存迁移指令时, 系统 的相关控制器对备份内存进行初始化, 该初始化用于将备份内存和待迁 移内存的地址空间重新编址等, 使备份内存和待迁移内存的使用相同的 地址总线; 基本输入输出系统 ( Basic Input Output System, BIOS ) 将待迁移内存中的数据拷贝到备份内存中; 当拷贝完成时, 停用待迁移 内存并启用备份内存, 使 OS再次访问待迁移内存时, 可以直接通过原 来待迁移内存的物理地址访问备份内存中存储的数据。
现有技术每次迁移内存时, 都需要对备份内存进行初始化, 内存迁移 操作过程比较复杂。
发明内容
本发明的实施例提供一种内存迁移的实现方法和装置, 以通过简单的操 作过程实现内存迁移。
一方面, 提供了一种内存迁移的实现方法, 包括: 迁移待迁移内存时, 计算机的基本输入输出系统将所述待迁移内存的数据迁移至所述计算 机的操作系统的第一不可用内存中; 所述第一不可用内存为所述操作系 统的原有可用内存预先转换的, 对所述操作系统设为保留的, 所述操作 系统不可以修改和访问的内存; 所述基本输入输出系统将所述待迁移内 存与所述第一不可用内存的物理地址的映射关系进行存储。
另一方面, 提供了一种内存迁移的实现装置, 包括:
第一迁移模块, 用于迁移待迁移内存时, 计算机的基本输入输出系 统将所述待迁移内存的数据迁移至所述计算机的操作系统的第一不可 用内存中; 所述第一不可用内存为所述操作系统的原有可用内存预先转 换的, 对所述操作系统设为保留的, 所述操作系统不可以修改和访问的 内存;
存储模块, 用于所述基本输入输出系统将所述待迁移内存与所述第 一不可用内存的物理地址的映射关系进行存储。
本发明实施例提供的内存迁移的实现方法和装置, 迁移待迁移内存时, 通过基本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将 待迁移内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内 存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术 方案能够在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了 现有技术中内存迁移的操作过程比较复杂的问题。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见地, 下面 描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1为本发明实施例一提供的内存迁移的实现方法的流程图;
图 2为本发明实施例二提供的内存迁移的实现方法的流程图;
图 3为本发明实施例三提供的内存迁移的实现方法的流程图;
图 6为本发明实施例六提供的内存迁移的实现方法的流程图;
图 9为本发明实施例八提供的内存迁移的实现方法的流程图; 法的流程图;
法的流程图- 图 12为本发明实施例十提供的 4节点 NUMA架构系统的结构示意图;
Figure imgf000005_0001
图 15为本发明实施例十一提供的内存迁移的实现装置的结构示意图一; 图 16为本发明实施例十一提供的内存迁移的实现装置的结构示意图二; 图 17为图 15所示的内存迁移的实现装置中第一迁移模块的结构示意图; 图 18为图 15所示的内存迁移的实现装置中存储模块的结构示意图; 图 19为本发明实施例十一提供的内存迁移的实现装置的结构示意图三; 图 20为图 19所示的内存迁移的实现装置中第二迁移模块的结构示意图; 图 21为本发明实施例十一提供的内存迁移的实现装置的结构示意图四; 图 22为本发明实施例十一提供的内存迁移的实现装置的结构示意图五; 图 23为图 21所示的内存迁移的实现装置中访问模块的结构示意图; 图 24为本发明实施例十一提供的内存迁移的实现装置的结构示意图六。 具体实施方式
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案进行 清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实施例, 而 不是全部的实施例。 基于本发明中的实施例, 本领域普通技术人员在没有做 出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
为了解决现有技术内存迁移的操作过程比较复杂的问题, 本发明实施例 提供一种内存迁移的实现方法和装置。
如图 1所示, 本发明实施例一提供的内存迁移的实现方法, 包括: 步骤 101 , 迁移待迁移内存时, 计算机的基本输入输出系统将该待迁移内 存的数据迁移至该计算机的操作系统的第一不可用内存中。
在本实施例中, 通过步骤 101 将待迁移内存的数据迁移至计算机的操作 系统(Operation System, OS ) 的第一不可用内存中的过程, 可以为将待迁移 内存的数据拷贝到第一不可用内存中等, 在此不作限制; 其中, 第一不可用 内存可以为 OS的原有可用内存预先转换的, 对 OS设为保留的, OS不可以 ^ίι爹改和访问的内存。 BIOS可以在系统启动对内存编址生成 e820图时, 对内 存进行统一编址, 使一部分内存为 OS可用内存, 另一部分内存为 OS不可用 内存。
在本实施例中,由于计算机 OS的原有不可用内存经常被计算机原有进程 占用, 因此步骤 101中 OS的第一不可用内存, 可以是 OS的原有可用内存预 先转换的内存的一部分,也可以 OS通过其他方式新配置的内存的一部分, 在 此不再——贅述。 即: 将待迁移内存的数据迁移至 OS的第一不可用内存中, 可以为将待迁移内存的数据迁移至原有可用内存预先转换的内存中的任意位 置; 也可以为根据原有可用内存预先转换的内存的物理地址顺序, 依次将剩 余内存的数据迁移至原有可用内存预先转换的内存中等, 在此不再一一贅述。
在本实施例中, 步骤 101中待迁移内存, 可以是 OS中的管理程序发现某 内存发生多次错误时, 需要迁移并隔离的小粒度内存; 也可以是非一致访问
( Non Uniform Memory Access Achitecture, NUMA ) 架构中, 为了减少系统 功耗, 需要热移除的节点内存; 还可以是其他情况中需要迁移的内存, 在此 不再一一赘述。
步骤 102,基本输入输出系统将待迁移内存与第一不可用内存的物理地址 的映射关系进行存储。
在本实施例中, 步骤 102 中待迁移内存与第一不可用内存的物理地址的 映射关系, 可以是待迁移内存与第一不可用内存进行内存页对齐后的物理地 址的映射关系等, 在此不再——贅述。 其中, 该映射关系, 可以存储在计算 机的任意位置; 也可以存储在为映射关系单独设置的存储设备如闪存中; 还 可以使用其他方式存储该映射关系, 在此不再——贅述。
本实施例提供的内存迁移的实现方法,可以通过基本输入输出系统(Basic Input Output System, BIOS )结合相应的计算机硬件实现,在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 2所示, 本发明实施例二提供的内存迁移的实现方法, 包括: 步骤 201 ,基本输入输出系统对计算机的内存进行初始化,使该计算机中 原有可用内存中的部分内存转换为操作系统的不可用内存。
在本实施例中, 为了简化内存迁移的操作过程, 通过步骤 201 对计算机 的内存进行初始化的过程, 可以在计算机系统启动时进行; 通过步骤 201 对 计算机的内存进行初始化的过程, 可以通过对内存编址生成 e820图的方式实 现; 也可以通过其他方式实现, 在此不再——贅述。 步骤 201 中对计算机的 内存进行初始化, 既可以包括将该计算机中原有可用内存中的部分内存转换 为 OS的不可用内存, 也可以包括设置 OS的不可用内存的大小等, 在此不作 限制。 其中, 设置 OS的不可用内存的大小, 既可以为将 OS的不可用内存设 置为固定大小的内存; 也可以为将 OS 的不可用内存设置为大小可调节的内 存, 即在 BIOS中根据系统内存大小设置 OS的不可用内存的大小等。
步骤 202至步骤 203 ,将待迁移内存通过计算机的基本输入输出系统进行 迁移, 并将待迁移内存与第一不可用内存的物理地址的映射关系进行存储。
在本实施例中, 步骤 202至步骤 203 中第一不可用内存, 可以为通过步 骤 201转换得到的不可用内存的一部分, 在此不再——贅述。 步骤 202至步 骤 203的具体过程可以参考图 1所示的步骤 101至步骤 102,在此不再——贅 述。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 3所示, 本发明实施例三提供的内存迁移的实现方法, 包括: 步骤 301 ,基本输入输出系统对计算机的内存进行初始化, 具体过程可以 参考图 2所示的步骤 201 , 在此不再——贅述。
步骤 302 ,基本输入输出系统从操作系统的不可用内存中获取第一不可用 内存。 在本实施例中, 通过步骤 302从不可用内存中获取第一不可用内存, 可 以是 BIOS根据不可用内存的物理地址的顺序, 依次从不可用内存中获取待迁 移内存大小的第一不可用内存。
步骤 303 ,基本输入输出系统将待迁移内存的数据迁移至第一不可用内存 中。
在本实施例中, 通过步骤 303将待迁移内存的数据迁移至第一不可用内 存中的过程, 可以为将待迁移内存的数据拷贝到第一不可用内存中等, 在此 不作限制。
步骤 304,基本输入输出系统将待迁移内存与第一不可用内存的物理地址 的映射关系进行存储, 具体过程可以参考图 1所示的步骤 102, 在此不再—— 贅述。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 4所示, 本发明实施例四提供的内存迁移的实现方法, 包括: 步骤 401 ,计算机的基本输入输出系统将待迁移内存的数据迁移至第一不 可用内存中, 具体过程可以参考图 1所示的步骤 101 , 在此不再——贅述。
步骤 402, 基本输入输出系统将待迁移内存的物理地址进行内存页对齐, 得到第一物理地址。
步骤 403 ,基本输入输出系统将该第一物理地址和第一不可用内存的物理 地址的映射关系进行存储。
在本实施例中, 为了方便 OS后续使用剩余内存的数据, 可以首先通过步 骤 402将待迁移内存的物理地址进行对齐, 然后通过步骤 403存储对齐后的 剩余内存的物理地址与第一不可用内存的物理地址的映射关系。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 5所示, 本发明实施例五提供的内存迁移的实现方法, 包括: 步骤 501 ,计算机的操作系统将待迁移内存中操作系统可迁移内存的数据 迁移至该计算机的第一空闲内存中。
在本实施例中, 由于 OS可以实现部分内存的迁移, 而对于大多数内核态 内存不能实现迁移, 因此可以步骤 501 中操作系统可迁移内存可以包括: 大 量的用户态内存和 /或少量的内核态内存。
在本实施例中, 步骤 501 中第一空闲内存, 可以是当前计算机未被占用 的内存的一部分, 即: 将 OS可迁移内存的数据迁移至第一空闲内存中, 可以 为将 OS可迁移内存的数据迁移至当前计算机未被占用的内存中的任意位置; 也可以为根据当前计算机未被占用的内存的物理地址顺序,依次将 OS可迁移 内存的数据迁移至当前计算机未被占用的内存中等, 在此不再——贅述。
在本实施例中,步骤 501中将 OS可迁移内存的数据迁移至第一空闲内存 中, 可以包括: 首先 OS将所有引用 OS可迁移内存的进程进行睡眠; 其次 OS 在当前计算机未被占用的内存中分配一块内存, 即第一空闲内存, 并将 OS可迁移内存的数据迁移至该第一空闲内存中; 然后 OS删除 OS可迁移内 存对应的页表项, 并更新引用 OS可迁移内存的所有进程中的页表项,使其指 向第一空闲内存; 最后, OS重新唤醒睡眠的进程。 步骤 501也可以通过其他 方式将 OS可迁移内存的数据迁移至第一空闲内存中, 在此不作限制。 其中, OS在当前计算机未被占用的内存中分配一块内存, 既可以为预先设置的固定 大小的内存, 也可以为根据 OS可迁移内存的大小分配的内存,还可以为通过 其他方式分配的内存, 在此不再——赞述。
在本实施例中,通过步骤 501将 OS可迁移内存的数据迁移至第一空闲内 存中, 既可以直接将该 OS可迁移内存的数据迁移至第一空闲内存中; 也可以 首先查询该 OS可迁移内存是否正在被使用, 如果正在被使用, 将该 OS可迁 移内存的数据迁移至第一空闲内存中;还可以通过其他方式将 OS可迁移内存 的数据迁移至第一空闲内存中, 在此不再——贅述。
在本实施例中, 步骤 501中待迁移内存, 可以是 OS中的管理程序发现某 内存发生多次错误时, 需要迁移并隔离的小粒度内存; 也可以是 NUMA架构 中, 为了减少系统功耗, 需要热移除的节点内存; 还可以是其他情况中需要 迁移的内存, 在此不再——贅述。
步骤 502,计算机的基本输入输出系统将剩余内存的数据迁移至第二不可 用内存中。
在本实施例中,步骤 501中将 OS可迁移内存的数据迁移至第一空闲内存 是通过 OS实现的,而步骤 502中将剩余内存的数据迁移至第二不可用内存中 是通过 BIOS实现的; 为了将计算机系统的控制权由 OS转交给 BIOS, 可以 通过使 OS睡眠的方式实现, 也可以通过其他方式实现, 在此不再——贅述。 其中, 步骤 502中剩余内存可以是待迁移内存中除 OS可迁移内存外的内存。
在本实施例中, 通过步骤 501 将剩余内存的数据迁移至第二不可用内存 中的过程, 可以为将剩余内存的数据拷贝到第二不可用内存中等, 在此不作 限制; 其中, 第二不可用内存可以为第一不可用内存的一部分。
步骤 503 ,基本输入输出系统将剩余内存与第二不可用内存的物理地址的 映射关系进行存储。
在本实施例中, 通过步骤 503将剩余内存与第二不可用内存的物理地址 的映射关系进行存储的过程, 可以参考图 1所示的步骤 102, 在此不再——贅 述。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 通过计算机的 OS结合 BIOS 实现内存迁移, 提高了内存迁移的灵活性。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 6所示, 本发明实施例六提供的内存迁移的实现方法, 包括: 步骤 601 , 迁移待迁移内存时,操作系统从该待迁移内存中获取操作系统 支持迁移的操作系统可迁移内存。
在本实施例中, 由于 OS可以实现部分内存的迁移, 而对于大多数内核态 内存不能实现迁移, 因此步骤 601中 OS可迁移内存大多数为用户态内存, 也 可能包括少量的内核态内存。
在本实施例中, 通过步骤 601从待迁移内存中获取 OS支持迁移的 OS可 迁移内存, 既可以为 OS直接从待迁移内存中获取 OS可迁移内存; 也可以为 OS对待迁移内存进行判断, 然后根据判断结果从待迁移内存中获取的 OS可 迁移内存;还可以为 OS通过其他方式从待迁移内存中获取的 OS可迁移内存 , 在此不再一一赘述。
步骤 602,操作系统将引用该操作系统可迁移内存的所有进程进行睡眠处 理。
步骤 603 , 操作系统在计算机未被占用的内存中分配第一空闲内存。
在本实施例中, 通过步骤 603在计算机未被占用的内存中分配第一空闲 内存, 既可以是在计算机未被占用的内存的任意位置分配该第一空闲内存; 也可以是根据计算机未被占用的内存的物理地址顺序, 依次分配该第一空闲 内存等, 在此不再——贅述。
步骤 604, 操作系统将可迁移内存的数据拷贝到第一空闲内存中。
步骤 605, 操作系统删除操作系统可迁移内存对应的所有页表项。
步骤 606,操作系统将引用操作系统可迁移内存的所有进程的页表项进行 更新, 使更新后的相关页表项指向第一空闲内存。
步骤 607 , 操作系统唤醒进行睡眠处理的进程。
在本实施例中, 通过步骤 607可以唤醒步骤 602中进行睡眠处理的进程, 使这些进程可以继续执行相关操作。
步骤 608至步骤 609 ,基本输入输出系统将剩余内存的数据迁移至第一不 可用内存中, 并将剩余内存与第一不可用内存的物理地址的映射关系进行存 储。 具体过程可以参考图 5中步骤 502至步骤 503 , 在此不再——贅述。 本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 7所示, 本发明实施例七提供的内存迁移的实现方法, 包括: 步骤 701至步骤 702, 迁移待迁移内存时,基本输入输出系统将待迁移内 存的数据迁移至第一不可用内存中, 并将待迁移内存与第一不可用内存的物 理地址的映射关系进行存储。 具体过程可以参考图 1所示的步骤 101至步骤 102, 在此不再——贅述。
步骤 703 ,操作系统访问目标物理地址时, 判断计算机存储的映射关系中 是否存在该目标物理地址对应的映射关系。
在本实施例中, 通过步骤 702将待迁移内存与第一不可用内存的物理地 址的映射关系进行存储时, 如果计算机存储内容为待迁移内存与第一不可用 内存的原始物理地址的映射关系, 通过步骤 703 判断计算机存储的映射关系 中是否存在目标物理地址对应的映射关系的过程可以包括: 首先将计算机存 储的映射关系分别进行内存页对齐; 然后将第一不可用内存的物理地址进行 内存页对齐; 最后判断计算机存储的映射关系进行内存页对齐得到的映射关 系中是否存在第一不可用内存的物理地址进行内存页对齐得到的物理地址。 如果计算机存储内容为待迁移内存与第一不可用内存进行内存页对齐后的物 理地址的映射关系, 通过步骤 703 判断计算机存储的映射关系中是否存在目 标物理地址对应的映射关系的过程可以包括: 首先将目标物理地址进行内存 页对齐; 然后判断计算机存储的映射关系中是否存在目标物理地址进行内存 页对齐后得到的物理地址。 步骤 703也可以通过其他方式判断计算机存储的 映射关系中是否存在目标物理地址对应的映射关系, 在此不再——贅述。
在本实施例中, 如果通过步骤 703 判断出计算机存储的映射关系中不存 在目标物理地址对应的映射关系, 即不需要进行地址转换, OS可以直接访问 目标物理地址所在的内存; 如计算机存储的映射关系中存在目标物理地址对 应的映射关系, OS可以通过步骤 704访问目标物理地址转换后的内存。
步骤 704, 该目标物理地址对应的映射关系存在时,操作系统根据该目标 物理地址对应的映射关系访问第一不可用内存的数据。
在本实施例中, 通过步骤 703 判断计算机存储的映射关系中是否存在目 标物理地址对应的映射关系时, 如果该计算机存储的映射关系为剩余内存与 第一不可用内存的原始物理地址的映射关系, 通过步骤 704根据该目标物理 地址对应的映射关系访问第一不可用内存的数据的具体过程可以包括: 首先 将待迁移内存的原始物理地址进行内存页对齐, 得到该待迁移内存的偏移量; 然后操作系统根据目标物理地址对应的映射关系获取目标物理地址相应的第 一不可用内存的第二物理地址; 操作系统根据偏移量与第二物理地址之和访 问第一不可用内存的数据。 如果该计算机存储的映射关系为剩余内存与第一 不可用内存已内存页对齐后的物理地址的映射关系, 通过步骤 704根据该目 标物理地址对应的映射关系访问第一不可用内存的数据的具体过程可以包 括: 首先 OS获取目标物理地址的偏移量; 然后 OS根据目标物理地址对应的 映射关系获取目标物理地址相应的第一不可用内存的第二物理地址; OS根据 偏移量与第二物理地址之和访问第一不可用内存的数据。
为了优化步骤 703 中判断计算机存储的映射关系中是否存在该目标物理 地址对应的映射关系的过程, 进一步的, 如图 8 所示, 本实施例提供的内存 迁移的实现方法, 还可以包括:
步骤 705 , 判断该目标物理地址所在的内存为用户态内存还是内核态内 存。
在本实施例中, 由于用户态内存对于 OS来说是可以迁移的, 而内核态内 存对于 OS来说是不可以迁移的, 只能通过 BIOS将内核态内存进行迁移, 并 系表中的映射关系获取该内核态内存迁移后的内存位置,而对于 OS迁移用户 态内存来说, 可以直接通过更新后的页表项进行访问; 因此, 为了简化步骤 703中的判断过程,可以首先通过步骤 705判断目标物理地址所在的内存为用 户态内存还是内核态内存, 使该目标物理地址所在的内存为用户态内存时, 直接通过页表项进行访问; 而该目标物理地址所在的内存为内核态内存时, 再通过步骤 703 重新判断映射关系表中是否存在该目标物址已存页对齐后的 地址的映射关系。
此时, 步骤 703 为, 目标物理地址所在的内存为内核态内存时, 判断计 算机存储的映射关系中是否存在目标物理地址对应的映射关系。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 9所示, 本发明实施例八提供的内存迁移的实现方法, 包括: 步骤 901至步骤 902, 迁移待迁移内存时,基本输入输出系统将待迁移内 存的数据迁移至第一不可用内存中, 并将待迁移内存与第一不可用内存的物 理地址的映射关系进行存储。 具体过程可以参考图 1所示的步骤 101至步骤 102, 在此不再——贅述。
步骤 903 ,对目标节点进行热添加时,基本输入输出系统对目标节点 进行内存编址, 得到目标节点对应的物理地址。
在本实施例中, 通过步骤 903对目标节点进行内存编址, 可以使目 标节点为原来热移除的节点时, 目标节点对应的物理地址不变; 目标节 点不为原来热移除的节点时, 目标节点对应的物理地址可以处于原来各 个节点的地址空间后。
步骤 904 , 基本输入输出系统检查计算机存储的映射关系中是否存 在目标节点对应的物理地址。
在本实施例中, 通过步骤 904检查计算机存储的映射关系中是否存 在目标节点对应的物理地址, 可以使计算机存储的映射关系中不存在目 标节点对应的物理地址时, 直接对目标节点进行热添加; 计算机存储的 映射关系中存在目标节点对应的物理地址时, 通过步骤 905对目标节点 进行热添力口。 步骤 905 , 计算机存储的映射关系中存在目标节点对应的物理地址 时,基本输入输出系统根据映射关系获取目标节点对应的物理地址相应 的第一不可用内存的第三物理地址。
步骤 906 , 基本输入输出系统将第三物理地址所在的内存的数据迁 移到目标节点对应的物理地址所在的内存中。
步骤 907,基本输入输出系统删除计算机存储的映射关系中目标节点 对应的物理地址的映射关系。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术
Figure imgf000015_0001
装置进行具体说明。
如图 10所示, 本发明实施例九提供的内存迁移的实现方法, 包括: 以下以待迁移内存为 OS中的管理程序发现某些内存发生多次错误时,需 要迁移并隔离的小粒度内存为例进行说明。
步骤 1001 , 基本输入输出系统对计算机的内存进行初始化, 使该计算机 中操作系统的原有可用内存中的部分内存转换为操作系统的不可用内存。
在本实施例中, 为了简化内存迁移的操作过程, 通过步骤 1001对计算机 的内存进行初始化的过程, 可以在计算机系统启动时进行; 通过步骤 1001对 计算机的内存进行初始化的过程, 可以通过对内存编址生成 e820图的方式实 现; 也可以通过其他方式实现, 在此不再——贅述。 步骤 1001中对计算机的 内存进行初始化, 既可以包括将该计算机中原有可用内存中的部分内存转换 为 OS的不可用内存, 也可以包括设置 OS的不可用内存的大小等, 在此不作 限制。 其中, 设置 OS的不可用内存的大小, 既可以为将 OS的不可用内存设 置为固定大小的内存; 也可以为将 OS 的不可用内存设置为大小可调节的内 存, 即在 BIOS中根据系统内存大小设置 OS的不可用内存的大小等。
在本实施例中, 由于 OS对内存的管理单位为内存页, 因此 OS的不可用 内存的大小应该为内存页的整数倍, 并且内存迁移中, 也应该以内存页为单 位进行迁移。
步骤 1002, 迁移待迁移内存时, 操作系统判断该待迁移内存是否空闲。 在本实施例中, 通过步骤 1002判断出待迁移内存空闲时, 系统可以直接 返回, 即不需要对该待迁移内存进行迁移; 通过步骤 1002判断出待迁移内存 正在被使用时, 可以通过步骤 1003对该待迁移内存进行处理。
步骤 1003 , 如果待迁移内存正在被使用, 操作系统判断其是否支持迁移 该待迁移内存类型的内存。
在本实施例中, 通过步骤 1003判断 OS是否支持迁移该待迁移内存类型 的内存, 如果不支持, 系统可以直接返回; 如果支持, 可以通过步骤 1004获 取 OS可迁移内存。
步骤 1004, 操作系统支持待迁移内存类型的内存时, 从该待迁移内存中 获取操作系统支持迁移的操作系统可迁移内存。
在本实施例中, 由于 OS可以实现部分内存的迁移, 而对于大多数内核态 内存不能实现迁移, 因此步骤 1004中 OS可迁移内存大多数为用户态内存, 也可能包括少量的内核态内存。
在本实施例中, 通过步骤 1004从待迁移内存中获取 OS支持迁移的 OS 可迁移内存, 既可以为 OS直接从待迁移内存中获取 OS可迁移内存; 也可以 为 OS对待迁移内存进行判断, 然后根据判断结果从待迁移内存中获取的 OS 可迁移内存; 还可以为 OS通过其他方式从待迁移内存中获取的 OS可迁移内 存, 在此不再一一赘述。
步骤 1005 , 操作系统将引用该操作系统可迁移内存的所有进程进行睡眠 处理。
步骤 1006, 操作系统在计算机未被占用的内存中分配第一空闲内存。 在本实施例中, 通过步骤 1006在计算机未被占用的内存中分配第一空闲 内存, 既可以是在计算机未被占用的内存的任意位置分配该第一空闲内存; 也可以是根据计算机未被占用的内存的物理地址顺序, 依次分配该第一空闲 内存等, 在此不再——贅述。
步骤 1007, 操作系统将可迁移内存的数据拷贝到第一空闲内存中。
步骤 1008, 操作系统删除操作系统可迁移内存对应的所有页表项。
步骤 1009, 操作系统将引用操作系统可迁移内存的所有进程的页表项进 行更新, 使更新后的相关页表项指向第一空闲内存。
步骤 1010, 操作系统唤醒进行睡眠处理的进程。
步骤 1011 , 操作系统判断待迁移内存是否迁移成功。
在本实施例中, 步骤 1011中待迁移内存迁移成功, 指将待迁移内存全部 拷贝到系统的其他内存中; 如果只是部分拷贝, 说明待迁移内存的迁移失败。 通过步骤 1011判断出待迁移内存的迁移成功时, 直接返回; 失败时, 通过步 骤 1012将计算机系统的控制权由 OS转交给 BIOS。
步骤 1012, 操作系统睡眠, 将控制权转交给 BIOS接管。
步骤 1013 , 基本输入输出系统从操作系统不可用内存中获取第一不可用 内存。
在本实施例中, 通过步骤 1013从 OS不可用内存中获取第一不可用内存, 可以是 BIOS根据 0S不可用内存的物理地址的顺序, 依次从 0S不可用内存中 获取待迁移内存大小的第一不可用内存。
在本实施例中,通过步骤 1013从 OS不可用内存中获取第一不可用内存, 如果获取失败, 即 OS不可用内存已用完, BIOS提示用户此次内存迁移失败; 如果获取成功,通过步骤 1014将待迁移内存的数据迁移至第一不可用内存中。
步骤 1014, 基本输入输出系统将待迁移内存的数据迁移至第一不可用内 存中。
在本实施例中, 通过步骤 1014将待迁移内存的数据迁移至第一不可用内 存中的过程, 可以为将待迁移内存的数据拷贝到第一不可用内存中等, 在此 不作限制。
步骤 1015,基本输入输出系统将待迁移内存的物理地址进行内存页对齐, 得到第一物理地址。
在本实施例中, 步骤 1015中待迁移内存的物理地址可以被记录在计算机 的存储设备中, 也可以被记录在计算机的其他位置, 在此不再——贅述。
步骤 1016, 基本输入输出系统将该第一物理地址和第一不可用内存的物 理地址的映射关系进行存储。
在本实施例中, 为了方便 OS后续使用剩余内存的数据, 可以首先通过步 骤 1015将待迁移内存的物理地址进行对齐, 然后通过步骤 1016存储对齐后 的剩余内存的物理地址与第一不可用内存的物理地址的映射关系。
步骤 1017, 待迁移内存的迁移结束时, 基本输入输出系统将系统的控制 权重新交由操作系统接管。
步骤 1018, 操作系统访问目标物理地址时, 判断计算机存储的映射关系 中是否存在该目标物理地址对应的映射关系。
在本实施例中, 如果通过步骤 1018判断计算机存储的映射关系中不存在 目标物理地址对应的映射关系, 系统可以不经过地址转换, 直接访问目标物 理地址所在的内存的内容; 如果存在, 可以通过步骤 1019获取目标物理地址 的偏移量。
步骤 1019, 操作系统获取目标物理地址的偏移量。
步骤 1020, 操作系统根据所述目标物理地址对应的映射关系获取所述目 标物理地址相应的所述第一不可用内存的第二物理地址。
步骤 1021 , 操作系统根据所述偏移量与所述第二物理地址之和访问所述 第一不可用内存的数据。
在本实施例中,待迁移内存可以 OS中的管理程序下发的命令中, 物理地 址所在的待迁移内存; 也可以是用户手动输入需要迁移内存的虚拟地址, 根 据虚拟地址获取其相应的待迁移内存; 该待迁移内存一般以一个内存页为单 位。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 11所示, 本发明实施例十提供的内存迁移的实现方法, 包括: 以下以待迁移内存为 NUMA架构中, 为了减少系统功耗, 需要对节点内 存进行热移除为例进行说明。
步骤 1101 , 基本输入输出系统对计算机的内存进行初始化, 使该计算机 中操作系统的原有可用内存中的部分内存转换为操作系统的不可用内存。
在本实施例中, 如图 12所示, 以 4节点的 NUMA架构为例进行说明, NUMA架构中每个节点均包括中央处理器、 输入输出设备和内存等。 由于节 点 0—般设置为主节点, 运行整个系统的 OS, 因此不可以热移除。 通过步骤 1101 将原有可用内存中的部分内存转换为操作系统的不可用内存, 可以设置 节点 1中内存为 OS不可用内存;为了方便其他节点查找迁移到节点 1中的数 据, 可以将节点 1的内存分为两部分, 分别对应节点 2和节点 3中 OS不可迁 移内存。
步骤 1102, 操作系统将待迁移内存中操作系统可迁移内存的数据迁移至 该计算机的第一空闲内存中。
在本实施例中, 步骤 1102中第一空闲内存, 可以是除热移除节点外其他 负荷较轻的节点。 步骤 1102将 OS可迁移内存的数据迁移至第一空闲内存的 过程, 可以参考图 5所示的步骤 501 , 在此不再——贅述。
步骤 1103 , BIOS将剩余内存的数据迁移至第二不可用内存中, 具体过程 可以参考图 5所示的步骤 502, 在此不再——贅述。
步骤 1104, 将剩余内存与第二不可用内存的物理地址的映射关系进行存 储, 具体过程可以参考图 5所示的步骤 503 , 在此不再——贅述。
步骤 1105, 待迁移内存的迁移完成时, 将待迁移内存所在节点的其他设 备进行热移除。
进一步的, 本实施例提供的内存迁移的实现方法, 还可以对节点进行热 添加, 如图 13所示, 包括:
步骤 1301 , 对目标节点进行热添加时, 基本输入输出系统对目标节点进 行内存编址, 得到目标节点对应的物理地址。
在本实施例中, 通过步骤 1301对目标节点进行内存编址, 可以使目标节 点为原来热移除的节点时, 目标节点对应的物理地址不变; 目标节点不为原 来热移除的节点时, 目标节点对应的物理地址可以处于原来各个节点的地址 空间后。 步骤 1302, 基本输入输出系统检查计算机存储的映射关系中是否存在目 标节点对应的物理地址。
在本实施例中, 通过步骤 1302检查计算机存储的映射关系中是否存在目 标节点对应的物理地址, 可以使计算机存储的映射关系中不存在目标节点对 应的物理地址时, 直接对目标节点进行热添加; 计算机存储的映射关系中存 在目标节点对应的物理地址时, 通过步骤 905对目标节点进行热添加。
步骤 1303 , 计算机存储的映射关系中存在目标节点对应的物理地址时, 基本输入输出系统根据映射关系获取目标节点对应的物理地址相应的第一不 可用内存的第三物理地址。
步骤 1304, 基本输入输出系统将第三物理地址所在的内存的数据迁移到 目标节点对应的物理地址所在的内存中。
步骤 1305 , 基本输入输出系统删除计算机存储的映射关系中目标节点对 应的物理地址的映射关系。
进一步的, 本实施例提供的内存迁移的实现方法, 还可以进行跨节点访 问, 如图 14所示, 包括:
以下以节点 0中的中央处理器访问节点 2中的内存为例进行说明, 其他 跨节点访问过程与下述过程类似, 在此不再——贅述。
步骤 1401 , 节点 0向节点 2发送需要访问节点 2的地址信号。
步骤 1402, 通过地址信号判断节点 2是否被热移除。
在本实施例中, 如果通过步骤 1402判断出节点 2未被热移除, 可以节点 0可以直接访问节点 2中的内存;如果判断出节点 2被热移除,通过步骤 1403 获取计算机中存储的映射关系。
步骤 1403 , 获取计算机中存储的映射关系。
步骤 1404, 根据计算机存储的映射关系, 将地址信号进行地址转换后访 问节点 2中的内存。
在本实施例中, 如果本节点的中央处理器要访问本节点的内存时, 系统 可以直接访问, 在此不再——贅述。
本实施例提供的内存迁移的实现方法,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现方法, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
如图 15所示, 本发明实施例十一提供的内存迁移的实现装置, 包括: 第一迁移模块 1501 , 用于迁移待迁移内存时, 计算机的基本输入输出系 统将所述待迁移内存的数据迁移至计算机的操作系统的第一不可用内存中; 所述第一不可用内存为操作系统的原有可用内存预先转换的, 对操作系统设 为保留的, 操作系统不可以修改和访问的内存。
在本实施例中, 通过第一迁移模块 1501将待迁移内存的数据迁移至计算 机的 OS的第一不可用内存中的过程, 可以为将待迁移内存的数据拷贝到第一 不可用内存中等, 在此不作限制; 其中, 第一不可用内存可以为原有可用内 存预先转换的。 BIOS可以在系统启动对内存编址生成 e820 图时, 对内存进 行统一编址,使一部分内存为 OS可用内存,另一部分内存为 OS不可用内存。
在本实施例中, 由于计算机原有不可用内存经常被计算机原有进程占用, 因此第一迁移模块 1501中第一不可用内存, 可以是原有可用内存预先转换的 内存的一部分, 也可以 0S通过其他方式新配置的内存的一部分, 在此不再一 一贅述。 即: 将待迁移内存的数据迁移至第一不可用内存中, 可以为将待迁 移内存的数据迁移至原有可用内存预先转换的内存中的任意位置; 也可以为 根据原有可用内存预先转换的内存的物理地址顺序, 依次将剩余内存的数据 迁移至原有可用内存预先转换的内存中等, 在此不再——贅述。
在本实施例中, 第一迁移模块 1501 中待迁移内存, 可以是 0S 中的管理 程序发现某内存发生多次错误时, 需要迁移并隔离的小粒度内存; 也可以是 NUMA架构中, 为了减少系统功耗, 需要热移除的节点内存; 还可以是其他情 况中需要迁移的内存, 在此不再——贅述。
存储模块 1502 , 用于所述基本输入输出系统将所述待迁移内存与所述第 一不可用内存的物理地址的映射关系进行存储。
在本实施例中, 存储模块 1502中待迁移内存与第一不可用内存的物理地 址的映射关系, 可以是待迁移内存与第一不可用内存进行内存页对齐后的物 理地址的映射关系等, 在此不再——贅述。 其中, 该映射关系, 可以存储在 计算机的任意位置; 也可以存储在为映射关系单独设置的存储设备如闪存中; 还可以使用其他方式存储该映射关系, 在此不再——贅述。
进一步的,如图 16所示, 本实施例中内存迁移的实现装置,还可以包括: 初始化模块 1500, 用于所述基本输入输出系统对所述计算机的内存进行 初始化, 使所述计算机中原有可用内存中的部分内存转换为操作系统的不可 用内存。
在本实施例中, 为了简化内存迁移的操作过程, 通过初始化模块 1500对 计算机的内存进行初始化的过程, 可以在计算机系统启动时进行; 通过初始 化模块 1500 对计算机的内存进行初始化的过程, 可以通过对内存编址生成 e820 图的方式实现; 也可以通过其他方式实现, 在此不再——贅述。 初始化 模块 1500中对计算机的内存进行初始化, 既可以包括将该计算机中原有可用 内存中的部分内存转换为 OS的不可用内存, 也可以包括设置 OS的不可用内 存的大小等, 在此不作限制。 其中, 设置 OS的不可用内存的大小, 既可以为 将 OS的不可用内存设置为固定大小的内存; 也可以为将 OS的不可用内存设 置为大小可调节的内存, 即在 BIOS中根据系统内存大小设置 OS的不可用内 存的大小等。
此时, 如图 17所示, 本实施例中第一迁移模块 1501 , 可以包括: 第一内存获取子模块 15011 ,用于所述基本输入输出系统从所述操作系统 不可用内存中获取所述第一不可用内存。
在本实施例中, 通过第一内存获取子模块 15011从 0S不可用内存中获取 第一不可用内存, 可以是 BIOS根据 0S不可用内存的物理地址的顺序, 依次 从 0S不可用内存中获取待迁移内存大小的第一不可用内存。
迁移子模块 15012 ,用于所述基本输入输出系统将所述待迁移内存的数据 迁移至所述第一不可用内存中。
在本实施例中, 通过迁移子模块 15012 将待迁移内存的数据迁移至第一 不可用内存中的过程, 可以为将待迁移内存的数据拷贝到第一不可用内存中 等, 在此不作限制。
进一步的, 如图 18所示, 本实施例中存储模块 1502 , 可以包括: 内存页对齐子模块 15021 ,用于所述基本输入输出系统将所述待迁移内存 的物理地址进行内存页对齐, 得到第一物理地址。
存储子模块 15022 ,用于所述基本输入输出系统将所述第一物理地址和所 述第一不可用内存的物理地址的映射关系进行存储。
在本实施例中, 为了方便 OS后续使用剩余内存的数据, 可以首先通过内 存页对齐子模块 15021 将待迁移内存的物理地址进行对齐, 然后通过存储子 模块 15022存储对齐后的剩余内存的物理地址与第一不可用内存的物理地址 的映射关系。
进一步的,如图 19所示, 本实施例中内存迁移的实现装置,还可以包括: 第二迁移模块 1503 , 用于所述计算机的操作系统将所述待迁移内存中操 作系统可迁移内存的数据迁移至所述计算机的第一空闲内存中。
在本实施例中, 由于 OS可以实现部分内存的迁移, 而对于大多数内核态 内存不能实现迁移, 因此可以第二迁移模块 1503中操作系统可迁移内存可以 包括: 大量的用户态内存和 /或少量的内核态内存。
在本实施例中, 第二迁移模块 1503中第一空闲内存, 可以是当前计算机 未被占用的内存的一部分, 即: 将 OS可迁移内存的数据迁移至第一空闲内存 中,可以为将 OS可迁移内存的数据迁移至当前计算机未被占用的内存中的任 意位置; 也可以为根据当前计算机未被占用的内存的物理地址顺序, 依次将 OS可迁移内存的数据迁移至当前计算机未被占用的内存中等, 在此不再—— 贅述。
在本实施例中, 第二迁移模块 1503中将 OS可迁移内存的数据迁移至第 一空闲内存中, 可以包括: 首先 OS将所有引用 OS可迁移内存的进程进行睡 Θ民;其次 OS在当前计算机未被占用的内存中分配一块内存,即第一空闲内存, 并将 OS可迁移内存的数据迁移至该第一空闲内存中; 然后 OS删除 OS可迁 移内存对应的页表项, 并更新引用 OS可迁移内存的所有进程中的页表项,使 其指向第一空闲内存; 最后, OS 重新唤醒睡眠的进程。 第二迁移模块 1503 也可以通过其他方式将 OS可迁移内存的数据迁移至第一空闲内存中,在此不 作限制。 其中, OS在当前计算机未被占用的内存中分配一块内存, 既可以为 预先设置的固定大小的内存, 也可以为根据 OS 可迁移内存的大小分配的内 存, 还可以为通过其他方式分配的内存, 在此不再——贅述。
在本实施例中, 通过第二迁移模块 1503将 OS可迁移内存的数据迁移至 第一空闲内存中,既可以直接将该 OS可迁移内存的数据迁移至第一空闲内存 中; 也可以首先查询该 OS可迁移内存是否正在被使用, 如果正在被使用, 将 该 OS可迁移内存的数据迁移至第一空闲内存中; 还可以通过其他方式将 OS 可迁移内存的数据迁移至第一空闲内存中, 在此不再——贅述。
此时, 所述第一迁移模块 1501 , 用于所述计算机的基本输入输出系统将 剩余内存的数据迁移至第二不可用内存中, 所述剩余内存为所述待迁移内存 中除所述操作系统可迁移内存外的内存, 所述第二不可用内存为所述第一不 可用内存的一部分。
该第二迁移模块 1503 , 如图 20所示, 包括:
第二内存获取子模块 15031 ,用于所述操作系统从所述待迁移内存中获取 所述操作系统支持迁移的操作系统可迁移内存。
在本实施例中, 由于 OS可以实现部分内存的迁移, 而对于大多数内核态 内存不能实现迁移,因此第二内存获取子模块 15031中 OS可迁移内存大多数 为用户态内存, 也可能包括少量的内核态内存。
在本实施例中, 通过第二内存获取子模块 15031从待迁移内存中获取 OS 支持迁移的 OS可迁移内存, 既可以为 OS直接从待迁移内存中获取 OS可迁 移内存; 也可以为 OS对待迁移内存进行判断, 然后根据判断结果从待迁移内 存中获取的 OS可迁移内存; 还可以为 OS通过其他方式从待迁移内存中获取 的 OS可迁移内存, 在此不再——贅述。
睡眠处理子模块 15032 ,用于所述操作系统将引用所述操作系统可迁移内 存的所有进程进行睡眠处理。
内存分配子模块 15033 ,用于所述操作系统在所述计算机未被占用的内存 中分配所述第一空闲内存。
在本实施例中, 通过内存分配子模块 15033在计算机未被占用的内存中 分配第一空闲内存, 既可以是在计算机未被占用的内存的任意位置分配该第 一空闲内存; 也可以是根据计算机未被占用的内存的物理地址顺序, 依次分 配该第一空闲内存等, 在此不再——贅述。
内存拷贝子模块 15034 ,用于所述操作系统将所述操作系统可迁移内存的 数据拷贝到所述第一空闲内存中。
页表项删除子模块 15035 ,用于所述操作系统删除所述操作系统可迁移内 存对应的所有页表项。
页表项更新子模块 15036 ,用于所述操作系统将引用所述操作系统可迁移 内存的所有进程的页表项进行更新, 使更新后的页表项指向所述第一空闲内 存。
唤醒子模块 15037 , 用于所述操作系统唤醒进行所述睡眠处理的进程。 进一步的,如图 21所示, 本实施例中内存迁移的实现装置,还可以包括: 控制模块 1504 , 用于所述操作系统访问目标物理地址时, 判断所述计算 机存储的映射关系中是否存在所述目标物理地址对应的映射关系。
在本实施例中, 通过存储模块 1502将待迁移内存与第一不可用内存的物 理地址的映射关系进行存储时, 如果计算机存储内容为待迁移内存与第一不 可用内存的原始物理地址的映射关系, 通过控制模块 1504判断计算机存储的 映射关系中是否存在目标物理地址对应的映射关系的过程可以包括: 首先将 计算机存储的映射关系分别进行内存页对齐; 然后将第一不可用内存的物理 地址进行内存页对齐; 最后判断计算机存储的映射关系进行内存页对齐得到 的映射关系中是否存在第一不可用内存的物理地址进行内存页对齐得到的物 理地址。 如果计算机存储内容为待迁移内存与第一不可用内存进行内存页对 齐后的物理地址的映射关系, 通过控制模块 1504判断计算机存储的映射关系 中是否存在目标物理地址对应的映射关系的过程可以包括: 首先将目标物理 地址进行内存页对齐; 然后判断计算机存储的映射关系中是否存在目标物理 地址进行内存页对齐后得到的物理地址。 控制模块 1504也可以通过其他方式 判断计算机存储的映射关系中是否存在目标物理地址对应的映射关系, 在此 不再一一赘述。
在本实施例中, 如果通过控制模块 1504判断出计算机存储的映射关系中 不存在目标物理地址对应的映射关系, 即不需要进行地址转换, OS可以直接 访问目标物理地址所在的内存; 如计算机存储的映射关系中存在目标物理地 址对应的映射关系, OS可以通过访问模块 1505访问目标物理地址转换后的 内存。
访问模块 1505 , 用于所述目标物理地址对应的映射关系存在时, 所述操 作系统根据所述目标物理地址对应的映射关系访问所述第一不可用内存的数 据。 在本实施例中, 通过控制模块 1504判断计算机存储的映射关系中是否存 在目标物理地址对应的映射关系时, 如果该计算机存储的映射关系为剩余内 存与第一不可用内存的原始物理地址的映射关系, 通过访问模块 1505根据该 目标物理地址对应的映射关系访问第一不可用内存的数据的具体过程可以包 括: 首先将待迁移内存的原始物理地址进行内存页对齐, 得到该待迁移内存 的偏移量; 然后操作系统根据目标物理地址对应的映射关系获取目标物理地 址相应的第一不可用内存的第二物理地址; 操作系统根据偏移量与第二物理 地址之和访问第一不可用内存的数据。 如果该计算机存储的映射关系为剩余 内存与第一不可用内存已内存页对齐后的物理地址的映射关系, 通过访问模 块 1505根据该目标物理地址对应的映射关系访问第一不可用内存的数据的具 体过程可以包括: 首先 OS获取目标物理地址的偏移量; 然后 OS根据目标物 理地址对应的映射关系获取目标物理地址相应的第一不可用内存的第二物理 地址; OS根据偏移量与第二物理地址之和访问第一不可用内存的数据。
此时, 所述内存迁移的实现装置, 如图 22所示, 还可以包括: 内存判断模块 1506 , 用于判断所述目标物理地址所在的内存为用户态内 存还是内核态内存。
在本实施例中, 由于用户态内存对于 OS来说是可以迁移的, 而内核态内 存对于 OS来说是不可以迁移的, 只能通过 BIOS将内核态内存进行迁移, 并 系表中的映射关系获取该内核态内存迁移后的内存位置,而对于 OS迁移用户 态内存来说, 可以直接通过更新后的页表项进行访问; 因此, 为了简化内存 控制模块 1504 中的判断过程, 可以首先通过内存判断模块 1506判断目标物 理地址所在的内存为用户态内存还是内核态内存, 使该目标物理地址所在的 内存为用户态内存时, 直接通过页表项进行访问; 而该目标物理地址所在的 内存为内核态内存时, 再通过内存判断模块 1506重新判断映射关系表中是否 存在该目标物址已存页对齐后的地址的映射关系。
所述控制模块 1504 , 用于所述目标物理地址所在的内存为所述内核态内 存时, 判断所述计算机存储的映射关系中是否存在所述目标物理地址对应的 映射关系。
此时, 该访问模块 1505 , 如图 23所示, 可以包括: 偏移量获取子模块 15051 ,用于所述操作系统获取所述目标物理地址的偏 移量。
第二物理地址获取子模块 15052 ,用于所述操作系统根据所述目标物理地 址对应的映射关系获取所述目标物理地址相应的所述第一不可用内存的第二 物理地址。
访问子模块 15053 ,用于所述操作系统根据所述偏移量与所述第二物理地 址之和访问所述第一不可用内存的数据。
进一步的,如图 24所示, 本实施例中内存迁移的实现装置,还可以包括: 地址获取模块 1507 , 用于对目标节点进行热添加时, 所述基本输入输出 系统对所述目标节点进行内存编址, 得到所述目标节点对应的物理地址。
在本实施例中, 通过地址获取模块 1507对目标节点进行内存编址, 可以使目标节点为原来热移除的节点时, 目标节点对应的物理地址不 变; 目标节点不为原来热移除的节点时, 目标节点对应的物理地址可以 处于原来各个节点的地址空间后。
地址检查模块 1508 , 用于所述基本输入输出系统检查所述计算机存储的 映射关系中是否存在所述目标节点对应的物理地址。
在本实施例中, 通过地址检查模块 1508检查计算机存储的映射关系 中是否存在目标节点对应的物理地址, 可以使计算机存储的映射关系中 不存在目标节点对应的物理地址时, 直接对目标节点进行热添加; 计算 机存储的映射关系中存在目标节点对应的物理地址时, 通过地址检查模 块 1508对目标节点进行热添加。
第三物理地址获取模块 1509 , 用于所述计算机存储的映射关系中存在所 述目标节点对应的物理地址时, 所述基本输入输出系统根据所述映射关系获 取所述目标节点对应的物理地址相应的所述第一不可用内存的第三物理地 址。
第三迁移模块 1510 , 用于所述基本输入输出系统将所述第三物理地址所 在的内存的数据迁移到所述目标节点对应的物理地址所在的内存中。
映射关系删除模块 1511 , 用于所述基本输入输出系统删除所述计算机存 储的映射关系中所述目标节点对应的物理地址的映射关系。
本实施例提供的内存迁移的实现装置,可以通过 BIOS结合相应的计算机 硬件实现, 在此不再——贅述。
本发明实施例提供的内存迁移的实现装置, 迁移待迁移内存时, 通过基 本输入输出系统将待迁移内存的数据迁移至第一不可用内存中, 并将待迁移 内存与第一不可用内存的物理地址的映射关系进行存储, 从而实现内存迁移。 由于第一不可用内存是预先转换的, 使得本发明实施例提供的技术方案能够 在内存迁移时, 省去对第一不可用内存进行初始化的过程, 解决了现有技术 中内存迁移的操作过程比较复杂的问题。
本发明实施例提供的内存迁移的实现方法和装置, 可以应用在普通计算 机系统和 NUMA架构下的计算机系统中。
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬 件、 或者硬件与处理器执行的软件模块的结合来实施。 软件模块可以置于 随机存储器 (RAM )、 内存、 只读存储器 (ROM )、 电可编程 ROM、 电可 擦除可编程 ROM、 寄存器、 硬盘、 可移动磁盘、 CD-ROM、 或技术领域内 所公知的任意其它形式的存储介质中。
以上所述,仅为本发明的具体实施方式, 但本发明的保护范围并 不局限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术 范围内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围之 内。 因此, 本发明的保护范围应所述以权利要求的保护范围为准。

Claims

权利 要求 书
1、 一种内存迁移的实现方法, 其特征在于, 包括:
迁移待迁移内存时,计算机的基本输入输出系统将所述待迁移内存的 数据迁移至所述计算机的操作系统的第一不可用内存中; 所述第一不可用 内存为所述操作系统的原有可用内存预先转换的,对所述操作系统设为保 留的, 所述操作系统不可以修改和访问的内存;
所述基本输入输出系统将所述待迁移内存与所述第一不可用内存的 物理地址的映射关系进行存储。
2、 根据权利要求 1 所述的内存迁移的实现方法, 其特征在于, 在所 述计算机的基本输入输出系统将所述待迁移内存的数据迁移至所述计算 机的操作系统的第一不可用内存中之前, 所述方法还包括:
所述基本输入输出系统对所述计算机的内存进行初始化,使所述计算 机中原有可用内存中的部分内存转换为所述操作系统的不可用内存。
3、 根据权利要求 2 所述的内存迁移的实现方法, 其特征在于, 所述 计算机的基本输入输出系统将所述待迁移内存的数据迁移至所述计算机 的操作系统的第一不可用内存中, 包括:
所述基本输入输出系统从所述操作系统的不可用内存中获取所述第 一不可用内存;
所述基本输入输出系统将所述待迁移内存的数据迁移至所述第一不 可用内存中。
4、 根据权利要求 1 所述的内存迁移的实现方法, 其特征在于, 所述 基本输入输出系统将所述待迁移内存与所述第一不可用内存的物理地址 的映射关系进行存储, 包括:
所述基本输入输出系统将所述待迁移内存的物理地址进行内存页对 齐, 得到第一物理地址;
所述基本输入输出系统将所述第一物理地址和所述第一不可用内存 的物理地址的映射关系进行存储。
5、 根据权利要求 1 所述的内存迁移的实现方法, 其特征在于, 在所 述计算机的基本输入输出系统将所述待迁移内存的数据迁移至所述计算 机的操作系统的第一不可用内存中之前, 所述方法还包括: 所述计算机的操作系统将所述待迁移内存中操作系统可迁移内存的 数据迁移至所述计算机的第一空闲内存中;
所述算机的基本输入输出系统将所述待迁移内存的数据迁移至所述 计算机的操作系统的第一不可用内存中为: 所述计算机的基本输入输出系 统将剩余内存的数据迁移至所述计算机的操作系统的第二不可用内存中, 所述剩余内存为所述待迁移内存中除所述操作系统可迁移内存外的内存, 所述第二不可用内存为所述第一不可用内存的一部分。
6、 根据权利要求 5 所述的内存迁移的实现方法, 其特征在于, 所述 计算机的操作系统将所述待迁移内存中操作系统可迁移内存的数据迁移 至所述计算机的第一空闲内存中, 包括:
所述操作系统从所述待迁移内存中获取所述操作系统支持迁移的操 作系统可迁移内存;
所述操作系统将引用所述操作系统可迁移内存的所有进程进行睡眠 处理;
所述操作系统在所述计算机未被占用的内存中分配所述第一空闲内 存;
所述操作系统将所述操作系统可迁移内存的数据拷贝到所述第一空 闲内存中;
所述操作系统删除所述操作系统可迁移内存对应的所有页表项; 所述操作系统将引用所述操作系统可迁移内存的所有进程的页表项 进行更新, 使更新后的页表项指向所述第一空闲内存;
所述操作系统唤醒进行所述睡眠处理的进程。
7、 根据权利要求 1 所述的内存迁移的实现方法, 其特征在于, 还包 括:
所述操作系统访问目标物理地址时,判断所述计算机存储的映射关系 中是否存在所述目标物理地址对应的映射关系;
所述目标物理地址对应的映射关系存在时,所述操作系统根据所述目 标物理地址对应的映射关系访问所述第一不可用内存的数据。
8、 根据权利要求 7 所述的内存迁移的实现方法, 其特征在于, 在所 述判断所述计算机存储的映射关系中是否存在所述目标物理地址对应的 映射关系之前, 所述方法还包括:
判断所述目标物理地址所在的内存为用户态内存还是内核态内存; 所述判断所述计算机存储的映射关系中是否存在所述目标物理地址 对应的映射关系为: 所述目标物理地址所在的内存为所述内核态内存时, 判断所述计算机存储的映射关系中是否存在所述目标物理地址对应的映 射关系。
9、 根据权利要求 7 所述的内存迁移的实现方法, 其特征在于, 所述 操作系统根据所述目标物理地址对应的映射关系访问所述第一不可用内 存的数据, 包括:
所述操作系统获取所述目标物理地址的偏移量;
所述操作系统根据所述目标物理地址对应的映射关系获取所述目标 物理地址相应的所述第一不可用内存的第二物理地址;
所述操作系统根据所述偏移量与所述第二物理地址之和访问所述第 一不可用内存的数据。
1 0、 根据权利要求 1所述的内存迁移的实现方法, 其特征在于, 所述 待迁移内存为非一致访问架构下的节点内存时, 所述方法还包括:
对目标节点进行热添加时,所述基本输入输出系统对所述目标节点进 行内存编址, 得到所述目标节点对应的物理地址;
所述基本输入输出系统检查所述计算机存储的映射关系中是否存在 所述目标节点对应的物理地址;
所述计算机存储的映射关系中存在所述目标节点对应的物理地址时, 所述基本输入输出系统根据所述映射关系获取所述目标节点对应的物理 地址相应的所述第一不可用内存的第三物理地址;
所述基本输入输出系统将所述第三物理地址所在的内存的数据迁移 到所述目标节点对应的物理地址所在的内存中;
所述基本输入输出系统删除所述计算机存储的映射关系中所述目标 节点对应的物理地址的映射关系。
1 1、 一种内存迁移的实现装置, 其特征在于, 包括:
第一迁移模块, 用于迁移待迁移内存时, 计算机的基本输入输出系统 将所述待迁移内存的数据迁移至所述计算机的操作系统的第一不可用内 存中; 所述第一不可用内存为所述操作系统的原有可用内存预先转换的, 对所述操作系统设为保留的, 所述操作系统不可以修改和访问的内存; 存储模块,用于所述基本输入输出系统将所述待迁移内存与所述第一 不可用内存的物理地址的映射关系进行存储。
12、 根据权利要求 1 1 所述的内存迁移的实现装置, 其特征在于, 还 包括:
初始化模块,用于所述基本输入输出系统对所述计算机的内存进行初 始化,使所述计算机中原有可用内存中的部分内存转换为所述操作系统的 不可用内存。
1 3、 根据权利要求 12 所述的内存迁移的实现装置, 其特征在于, 所 述第一迁移模块, 包括:
第一内存获取子模块,用于所述基本输入输出系统从所述操作系统的 不可用内存中获取所述第一不可用内存;
迁移子模块,用于所述基本输入输出系统将所述待迁移内存的数据迁 移至所述第一不可用内存中。
14、 根据权利要求 1 1 所述的内存迁移的实现装置, 其特征在于, 所 述存储模块, 包括:
内存页对齐子模块,用于所述基本输入输出系统将所述待迁移内存的 物理地址进行内存页对齐, 得到第一物理地址;
存储子模块,用于所述基本输入输出系统将所述第一物理地址和所述 第一不可用内存的物理地址的映射关系进行存储。
15、 根据权利要求 1 1 所述的内存迁移的实现装置, 其特征在于, 还 包括:
第二迁移模块,用于所述计算机的操作系统将所述待迁移内存中操作 系统可迁移内存的数据迁移至所述计算机的第一空闲内存中;
所述第一迁移模块,用于所述计算机的基本输入输出系统将剩余内存 的数据迁移至第二不可用内存中,所述剩余内存为所述待迁移内存中除所 述操作系统可迁移内存外的内存,所述第二不可用内存为所述第一不可用 内存的一部分。
16、 根据权利要求 15 所述的内存迁移的实现装置, 其特征在于, 所 述第二迁移模块, 包括:
第二内存获取子模块,用于所述操作系统从所述待迁移内存中获取所 述操作系统支持迁移的操作系统可迁移内存;
睡眠处理子模块,用于所述操作系统将引用所述操作系统可迁移内存 的所有进程进行睡眠处理;
内存分配子模块,用于所述操作系统在所述计算机未被占用的内存中 分配所述第一空闲内存;
内存拷贝子模块,用于所述操作系统将所述操作系统可迁移内存的数 据拷贝到所述第一空闲内存中;
页表项删除子模块,用于所述操作系统删除所述操作系统可迁移内存 对应的所有页表项;
页表项更新子模块,用于所述操作系统将引用所述操作系统可迁移内 存的所有进程的页表项进行更新,使更新后的页表项指向所述第一空闲内 存;
唤醒子模块, 用于所述操作系统唤醒进行所述睡眠处理的进程。
17、 根据权利要求 1 1 所述的内存迁移的实现装置, 其特征在于, 还 包括:
控制模块, 用于所述操作系统访问目标物理地址时, 判断所述计算机 存储的映射关系中是否存在所述目标物理地址对应的映射关系;
访问模块, 用于所述目标物理地址对应的映射关系存在时, 所述操作 系统根据所述目标物理地址对应的映射关系访问所述第一不可用内存的 数据。
18、 根据权利要求 17 所述的内存迁移的实现装置, 其特征在于, 还 包括:
内存判断模块,用于判断所述目标物理地址所在的内存为用户态内存 还是内核态内存;
所述控制模块,用于所述目标物理地址所在的内存为所述内核态内存 时,判断所述计算机存储的映射关系中是否存在所述目标物理地址对应的 映射关系。
19、 根据权利要求 17 所述的内存迁移的实现装置, 其特征在于, 所 述访问模块, 包括:
偏移量获取子模块,用于所述操作系统获取所述目标物理地址的偏移 量;
第二物理地址获取子模块,用于所述操作系统根据所述目标物理地址 对应的映射关系获取所述目标物理地址相应的所述第一不可用内存的第 二物理地址;
访问子模块,用于所述操作系统根据所述偏移量与所述第二物理地址 之和访问所述第一不可用内存的数据。
2 0、 根据权利要求 1 1 所述的内存迁移的实现装置, 其特征在于, 所 述待迁移内存为非一致访问架构下的节点内存时, 还包括:
地址获取模块, 用于对目标节点进行热添加时, 所述基本输入输出系 统对所述目标节点进行内存编址, 得到所述目标节点对应的物理地址; 地址检查模块,用于所述基本输入输出系统检查所述计算机存储的映 射关系中是否存在所述目标节点对应的物理地址;
第三物理地址获取模块,用于所述计算机存储的映射关系中存在所述 目标节点对应的物理地址时,所述基本输入输出系统根据所述映射关系获 取所述目标节点对应的物理地址相应的所述第一不可用内存的第三物理 地址;
第三迁移模块,用于所述基本输入输出系统将所述第三物理地址所在 的内存的数据迁移到所述目标节点对应的物理地址所在的内存中;
映射关系删除模块,用于所述基本输入输出系统删除所述计算机存储 的映射关系中所述目标节点对应的物理地址的映射关系。
PCT/CN2011/077748 2011-07-28 2011-07-28 内存迁移的实现方法和装置 WO2012083695A1 (zh)

Priority Applications (8)

Application Number Priority Date Filing Date Title
PCT/CN2011/077748 WO2012083695A1 (zh) 2011-07-28 2011-07-28 内存迁移的实现方法和装置
KR1020137024310A KR101534540B1 (ko) 2011-07-28 2011-07-28 메모리 이동을 실행하는 방법 및 장치
CN2011800011693A CN102326149B (zh) 2011-07-28 2011-07-28 内存迁移的实现方法和装置
JP2014501397A JP5712451B2 (ja) 2011-07-28 2011-07-28 メモリ移行を実施するための方法およびデバイス
BR112013021548A BR112013021548A2 (pt) 2011-07-28 2011-07-28 método e dispositivo para implementação de migração de memória
AU2011348835A AU2011348835B2 (en) 2011-07-28 2011-07-28 Method and device for implementing memory migration
EP11851937.0A EP2664990A4 (en) 2011-07-28 2011-07-28 METHOD AND DEVICE FOR PERFORMING MEMORY MIGRATION
US14/035,545 US9600202B2 (en) 2011-07-28 2013-09-24 Method and device for implementing memory migration

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/077748 WO2012083695A1 (zh) 2011-07-28 2011-07-28 内存迁移的实现方法和装置

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US14/035,545 Continuation US9600202B2 (en) 2011-07-28 2013-09-24 Method and device for implementing memory migration

Publications (1)

Publication Number Publication Date
WO2012083695A1 true WO2012083695A1 (zh) 2012-06-28

Family

ID=45453086

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/077748 WO2012083695A1 (zh) 2011-07-28 2011-07-28 内存迁移的实现方法和装置

Country Status (8)

Country Link
US (1) US9600202B2 (zh)
EP (1) EP2664990A4 (zh)
JP (1) JP5712451B2 (zh)
KR (1) KR101534540B1 (zh)
CN (1) CN102326149B (zh)
AU (1) AU2011348835B2 (zh)
BR (1) BR112013021548A2 (zh)
WO (1) WO2012083695A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104375899A (zh) * 2014-11-21 2015-02-25 北京应用物理与计算数学研究所 高性能计算机numa感知的线程和内存资源优化方法与系统
CN103914403B (zh) * 2014-04-28 2016-11-02 中国科学院微电子研究所 一种混合内存访问情况的记录方法及其系统
CN110546623A (zh) * 2017-04-24 2019-12-06 超威半导体公司 静默活动页面迁移错误

Families Citing this family (23)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2014059613A1 (zh) 2012-10-17 2014-04-24 华为技术有限公司 降低内存系统功耗的方法和内存控制器
US9497266B2 (en) * 2013-02-22 2016-11-15 International Business Machines Corporation Disk mirroring for personal storage
JP5439620B1 (ja) * 2013-05-07 2014-03-12 株式会社 ディー・エヌ・エー 電子コンテンツを推奨するシステム
CN107219999B (zh) 2013-08-31 2020-06-26 华为技术有限公司 一种服务器中内存模块的数据迁移方法及服务器
US9854036B2 (en) * 2013-09-30 2017-12-26 Huawei Technologies Co., Ltd. Method for migrating memory data of virtual machine, and related apparatus and cluster system
CN105353980B (zh) * 2013-11-22 2019-10-22 华为技术有限公司 一种内存数据的迁移方法、计算机和装置
CN103842968B (zh) * 2013-11-22 2015-11-25 华为技术有限公司 一种内存数据的迁移方法、计算机和装置
ES2612829T3 (es) 2013-11-22 2017-05-18 Huawei Technologies Co., Ltd. Ordenador y método de migración de datos de memoria
CN104917784B (zh) * 2014-03-10 2018-06-05 华为技术有限公司 一种数据迁移方法、装置及计算机系统
CN103927233A (zh) * 2014-04-30 2014-07-16 无锡云动科技发展有限公司 多节点内存互联装置及一种大规模计算机集群
CN104156322B (zh) * 2014-08-05 2017-10-17 华为技术有限公司 一种缓存管理方法及缓存管理装置
CN105468538B (zh) 2014-09-12 2018-11-06 华为技术有限公司 一种内存迁移方法及设备
US10430221B2 (en) * 2015-09-28 2019-10-01 Red Hat Israel, Ltd. Post-copy virtual machine migration with assigned devices
CN105260321B (zh) * 2015-11-11 2018-07-20 浪潮(北京)电子信息产业有限公司 一种改进型内存域划分方法
US20170161203A1 (en) * 2015-12-03 2017-06-08 Intel Corporation Increased memory capacity
US10069697B2 (en) * 2016-01-29 2018-09-04 Microsoft Technology Licensing, Llc Routing actions to user devices based on a user graph
KR20180027656A (ko) * 2016-09-05 2018-03-15 에스케이하이닉스 주식회사 반도체장치 및 반도체시스템
CN106713462A (zh) * 2016-12-26 2017-05-24 郑州云海信息技术有限公司 一种网络数据包处理方法和装置
CN109299021B (zh) * 2017-07-24 2023-06-16 阿里巴巴集团控股有限公司 页迁移方法、装置和中央处理器
CN109240816B (zh) * 2018-08-30 2020-11-10 世纪龙信息网络有限责任公司 系统方案切换方法、装置、计算机设备和存储介质
CN109117416B (zh) * 2018-09-27 2020-05-26 贵州华芯通半导体技术有限公司 插槽间的数据迁移或交换的方法和装置以及多处理器系统
CN109388629B (zh) * 2018-09-29 2021-04-27 武汉斗鱼网络科技有限公司 一种数组规整方法、装置、终端及可读介质
CN113868151A (zh) 2019-05-16 2021-12-31 华为技术有限公司 配置镜像内存的方法、装置及计算机存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581082A (zh) * 2003-08-14 2005-02-16 国际商业机器公司 用于便携运行的操作系统的系统和方法
CN101218557A (zh) * 2005-07-05 2008-07-09 国际商业机器公司 用于存储器迁移的系统和方法
CN101819542A (zh) * 2009-02-26 2010-09-01 佛山市顺德区汉达精密电子科技有限公司 硬盘开机扇区异常时的开机方法与使用该方法之电脑装置

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5862314A (en) * 1996-11-01 1999-01-19 Micron Electronics, Inc. System and method for remapping defective memory locations
US6397349B2 (en) * 1998-10-13 2002-05-28 Agere Systems Guardian Corp. Built-in self-test and self-repair methods and devices for computer memories comprising a reconfiguration memory device
US7103728B2 (en) 2002-07-23 2006-09-05 Hewlett-Packard Development Company, L.P. System and method for memory migration in distributed-memory multi-processor systems
JP4096660B2 (ja) * 2002-08-22 2008-06-04 カシオ計算機株式会社 データ記録制御装置及びプログラム
US7047438B2 (en) * 2002-11-21 2006-05-16 Hitachi Global Storage Technologies Netherlands B.V. Accommodation of media defect growth on a data storage medium through dynamic remapping
US7321990B2 (en) * 2003-12-30 2008-01-22 Intel Corporation System software to self-migrate from a faulty memory location to a safe memory location
US8806103B2 (en) * 2004-04-28 2014-08-12 Hewlett-Packard Development Company, L.P. System and method for interleaving memory
US7478268B2 (en) 2005-09-13 2009-01-13 International Business Machines Corporation Deallocation of memory in a logically-partitioned computer
JP2007122259A (ja) * 2005-10-26 2007-05-17 Toshiba Corp 情報処理装置、およびそのメモリ制御方法
US7549034B2 (en) 2005-11-10 2009-06-16 International Business Machines Corporation Redistribution of memory to reduce computer system power consumption
JP2008033588A (ja) * 2006-07-28 2008-02-14 Hitachi Ltd 情報処理装置
CN102081552A (zh) * 2009-12-01 2011-06-01 华为技术有限公司 一种物理机到虚拟机的在线迁移方法、装置和系统
US8219851B2 (en) * 2009-12-29 2012-07-10 Intel Corporation System RAS protection for UMA style memory
CN101818542A (zh) 2010-04-07 2010-09-01 湖南大学 一种内置空间桁架钢骨的混凝土梁

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581082A (zh) * 2003-08-14 2005-02-16 国际商业机器公司 用于便携运行的操作系统的系统和方法
CN101218557A (zh) * 2005-07-05 2008-07-09 国际商业机器公司 用于存储器迁移的系统和方法
CN101819542A (zh) * 2009-02-26 2010-09-01 佛山市顺德区汉达精密电子科技有限公司 硬盘开机扇区异常时的开机方法与使用该方法之电脑装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103914403B (zh) * 2014-04-28 2016-11-02 中国科学院微电子研究所 一种混合内存访问情况的记录方法及其系统
CN104375899A (zh) * 2014-11-21 2015-02-25 北京应用物理与计算数学研究所 高性能计算机numa感知的线程和内存资源优化方法与系统
CN110546623A (zh) * 2017-04-24 2019-12-06 超威半导体公司 静默活动页面迁移错误
CN110546623B (zh) * 2017-04-24 2023-11-07 超威半导体公司 以计算系统中迁移页面为目标的转换请求的静默重试请求

Also Published As

Publication number Publication date
EP2664990A4 (en) 2014-01-22
JP2014509763A (ja) 2014-04-21
JP5712451B2 (ja) 2015-05-07
BR112013021548A2 (pt) 2016-11-01
CN102326149B (zh) 2013-09-25
US9600202B2 (en) 2017-03-21
KR20130127511A (ko) 2013-11-22
US20140052948A1 (en) 2014-02-20
AU2011348835B2 (en) 2016-03-24
CN102326149A (zh) 2012-01-18
AU2011348835A1 (en) 2013-09-05
KR101534540B1 (ko) 2015-07-07
EP2664990A1 (en) 2013-11-20

Similar Documents

Publication Publication Date Title
WO2012083695A1 (zh) 内存迁移的实现方法和装置
US10983955B2 (en) Data unit cloning in memory-based file systems
US10210012B2 (en) Techniques for persistent memory virtualization
US9183157B2 (en) Method for creating virtual machine, a virtual machine monitor, and a virtual machine system
JP6224253B2 (ja) フラッシュメモリ内に記憶されたデータの推測的プリフェッチ
US8966188B1 (en) RAM utilization in a virtual environment
KR102275563B1 (ko) 호스트-관리 비휘발성 메모리
EP2581828B1 (en) Method for creating virtual machine, virtual machine monitor and virtual machine system
KR101910759B1 (ko) 트랜잭션 처리 방법, 장치 및 컴퓨터 시스템
US11176032B2 (en) Memory system and method of controlling nonvolatile memory
US20120311240A1 (en) Information processing apparatus, information processing method, and storage medium
US9141304B2 (en) Storage device and method for controlling storage device
US20150220452A1 (en) System, Method and Computer-Readable Medium for Dynamically Mapping a Non-Volatile Memory Store
TW202042065A (zh) 資料儲存裝置及邏輯至物理位址映射表之載入方法
US20170277632A1 (en) Virtual computer system control method and virtual computer system
JP2013539111A (ja) キャッシングに対応したストレージ装置上における効率的なシーケンシャルロギングのためのシステム及び方法
WO2014063329A1 (zh) 共享闪存的方法、控制器及系统
US10831684B1 (en) Kernal driver extension system and method
US10983818B2 (en) Method and system for preventing execution of a dirty virtual machine on an undesirable host server in a virtualization cluster environment
JP2018502379A5 (zh)
TWI715116B (zh) 資料儲存裝置及其刪除命名空間之方法
JP6788566B2 (ja) コンピューティングシステム及びその動作方法
TWI564803B (zh) 用於儲存虛擬化的系統和方法
US20240176539A1 (en) Novel data cache scheme for high performance flash memories
Kim et al. Fsync-aware multi-buffer FTL for improving the fsync latency with open-channel SSDs

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201180001169.3

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11851937

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 2011851937

Country of ref document: EP

ENP Entry into the national phase

Ref document number: 2011348835

Country of ref document: AU

Date of ref document: 20110728

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 20137024310

Country of ref document: KR

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 2014501397

Country of ref document: JP

Kind code of ref document: A

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112013021548

Country of ref document: BR

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 112013021548

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20130823