WO2024016751A1 - 内存分配方法、装置及计算机 - Google Patents

内存分配方法、装置及计算机 Download PDF

Info

Publication number
WO2024016751A1
WO2024016751A1 PCT/CN2023/088113 CN2023088113W WO2024016751A1 WO 2024016751 A1 WO2024016751 A1 WO 2024016751A1 CN 2023088113 W CN2023088113 W CN 2023088113W WO 2024016751 A1 WO2024016751 A1 WO 2024016751A1
Authority
WO
WIPO (PCT)
Prior art keywords
memory
software
reliability
particle
group
Prior art date
Application number
PCT/CN2023/088113
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 华为技术有限公司
Publication of WO2024016751A1 publication Critical patent/WO2024016751A1/zh

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]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • 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/023Free address space management
    • 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]

Definitions

  • the present application relates to computer technology, and specifically to a memory allocation method, device and computer.
  • High storage density means that the storage space of the memory stick increases while the size of the memory stick remains unchanged or even decreases.
  • the feature size of the memory stick manufacturing process is getting smaller and smaller. The reduction in feature size increases the storage density of the memory stick, but also increases the failure rate of the memory stick.
  • the memory sticks connected by multiple memory channels are usually interleaved into one memory address space, in which the storage spaces of the memory sticks connected by different memory channels are evenly scattered into This memory address space allows the processor to simultaneously utilize the multiple memory channels and memory for information exchange when running software particles.
  • a memory allocation method, device and computer are provided, which can ensure the operational stability of software particles requiring high reliability.
  • a memory allocation method is provided.
  • the method is applied to a computer.
  • the computer includes a processor capable of running a variety of software particles and multiple memory sticks.
  • the multiple memory sticks constitute multiple independent memory groups, and One memory stick only belongs to one group, and the reliability of each memory group is negatively related to the number of memory sticks that make up the memory group;
  • the method includes: based on the reliability requirements of the software particles for the memory and the reliability of multiple memory groups , allocate a memory group for running the software particle to the software particle, and the reliability of the memory group allocated for the software is not lower than the reliability requirements of the software; for example, allocate a memory group for running the first software particle to As for the memory group of software particles, the reliability of the memory group allocated to the first software is not lower than the reliability requirements of the software.
  • multiple independent memory groups means that the address segments of multiple memory groups do not overlap or have no overlapping parts.
  • Different software particles may have different reliability requirements. Among them, the reliability requirements of the software particles may refer to the reliability requirements of the software particles for the memory.
  • the software particles can be allocated to memory groups that meet their reliability requirements.
  • software particles that require high reliability can be allocated to high-reliability memory groups, so that the processor can use high-reliability memory to run software particles that require high reliability, ensuring the stable operation of software particles that require high reliability. sex.
  • the processor calls the storage space of all memory banks in the memory group allocated for the first software particle to run the first software particle.
  • the address segments of all memory banks in the same memory group constitute the address segment of the memory group.
  • the address segments of different memory banks can be interleaved with each other.
  • the address segment of the memory group is divided into multiple sub-address segments, and each sub-address segment includes part of the address segments of all memory banks in the memory group, so that when the processor accesses a sub-address while running the software particle During this period, all memory modules in the memory group can be accessed at the same time, thus avoiding excessive load on a certain memory module.
  • the processor accesses all memory banks at the same time, which can effectively utilize the memory channels between the memory banks and the processor to increase the data transfer rate.
  • the maximum bandwidth memory group whose reliability meets the reliability requirements of the software particles is allocated to the software particles, so that when the reliability requirements of the software particles are met, the processor and The communication rate between memory banks is maximized, thereby ensuring the performance of the processor running software particles.
  • the address segment of the memory group with the largest bandwidth is lower than the address segments of other memory groups, and the other memory groups are memory groups other than the memory group with the largest bandwidth among at least two memory groups.
  • large-bandwidth memory groups can be allocated to software particles on a priority basis without changing the existing general memory allocation mechanism, while the reliability requirements of the software particles can be met.
  • the existing general memory allocation mechanism is to allocate memory space to software particles in order from low to high address segments, that is, the memory space in low address segments is allocated to software particles first.
  • the large-bandwidth memory group is set in the low address segment, and the small-bandwidth memory group is set in the high address segment, so that the large-bandwidth memory group can be allocated to the software particles first.
  • the method further includes: allocating a memory group for running the second software particle to the second software particle, wherein the reliability of the memory group allocated to the second software particle is not lower than that of the second software particle. Reliability requirements for the second software particle, wherein the memory group allocated to the second software particle is the same as or different from the memory group allocated to the first software particle.
  • the memory group when the reliability of the memory group meets the reliability requirements of two or more software particles at the same time, the memory group can be allocated to the two or more software particles, thereby avoiding Waste of memory group storage space.
  • the plurality of software particles include a first software particle and a second software particle, where the reliability requirements of the second software particle on the memory are lower than the reliability requirements of the first software particle on the memory, And the reliability of the first memory group among the plurality of memory groups meets the reliability requirements of the first software particle for the memory; the method also includes: when the space of the first memory group is larger than the space required by the first software particle Next, the first memory group is allocated to the first software particle and the second software particle for common use.
  • This implementation method can enable software particles with low reliability requirements to be allocated to high-reliability memory groups when the space of the high-reliability memory group is greater than the space requirements of the software particles with high reliability requirements, thereby avoiding high reliability. While wasting space in the reliability memory bank, it can also improve the operational stability of software particles with low reliability requirements.
  • the address segment of the memory group is associated with a reliability level, and the reliability level is used to indicate the reliability of the memory group; the first software particle is allocated a memory group for running the first software particle.
  • the method includes: allocating a memory group to the first software particle according to the reliability requirements of the first software particle and the address segments of the multiple memory groups.
  • the address segment of the memory group not only represents the memory group, but also indicates the reliability of the memory group. Therefore, when allocating the memory group to the software particles, the reliability can be determined according to the address segment of the memory group. A memory bank that meets the reliability requirements of a software particle is assigned to the software particle.
  • the software particle is any one of a program, a process, and a thread.
  • memory groups can be allocated at the granularity of programs, processes or threads, and memory groups can be allocated at different granularities to meet different memory group allocation requirements.
  • a memory allocation device which is configured in a computer.
  • the computer includes a processor capable of running a variety of software particles and multiple memory sticks.
  • the multiple memory sticks constitute multiple independent memory groups, and one memory stick The memory stick only belongs to one group, and the reliability of each memory group is negatively related to the number of memory sticks that make up the memory group;
  • the device includes: an acquisition unit for acquiring the reliability requirements of the first software particle; an allocation unit for Based on the reliability requirements of the first software particle, allocate a memory group for running the first software particle to the first software particle, wherein the reliability of the memory group allocated to the first software particle is not lower than that of the first software particle reliability requirements.
  • different memory groups have different bandwidths; the allocation unit is used to ensure that the reliability of at least two memory groups among multiple memory groups satisfies the reliability of the first software particle among multiple software particles. If performance requirements are met, the memory group with the largest bandwidth among at least two memory groups will be allocated to the first software particle first.
  • the allocation unit is also used to: allocate a memory group for running the second software particle to the second software particle, where the reliability of the memory group allocated to the second software particle is not low.
  • the memory group allocated to the second software particle is the same as or different from the memory group allocated to the first software particle.
  • the plurality of software particles include a first software particle and a second software particle, where the reliability requirements of the second software particle on the memory are lower than the reliability requirements of the first software particle on the memory, and The reliability of the first memory group among the multiple memory groups meets the reliability requirements of the first software particle for memory; the allocation unit is used to: when the space of the first memory group is greater than the space required by the first software particle, The first memory group is allocated to the first software particle and the second software particle for common use.
  • the address segment of the memory group is associated with a reliability level, and the reliability level is used to indicate the reliability of the memory group; the allocation unit is used to: according to the reliability requirements of the first software particle for the memory and The address segments of multiple memory groups allocate a memory group to the first software particle.
  • a computer including a processor for executing the method provided in the first aspect and a plurality of memory sticks.
  • a computer-readable storage medium including computer program instructions.
  • the computing device executes the method provided in the first aspect.
  • a computer program product containing instructions is provided.
  • the instructions When the instructions are executed by a computer device, the computer device executes the method provided in the first aspect.
  • the memory allocation method, device and computer provided can allocate a software particle to a memory group that meets the reliability requirements of the software particle, so that the software particle can run in a memory group that meets the reliability requirements of the software particle, thereby ensuring high performance. Reliability requires the operational stability of software particles.
  • Figure 1A is a schematic structural diagram of a computer
  • Figure 1B is a schematic diagram of multiple memory sticks interleaved into an interleaving domain
  • Figure 2 is a schematic structural diagram of a computer provided by an embodiment of the present application.
  • Figure 3 is a flow chart of a memory allocation scheme provided by an embodiment of the present application.
  • Figure 4A is a schematic diagram of the reliability of a memory group provided by an embodiment of the present application.
  • Figure 4B is a schematic structural diagram of a computer provided by an embodiment of the present application.
  • Figure 4C is a schematic diagram of memory group address segment distribution provided by an embodiment of the present application.
  • Figure 5 is a flow chart of a memory allocation method provided by an embodiment of the present application.
  • Figure 6 is a schematic structural diagram of a memory allocation device provided by an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a computer provided by an embodiment of the present application.
  • first and second are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, features defined as “first” and “second” may explicitly or implicitly include one or more of these features.
  • the terms “including,” “includes,” “having,” and variations thereof all mean “including but not limited to,” unless otherwise specifically emphasized.
  • Memory is also called main memory or primary storage.
  • DIMM dual inline memory module, dual in-line memory module.
  • Memory is a key component of the computer. Memory capacity, bandwidth, Performance such as reliability has an important impact on computer performance. In particular, large computers such as servers and storage arrays require large-capacity memory. Among them, memory capacity refers to the size of the memory storage space. Memory bandwidth refers to the memory and processing The maximum rate or theoretical rate of information exchange between processors. The reliability of the memory refers to the memory failure rate. The lower the memory failure rate, the higher the memory reliability. Among them, the memory failure rate refers to the memory failure rate. Probability
  • the computer's memory can include multiple physical memory banks.
  • the physical memory module can be referred to as a memory module.
  • Multiple memory sticks can be connected to the processor through multiple memory channels, where each memory stick is connected to the processor through one memory channel.
  • a memory channel refers to a communication line between a memory stick and a processor, which is used by the processor to access the storage space of the memory stick.
  • the memory of the computer 100 is composed of a memory bar 111, a memory bar 112, a memory bar 113 and a memory bar 114.
  • the memory stick 111 is connected to the processor 120 through the memory channel 131
  • the memory stick 112 is connected to the processor 120 through the memory channel 132
  • the memory stick 113 is connected to the processor 120 through the memory channel 133
  • the memory stick 114 is connected to the processor through the memory channel 134. 120 is connected.
  • the memory bar 111, the memory bar 112, the memory bar 113 and the memory bar 114 are interleaved into a memory address space, and then the processor 120 utilizes the memory address space to run all software grains on the computer 100.
  • Interleaving refers to staggered stacking or arrangement. Interleaving of multiple memory sticks refers to interleaving multiple address segments of memory sticks with multiple address segments of other memory sticks to evenly disperse multiple memory sticks into one memory address space. .
  • the capacities of the memory sticks 111, 112, 113 and 114 are all set to 32GB. In this way, the memory sticks 111, The total capacity of the memory address space obtained by interleaving the memory bar 112, the memory bar 113 and the memory bar 114 is 128GB.
  • Memory stick 111, memory stick 112, memory stick 113 and memory stick 114 can be interleaved with a granularity of 256 bytes (byte), that is, each continuous 1024-byte address segment in the memory address space is composed of this memory stick 111 It consists of a 256-byte address segment in the memory bank 112, a 256-byte address segment in the memory bank 113, and a 256-byte address segment in the memory bank 114.
  • the processor 120 accesses a continuous 1024-byte address segment, the processor 120 can simultaneously access the 1024-byte address segment from the memory channel 131, the memory channel 132, the memory channel 133, and the memory channel 134, thereby Increase the rate at which the processor 120 accesses memory.
  • each continuous 1024-byte address segment includes the address segments of four memory banks
  • the failure of any one of the four memory banks can cause each continuous 1024-byte address segment to The byte address segment contains a fault, so that the processor 120 inevitably accesses the faulty address segment, causing the software particles to run unstable.
  • the fault is an uncorrected error and the software particle is the operating system
  • problems such as restarting the computer 100 will occur, causing the operation of all software particles in the computing 100 to be interrupted, seriously affecting the business continuity of the computer 100.
  • the embodiments of this application provide a memory allocation solution that can ensure the stable operation of key software particles and thereby ensure the continuity of computer business.
  • multiple memory sticks in the computer can be divided into multiple independent memory groups with different levels of reliability. Then, according to the memory reliability requirements of each software particle in the computer and the reliability of multiple memory groups, high-reliability memory groups can be assigned to software particles with high memory reliability requirements, and low-reliability memories can be assigned to Groups are assigned to software particles that have low memory reliability requirements.
  • the computer can call the memory group allocated to the software particle and run the software particle. Among them, the operating system or operating system kernel, and other key software particles have high requirements on memory reliability. Therefore, high-reliability memory groups can be allocated to ensure that these key software particles can run stably.
  • Software granules are the granularity at which computers schedule resources (such as memory resources). That is, computers use software granules as the granularity for scheduling resources. Different software granules can allocate different resources.
  • the software particles can be programs (such as operating systems or application programs), processes (one program can correspond to one or more processes) or threads.
  • a software particle may be a process or a thread, that is, one software particle is a process or a thread.
  • the process or thread may be a process or thread in an operating system or a process or thread in an application.
  • different software particles may be processes belonging to different programs, or may be different processes under the same program.
  • the two software particles may be two different processes in the operating system, or one of the two software particles is a process in the operating system, and the other software particle is a process in the application software particle.
  • the software particle may be a program composed of at least one process.
  • the program can be an operating system or an application program.
  • critical software particles refer to software particles that have low tolerance for memory faults or errors and require high reliability memory, that is, critical software particles have high reliability requirements for memory.
  • Key software particles may include software particles that have a greater impact on the overall operation of the computer, such as an operating system (when the software particles are programs) or an operating system kernel (when the software particles are processes).
  • Key software particles may also include software particles used to perform basic computer functions or services. For example, for a computer such as a smartphone, its basic function is the phone function, and communication software particles used to implement the phone function are key software particles.
  • key software particles The operation of key software particles is unstable, or even resets or exits, which has a great impact on the overall operation of the computer or the realization of basic functions or services.
  • key software particles need to run in high-reliability memory, that is, key software particles have high requirements for memory reliability.
  • the key software particles or the reliability requirements of the software particles for the memory can be pre-configured.
  • the manufacturer or designer of the computing device can pre-configure one or more software particles as software particles that require high memory reliability based on the above definition or description of key software particles, that is, key software particles.
  • Non-critical software particles have a higher tolerance for memory failures and have lower requirements for memory reliability. Specifically, whether the operation of non-critical software particles is stable has no or little impact on the operation of the computer and the basic functions or business of the computer.
  • a smartphone, a computer can have an email client installed. Whether the email client runs stably or not has little impact on the overall operation of the phone, as well as basic functions such as call functions. For another example, whether the drawing process that comes with the computer operating system is running stably has little impact on the overall operation of the mobile phone and is not used to implement the basic functions of the computer.
  • the drawing process is also a non-critical software particle (when the software particle is a process) ). Therefore, running non-critical software particles in memory with low reliability, even if the non-critical software particles run unstable, or even reset or exit, will have a small impact on the overall operation of the mobile phone, as well as basic functions such as call functions.
  • the reliability requirements of the software particles on the memory may be simply referred to as the reliability requirements of the software particles.
  • a memory bank is composed of one or more memory sticks, and multiple memory sticks in the computer constitute multiple independent memory banks.
  • different memory groups do not have the same memory stick, that is, one memory stick only belongs to one memory group.
  • all the memory banks in each memory group constitute a memory address space, that is, a memory group can be understood as a memory address space.
  • Multiple independent memory groups means that the address segments of different memory groups in the multiple memory groups are independent and do not overlap or have no overlapping parts.
  • a memory group consists of one or more memory sticks.
  • the address segment of the memory group is the address segment of the memory stick.
  • the address segment of the memory group is composed of the address segments of the multiple memory sticks.
  • the address segments of the multiple memory sticks may be interleaved with each other, that is, the address segments of the multiple memory sticks are scattered in the address segment of the memory group.
  • the address segment of the memory group can be divided into multiple sub-address segments, where each sub-address segment includes an address of each of the multiple memory banks.
  • each sub-address segment includes an address of each of the multiple memory banks. Therefore, the processor can use the multiple memory banks to run software particles.
  • the address segment of the memory stick consists of the address of the memory space in the memory stick, and an address in the address segment of the memory stick represents a piece of memory space in the memory stick.
  • the processor can access the memory space represented by the segment address through the segment address, such as writing data to the memory space or reading data stored in the memory space.
  • an address in the address segment of a memory group represents a piece of memory space in the memory group.
  • the memory space of the memory group consists of the memory space of the memory modules that make up the memory group.
  • the memory space of the memory group refers to the storage space of the memory group
  • the memory space of the memory stick refers to the storage space of the memory stick.
  • the memory group has reliability, and the reliability of the memory group is negatively related to the number of memory sticks that make up the memory group. That is, the more the number of memory sticks that make up the memory group, the more reliable the memory group is. Low. It is not difficult to understand that if the failure rate of a single memory stick is P, then the failure rate of a memory group composed of Q memory sticks is 1-(1-P) Q . Therefore, the greater the number of memory modules that make up a memory bank, the lower the reliability of the memory bank.
  • the reliability of at least two memory groups among the plurality of memory groups is different. That is to say, different memory groups in the at least two memory groups include different numbers of memory banks.
  • Each memory bank in a computer can be connected to the computer's processor through one or more memory channels.
  • the processor can access the memory space of the memory bank through the memory channel between the processor and the memory bank. It is not difficult to understand that the bandwidth between the memory group and the processor is positively related to the number of memory channels between the memory group and the processor. That is, the greater the number of memory channels between the memory bank and the processor, the greater the bandwidth between the memory bank and the processor. The greater the bandwidth between the memory bank and the processor, the higher the rate at which the processor can access the memory bank.
  • This embodiment of the present application provides a computer 200.
  • the computer 200 can be used to implement the memory allocation solution provided by the embodiment of the present application.
  • the computer 200 is a device, equipment, cluster, platform, etc. that uses memory to run software particles.
  • the terminal can be a mobile phone, a tablet computer, a wearable device, a smart TV, a smart speaker, a smart watch, a vehicle-mounted terminal, etc.
  • the computer 200 may include multiple memory modules and a processor 220 .
  • the memory module of the computer 200 may be dynamic random-access memory (DRAM).
  • the memory module of the computer 200 can be synchronous dynamic random-access memory (synchronous dynamic random-access memory, SDRAM).
  • SDRAM synchronous dynamic random-access memory
  • the memory module of the computer 200 can be double-data-rate synchronous dynamic random access memory (DDR SDRAM).
  • DDR SDRAM double-data-rate synchronous dynamic random access memory
  • the memory module of the computer 200 may also be other types of memory modules.
  • the embodiments of this application do not limit the specific implementation form of the memory stick.
  • multiple memory sticks of the computer 200 can form multiple memory groups such as a memory group 211 , a memory group 212 , and a memory group 213 .
  • the memory group 211 is composed of K memory sticks
  • the memory group 212 is composed of L memory sticks
  • the memory group 213 is composed of M memory sticks.
  • the failure rate of a single memory module can be set to P, then the failure rate of the memory group 211 is 1-(1-P) K
  • the failure rate of the memory group 211 is 1-(1-P) L
  • the memory The failure rate of group 211 is 1-(1-P) M .
  • K, L, and M are all integers greater than or equal to 1, and K, L, and M are not exactly equal. That is, the reliability of the memory group 211, the memory group 212, and the memory group 213 are not completely equal.
  • the quality of the memory modules in the memory group with the smallest number of memory modules among the memory groups 211, 212, and 213 is higher than that of the memory modules in other memory groups. In this way, high reliability can be further improved. Reliability of memory sticks.
  • the processor 220 may be a central processing unit (CPU). In some embodiments, processor 220 may be a graphics processing unit (GPU)). In some embodiments, the processor 220 may be an application specific integrated circuit (ASIC). In other embodiments, the processor 220 may also be implemented in other forms. The embodiment of the present application does not limit the specific implementation form of the processor 220.
  • the processor 220 can run software particle 1, software particle 2 and other software particles.
  • the computer 200 may also include an external memory 230.
  • the external memory 230 can store codes of multiple software particles such as software particle 1 and software particle 2.
  • the code of the software particle in the external memory 230 can be loaded into the corresponding memory group. Then, the processor 220 can run the code in the memory group to implement the operation of the software particle.
  • the computer 200 can select a memory group whose reliability matches the reliability requirements of the software particle from multiple memory groups of the computer 200 according to the reliability requirements of the software particle.
  • the processor 220 may then run the software particle using the memory bank selected for the software particle.
  • the computer 200 selects a memory group for a software particle. That is to say, the processor 220 can allocate multiple memory groups to various software particles based on the reliability requirements of the multiple software particles for the memory and the reliability of the multiple memory groups.
  • a software particle is allocated to a memory group, and the memory group allocated to the software particle is used by the processor to run the software particle.
  • a memory group can be allocated to a single software particle at one time, or a memory group can be allocated to multiple software particles at one time.
  • the software particle can use the storage space in the memory group to store data. Moreover, once a certain software particle allocates a certain (or multiple) memory group, each memory bank in the allocated memory group will be used by the software particle. For example, a software particle allocated with 4 memory sticks needs to use 80MB of memory space, then these 4 memory sticks will be used by this software particle.
  • Multiple software particles assigned to the same memory group belong to the same memory fault domain. That is to say, when there is a single or multiple memory faults in a memory group, all software particles using this memory group will be affected; software particles not allocated to this memory group will not be affected.
  • the memory allocation scheme may include steps as shown in Figure 3.
  • the steps shown in FIG. 3 may be executed by the memory allocation device of the computer 200 .
  • the memory allocation device can be implemented as software.
  • the memory allocation device can be served by a memory manager in the operating system.
  • the memory allocation device may be run by processor 220. That is, the processor 220 can execute the memory allocation plan by running the memory allocation device.
  • the processor 220 can load the memory allocation device into any memory bank in the computer 200 and use the memory bank to run the memory allocation device.
  • processor 220 can execute a memory allocation scheme.
  • the memory allocation device may also be implemented in hardware. The embodiments of this application do not specifically limit the implementation of the memory allocation device.
  • the memory allocation device can perform step 301 to obtain the reliability of multiple memory groups.
  • the plurality of memory banks may include a memory bank 211 , a memory bank 212 , and a memory bank 213 .
  • the basic input output system (BIOS) of the computer 200 can report the reliability of the memory group to the memory allocation device.
  • BIOS of the computer 200 can report the number of memory banks that constitute the memory group to the memory allocation device.
  • the memory allocation device can obtain the reliability of the memory group based on the number of memory banks that make up the memory group.
  • the operating system of computer 200 may be operating system.
  • the memory attributes and Linux mainline code defined in the unified extensible firmware interface (UEFI) specification can be reused.
  • the address segment attributes of high-reliability memory groups are reported as EFI_MEMORY_MORE_RELIABLE.
  • EFI_MEMORY_MORE_RELIABLE can be referred to as RELIABLE.
  • the memory allocation device regards the memory group with the address segment attribute as RELIABLE as a high-reliability memory group, and the memory group with the address segment attribute as default as a low-reliability memory group.
  • the reliability of the memory group can be reported to the memory allocation device without changing the existing memory application/release interfaces. This avoids a lot of work such as software adaptation.
  • the memory group with the smallest number of memory banks among the multiple memory groups of the computer 200 may be reported as a high-reliability memory group, and the other memory groups may be reported as low-reliability memory groups.
  • the memory space required for critical software particles is also smaller. Even if a memory group only includes one memory stick, the memory space of the memory group is larger than the memory space required by all key software particles.
  • a part of the memory space in the high-reliability memory group can be reported to the memory allocation device as a high-reliability memory space, and the other part of the memory space can be reported to the memory allocation device as a low-reliability memory space.
  • the size of the high-reliability memory space needs to meet the memory space needs of all key software particles in the computer.
  • the memory group 211 in the computer 200 can be set as a high-reliability memory group.
  • a part of its memory space is reported to the memory allocation device as a high-reliability memory space, and the other part of the memory space is used as a low-reliability memory.
  • Space is allocated to the memory allocation device.
  • the memory allocation device may regard the memory space reported as a high-reliability memory space as a high-reliability memory space, and the memory space reported as a low-reliability memory space as a low-reliability memory space.
  • the address segment attribute of a part of the memory space in the high-reliability memory group can be reported as RELIABLE. In this way, the memory allocation device can regard this part of the memory space as a high-reliability memory space. Report the address segment attribute of another part of the memory address space in the high-reliability memory group as default, so that the memory allocation device can treat this part of the memory space as a low-reliability memory space.
  • a part of the memory space in the high-reliability memory group is regarded as high-reliability memory space.
  • the memory allocation device allocates memory to software particles, it can consider that the memory group where the high-reliability memory space is located meets the high-reliability requirements of the software particles, so that the memory group where the high-reliability memory space is located (i.e., the high-reliability memory group) Software particles assigned to high reliability requirements.
  • Another part of the memory space in the high-reliability memory group is regarded as low-reliability memory space.
  • the memory allocation device allocates memory to software particles, it can be considered that the memory group where the low-reliability memory space is located meets the low-reliability requirements of the software particles, and the memory group where the low-reliability memory space is located (high-reliability memory group ) is assigned to software particles with low reliability requirements.
  • the software particles with high reliability requirements and the software particles with low reliability requirements can share the memory space.
  • the high-reliability memory group avoids the waste of memory space, and also enables software particles with low reliability requirements to run in the high-reliability memory group, improving the operational stability of software particles with low reliability requirements.
  • the memory space can also be referred to as space for short.
  • the memory group has a reliability level, and the reliability level is used to indicate the reliability of the memory group. Specifically, the higher the reliability level of the memory bank, the higher the reliability of the memory bank.
  • the reliability level of the memory group and the address segment of the memory group can be managed.
  • the memory allocation device allocates a memory group to a software particle, it can obtain the reliability of the memory group to be allocated through the address segment of the memory group to be allocated, and then allocate to the memory group that meets the reliability requirements of the software particle in the memory to be allocated.
  • Software particles can be used to indicate the reliability of the memory group.
  • the memory allocation device can obtain the reliability of the memory group.
  • different memory groups may have different bandwidths.
  • memory groups with different numbers of memory channels have different bandwidths. The greater the number of memory channels, the greater the bandwidth of the memory group.
  • the memory channel of the memory group here refers to the memory channel that connects the processor 220 and the memory modules in the memory group and is used for communication between the processor 220 and the memory modules in the memory group.
  • the memory channel of memory group 211 is 1, the memory channel of memory group 212 is 2, and the memory channel of memory group 213 is 3, then the bandwidth of memory group 211 ⁇ memory group 212 The bandwidth is smaller than the bandwidth of memory group 213.
  • the BIOS of computer 200 may report the bandwidth of the memory bank to the memory allocation device.
  • the bandwidth of a memory bank and the address segment of the memory bank may be associated.
  • the memory allocation device allocates a memory group to a software particle, it can obtain the bandwidth of the memory group to be allocated through the address segment of the memory group to be allocated, and then allocates a memory group to the software particle based on the bandwidth of the memory group. Through the aforementioned method, the memory allocation device can obtain the bandwidth of the memory group.
  • the memory allocation device can obtain the reliability of the memory group and/or the bandwidth of the memory group.
  • the memory allocation device may allocate memory to the software particles based on the reliability of the memory group and/or the bandwidth of the memory group.
  • the memory allocation device can perform step 302 to screen memory groups whose reliability meets the reliability requirements of the software particle 1 to obtain a memory group set C1 including at least one memory group.
  • the processor 220 may call the memory allocation device to perform step 302 to allocate memory for the software particle 1 .
  • the software particle 1 is an operating system or a process in the operating system (for example, the kernel of the operating system). Then when the processor 220 starts the operating system, the memory allocation device can be called to allocate memory for the software particle 1 .
  • software particle 1 is an application software particle or a process in an application software particle. Then, when the processor 220 detects an operation for starting the application software particle (for example, a mouse double-click operation for the application software particle), the memory allocation device can be called to allocate memory for the software particle 1 .
  • the memory allocation device may obtain the reliability requirements of the software particle 1 .
  • the identification of the software particle 1 may be associated with reliability requirements, and the memory allocation device may obtain the reliability requirements of the software particle 1 based on the reliability requirements associated with the identification of the software particle 1 .
  • a mapping table between software particles and reliability requirements can be configured, and the mapping table records the reliability requirements corresponding to multiple software particles. The memory allocation device can read the mapping table and obtain the reliability requirements corresponding to the software particle 1.
  • the reliability requirements corresponding to software particle 1 are the reliability requirements of software particle 1.
  • the memory allocation device can determine whether the reliability of each memory group meets the reliability requirements of the software particle 1, and record the memory groups that meet the reliability requirements of the software particle 1 to obtain at least one memory group.
  • the reliability requirements can be divided into high reliability requirements and low reliability requirements, and the reliability of the memory group can be divided into high reliability and low reliability.
  • the reliability of a high-reliability memory group meets high reliability requirements
  • the reliability of a low-reliability memory group meets low reliability requirements.
  • the memory group with high reliability in the computer 200 is the memory group with the smallest number of memory banks in the computer 200 , and other memory groups in the computer 200 have low reliability requirements.
  • software particle 1 is a key software particle and its reliability requirement is a high reliability requirement
  • the memory group in the memory group set C1 obtained in step 302 is a high-reliability memory group in the computer 200 .
  • the memory group in the memory group set C1 obtained in step 302 is a low-reliability memory group in the computer 200 .
  • step 304a the memory allocation device executes step 304a to allocate the memory banks in the memory bank set C1 to the software particle 1 .
  • the memory group set C1 obtained in step 302 is greater than 1, that is, the memory group set C1 includes at least two memory groups, then one of the at least two memory groups is allocated to the software particle 1, so that Make software particle 1 only allocated to one memory group, so that this memory group can be used to run software particle 1 later.
  • step 304b is executed to allocate the memory group with the largest bandwidth in the memory group set C1 to the software particle 1 .
  • different memory banks have different bandwidths.
  • step 304b the maximum bandwidth memory group whose reliability meets the reliability requirements of software particle 1 is allocated to software particle 1, thereby ensuring the running time of software particle 1 when the reliability requirements of software particle 1 are met.
  • the communication rate between the processor 220 and the memory bank ensures the performance of the processor 220 in running the software particle 1.
  • the address segment of the memory group can be set according to the bandwidth of the memory group.
  • the bandwidth of the memory group 213 can be set to be greater than the bandwidth of the memory group 212.
  • the address segment of the memory group is lower than the address segment of the memory group 212.
  • the existing memory allocation mechanism is as follows: allocate memory space to software particles in order from low to high address segments, that is, the memory space in low address segments is allocated to software particles first. Therefore, the memory bank with large bandwidth is set in the low address segment, and the memory bank with small bandwidth is set in the In the high address segment, large-bandwidth memory groups can be allocated to software particles first.
  • step 304b through the solution of the above embodiment, the address segment of the large-bandwidth memory group in the memory group set C1 is low, and the address segment of the maximum-bandwidth memory group is the lowest among the address segments of all memory groups in the memory group set C1. of. In this way, without changing the existing memory allocation mechanism, in step 304b, the memory group with the largest bandwidth in the memory group set C1 is allocated to the software particle 1.
  • the software particle 1 can be set as a software particle with high reliability requirements, and accordingly, the memory groups in the memory group set C1 are high-reliability memory groups.
  • the memory allocation device can also perform step 305 to determine whether the space of the memory group included in the memory group set C1 is greater than the space required by the software particle 1 when the memory group set C1 only includes one memory group. If the space of the memory group in the memory group set C1 is larger than the space required by the software particle 1, then when the computer 200 starts the software particle 2, step 306 can be executed to allocate the memory group in the memory group set C1 to the software particle 2, so that the software Particle 2 and software particle 1 can share the memory group in the memory group set C1.
  • the reliability requirements of software particle 2 are lower than the reliability requirements of software particle 1, and the space is the memory space.
  • the space of the memory group is larger than the space required by the software particles refers to whether the space of the memory group is larger than the space required by the software particles.
  • memory groups that meet the reliability requirements of software particles can be assigned to software particles, so that software particles with high reliability requirements can be assigned to high-reliability memory groups, thereby ensuring that software particles with high reliability requirements (i.e., key software particles).
  • a large-bandwidth memory group is allocated to the software particles, thereby ensuring the operating performance of the software particles.
  • the processor 220 can use the memory group to which the software particle is allocated to run the software particle.
  • the processor 220 calls all the memory banks in the memory group to which the software particle is allocated to run the software particle. That is to say, the processor 220 can simultaneously utilize all the memory banks in the memory group to which the software particles are allocated to run the software particles.
  • the address segments of the multiple memory sticks can be interleaved with each other, that is, the address segments of the multiple memory sticks are scattered among the address segments of the memory group. middle.
  • the address segment of the memory group can be divided into multiple sub-address segments, where each sub-address segment includes an address of each of the multiple memory banks.
  • the processor 220 can use the multiple memory banks to run software particles.
  • the number of memory sticks that make up the memory group can be set to Q, and the length of each sub-address segment can be Q ⁇ 256 bytes. Among them, in each sub-address segment, each memory stick shares 256 bytes. In this way, whenever the processor 220 accesses the address segment of Q ⁇ 256 bytes, it can access the Q root memory bank.
  • each of the Q memory banks can be connected to the processor 220 through a memory channel, and the Q memory banks are connected to the processor 220 through Q memory channels.
  • the processor 220 accesses an address segment of Q ⁇ 256 bytes
  • the address segment of Q ⁇ 256 bytes can be accessed through Q memory channel accesses, thereby increasing the speed at which the processor 220 accesses the memory and improving software performance. The operating performance of the particles.
  • the solution of the embodiment of the present application divides multiple memory sticks in the computer into multiple memory groups, thereby reducing the impact scope of a single memory stick failure.
  • the memory groups in multiple memory groups have different reliability levels, which can meet the memory needs of software particles with different reliability requirements, ensure the operational stability of key software particles, and ensure the operational performance of non-critical software particles. .
  • embodiments of the present application provide a memory allocation method. It can be understood that this method is another expression of the memory allocation scheme described above, and the two are combined. For part or all of the content in this method, please refer to the above description of the memory allocation scheme.
  • the memory allocation method provided by the embodiment of the present application can be applied to a computer.
  • the computer includes a processor capable of running a variety of software particles and multiple memory sticks.
  • the multiple memory sticks constitute multiple independent memory groups, and a The root memory stick belongs to only one group, and the reliability of each memory group is inversely related to the number of memory sticks that make up the memory group.
  • the method includes step 501, allocating a memory group for running the first software particle to the first software particle, wherein the reliability of the memory group allocated to the first software particle is not lower than that of the first software particle. Describe the reliability requirements of the first software particle. .
  • the reliability of the memory group allocated to the first software particle is not lower than that of the first software particle.
  • the processor calls the storage space of all memory banks in the memory group allocated for the first software particle to run the first software Particles.
  • the processor calls the storage space of all memory banks in the memory group allocated for the first software particle to run the first software Particles.
  • allocating a memory group for running the first software particle to the first software particle includes: ensuring the reliability of at least two memory groups among the plurality of memory groups. If both meet the reliability requirements of the first software particle, the memory group with the largest bandwidth among the at least two memory groups is preferentially allocated to the first software particle.
  • the address segment of the memory group with the largest bandwidth is lower than the address segment of other memory groups, and the other memory groups are the memory group with the largest bandwidth among the at least two memory groups. memory group outside.
  • the method further includes: allocating a memory group for running the second software particle to the second software particle, wherein the reliability of the memory group allocated to the second software particle is not lower than that of the second software particle. Reliability requirements for the second software particle, wherein the memory group allocated to the second software particle is the same as or different from the memory group allocated to the first software particle.
  • the plurality of software particles include a first software particle and a second software particle, wherein the reliability requirements of the second software particle are lower than the reliability requirements of the first software particle, and the reliability requirements of the second software particle are lower than the reliability requirements of the first software particle.
  • the reliability of the first memory group among the plurality of memory groups meets the reliability requirements of the first software particle; the method further includes: when the space of the first memory group is larger than the space required by the first software particle. In the case of space, the first memory group is allocated to the first software particle and the second software particle for common use.
  • the address segment of the memory group is associated with a reliability level, and the reliability level is used to indicate the reliability of the memory group; the first software particle is allocated a reliability level for running the first software particle.
  • the memory group of the software particle includes: allocating a memory group to the first software according to the reliability requirements of the first software particle and the address segments of the plurality of memory groups.
  • the software particle is any one of a program, a process, and a thread.
  • a program a program
  • a process a process
  • a thread a thread
  • the memory allocation method provided by the embodiment of this application can allocate memory groups that meet the reliability requirements of the software particles, thereby meeting the reliability requirements of the software particles for memory and ensuring the operational stability of the software particles that require high reliability.
  • an embodiment of the present application also provides a memory allocation device 600.
  • Device 600 may be configured in a computer, such as computer 200.
  • the computer includes a processor capable of running a variety of software particles and multiple memory sticks.
  • the multiple memory sticks form multiple independent memory groups, and one memory stick only belongs to one group, and each memory group
  • the reliability of is negatively related to the number of memory modules that make up the memory group, and different software particles among the multiple software particles have different reliability requirements for the memory.
  • the device 600 includes: an acquisition unit 610, used to acquire the reliability requirements of the first software particle; an allocation unit 620, used to allocate a memory group for running the first software particle to the first software particle, Wherein, the reliability of the memory group allocated to the first software particle is not lower than the reliability requirement of the first software particle.
  • the computer 700 includes a processor 710 , a memory 720 , and a plurality of memory sticks 730 .
  • multiple memory sticks 730 form multiple independent memory groups, and one memory stick 730 only belongs to one group.
  • the reliability of each memory group is negatively related to the number of memory sticks composing the memory group.
  • the processor 719 is capable of running a variety of software particles, and different software particles among the multiple software particles may have different memory reliability requirements.
  • Memory 720 stores computer instructions.
  • the processor 710 is used to execute computer instructions stored in the memory 720, so that the processor 700 can execute the memory allocation scheme shown in FIG. 3 above or the memory allocation method shown in FIG. 5.
  • An embodiment of the present application also provides a computer program product containing instructions.
  • the computer program product may be a software or program product containing instructions capable of running on a computing device or stored in any available medium.
  • the computing device is caused to execute the method shown in Figure 5.
  • An embodiment of the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be any available medium that a computing device can store or a data storage device such as a data center that contains one or more available media.
  • the available media may be magnetic media (eg, floppy disk, hard disk, tape), optical media (eg, DVD), or semiconductor media (eg, solid state drive), etc.
  • the computer-readable storage medium includes instructions that instruct the computing device to perform the method shown in FIG. 5 .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

提供了一种内存分配方法,该方法应用于计算机,该计算机包括能够运行多种软件颗粒的处理器、多根内存条,其中,多根内存条组成多个独立的内存组,且一根内存条仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关;该方法包括:为第一软件颗粒分配一个用于运行第一软件颗粒的内存组,其中,为第一软件颗粒分配的内存组的可靠性不低于第一软件颗粒的可靠性要求。该方法可以为高可靠性要求的软件颗粒分配到高可靠性的内存组,从而保障高可靠性要求软件颗粒的运行稳定性。

Description

内存分配方法、装置及计算机 技术领域
本申请涉及计算机技术,具体涉及一种内存分配方法、装置及计算机。
背景技术
信息技术的发展,对内存具有高存储密度的需求。高存储密度是指在内存条体积不变甚至减小的情况下,内存条的存储空间增加。为了实现高存储密度,内存条制备工艺的特征尺寸越来越小。特征尺寸的减少提升了内存条的存储密度,但也提升了内存条的故障率。
另外,为了提高处理器和内存之间的带宽,通常将多个内存通道所连接的内存条交织到一个内存地址空间中,其中,不同内存通道所连接的内存条的存储空间被均匀打散到该内存地址空间中,以便处理器在运行软件颗粒时,可以同时利用该多个内存通道和内存进行信息交互。
由于内存条的存储空间被均匀打散到了整个内存地址空间,任一根内存条发生了故障,那么该故障也分散到了整个内存地址空间,这必然会影响到处理器运行软件颗粒的稳定性。特别是在内存条故障率较高的情况下,处理器运行软件颗粒的稳定性受到严重影响。
发明内容
提供了一种内存分配方法、装置及计算机,可以保障高可靠性要求软件颗粒的运行稳定性。
第一方面,提供了一种内存分配方法,该方法应用于计算机,计算机包括能够运行多种软件颗粒的处理器、多根内存条,其中,多根内存条组成多个独立的内存组,且一根内存条仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关;该方法包括:根据软件颗粒对内存的可靠性要求和多个内存组的可靠性,为软件颗粒分配一个用于运行该软件颗粒的内存组,为该软件分配的内存组的可靠性不低于该软件的可靠性要求;例如,为第一软件颗粒分配一个用于运行第一软件颗粒的内存组,为第一软件分配的内存组的可靠性不低于软件的可靠性要求。
另外,多个独立的内存组是指多个内存组的地址段不重合或者说没有重合部分。不同的软件颗粒的可靠性要求可能不同。其中,软件颗粒的靠性要求要求可以是指软件颗粒对内存的可靠性要求。
现有技术中,在给任意软件颗粒分配内存空间时,会把计算机的所有内存条都分配给这个软件颗粒,因此,当任意一个内存条发生故障,都会对所有软件颗粒的运行造成影响。而本方法将多根内存条划分为多个互相独立的内存组,并将内存组作为给软件颗粒分配内存空间的粒度。按照这种分配方法,当有内存条发送故障时,仅对使用这个内存组的软件颗粒的运行造成影响,不对使用其他内存组的软件颗粒造成影响,从而降低了单根内存条故障的影响范围,提升了使用内存条的可靠性。并且,该方法提供了可靠性不同的内存组,以及按照软件颗粒的可靠性要求和内存组的可靠性进行内存组分配,由此,软件颗粒能够分配到满足其可靠性要求匹配的内存组,特别是,高可靠性要求的软件颗粒能够分配到高可靠性的内存组,使得处理器可以使用高可靠性内存,来运行高可靠性要求软件颗粒,保障了高可靠性要求软件颗粒的运行稳定性。
在一种可能的实现方式中,在第一软件颗粒的运行期间,处理器调用为第一软件颗粒所分配的内存组中的所有内存条的存储空间,以运行第一软件颗粒。
在该实现方式中,同一内存组中所有内存条的地址段组成该内存组的地址段,在内存组的地址段中,不同内存条的地址段可以相互交织。具体而言,内存组的地址段被划分为多个子地址段,每个子地址段包括了该内存组中所有内存条的部分地址段,使得处理器在运行软件颗粒期间,当访问到一个子地址段时,可以同时访问该内存组中所有内存条,从而可以避免某根内存条负载过高。特别是,当不同内存条通过不同内存通道连接处理器时,处理器同时访问所有内存条,可以有效利用内存条和处理器之间的内存通道,提高数据传输速率。
在一种可能的实现方式中,不同内存组的带宽不同;为第一软件颗粒分配一个用于运行第一软件颗粒的内存组包括:在多种内存组中至少两个内存组的可靠性均满足第一软件颗粒的可靠性要求的情况下,优先将至少两个内存组中带宽最大的内存组分配给第一软件颗粒。
在该实现方式中,将可靠性满足在软件颗粒的可靠性要求的最大带宽内存组分配给软件颗粒,从而在软件颗粒的可靠性要求得到满足的情况下,使得软件颗粒运行时的处理器和内存组之间的通信速率最大化,从而保障了处理器运行软件颗粒的性能。
在一种可能的实现方式中,带宽最大的内存组的地址段低于其他内存组的地址段,其他内存组为至少两个内存组中除带宽最大的内存组之外的内存组。
在该实现方式中,可以在不更改现有通用内存分配机制的情况下,在软件颗粒的可靠性要求能够得到满足的同时,优先将大带宽的内存组分配给软件颗粒。具体而言,现有通用内存分配机制为:按照地址段的从低到高的顺序为软件颗粒分配内存空间,即低地址段的内存空间优先分配给软件颗粒。在该实现方式中,大带宽的内存组设置在低地址段,小带宽的内存组设置在高地址段,从而可以优先将大带宽的内存组分配给软件颗粒。
在一种可能的实现方式中,该方法还包括:为第二软件颗粒分配一个用于运行第二软件颗粒的内存组,其中,为第二软件颗粒分配的内存组的可靠性不低于第二软件颗粒的可靠性要求,其中,为第二软件颗粒分配的内存组与为第一软件颗粒分配的内存组相同或者不同。
在该实现方式中,在内存组的可靠性同时满足两个或更多个软件颗粒的可靠性要求的情况下,可以将该内存组分配给该两个或更多个软件颗粒,从而避免了内存组的存储空间的浪费。
在一种可能的实现方式中,该多个软件颗粒包括第一软件颗粒和第二软件颗粒,其中,第二软件颗粒对内存的可靠性要求低于第一软件颗粒对内存的可靠性要求,且多个内存组中的第一内存组的可靠性满足第一软件颗粒对内存的可靠性要求;该方法还包括包括:在第一内存组的空间大于第一软件颗粒所需的空间的情况下,将第一内存组分配给第一软件颗粒、第二软件颗粒共同使用。
该实现方式可以在高可靠性内存组的空间大于高可靠性要求软件颗粒对空间的需求的情况下,使得低可靠性要求软件颗粒也能分配到高可靠性内存组,由此,在避免高可靠性内存组的空间浪费的同时,也能够提高低可靠性要求软件颗粒的运行稳定性。
在一种可能的实现方式中,内存组的地址段关联有可靠性等级,可靠性等级用于表示内存组的可靠性高低;为第一软件颗粒分配一个用于运行第一软件颗粒的内存组包括:根据第一软件颗粒的可靠性要求和多个内存组的地址段,为第一软件颗粒分配内存组。
在该实现方式中,内存组的地址段在代表内存组的同时,也能够表明该内存组的可靠性高低,从而在为软件颗粒分配内存组时,可以按照内存组的地址段,将可靠性满足软件颗粒的可靠性要求的内存组分配给该软件颗粒。
在一种可能的实现方式中,软件颗粒为程序、进程、线程中的任一种。
在该实现方式中,可以以程序、进程或线程为粒度,进行内存组的分配,可以在按照不同粒度进行内存组分配,可以满足不同的内存组分配需求。
第二方面,提供了一种内存分配装置,配置于计算机,计算机包括能够运行多种软件颗粒的处理器、多根内存条,其中,多根内存条组成多个独立的内存组,且一根内存条仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关;该装置包括:获取单元,用于获取第一软件颗粒的可靠性要求;分配单元,用于根据第一软件颗粒的可靠性要求,为第一软件颗粒分配一个用于运行第一软件颗粒的内存组,其中,为第一软件颗粒分配的内存组的可靠性不低于第一软件颗粒的可靠性要求。
在一种可能的实现方式中,不同内存组的带宽不同;分配单元用于:在多种内存组中至少两个内存组的可靠性均满足多种软件颗粒中第一软件颗粒对内存的可靠性要求的情况下,优先将至少两个内存组中带宽最大的内存组分配给第一软件颗粒。
在一种可能的实现方式中,该分配单元还用于:为第二软件颗粒分配一个用于运行第二软件颗粒的内存组,其中,为第二软件颗粒分配的内存组的可靠性不低于第二软件颗粒的可靠性要求,其中,为第二软件颗粒分配的内存组与为第一软件颗粒分配的内存组相同或者不同。
在一种可能的实现方式中,多个软件颗粒包括第一软件颗粒和第二软件颗粒,其中,第二软件颗粒对内存的可靠性要求低于第一软件颗粒对内存的可靠性要求,且多个内存组中的第一内存组的可靠性满足第一软件颗粒对内存的可靠性要求;分配单元用于:在第一内存组的空间大于第一软件颗粒所需的空间的情况下,将第一内存组分配给第一软件颗粒、第二软件颗粒共同使用。
在一种可能的实现方式中,内存组的地址段关联有可靠性等级,可靠性等级用于表示内存组的可靠性高低;分配单元用于:根据第一软件颗粒对内存的可靠性要求和多个内存组的地址段,为所述第一软件颗粒分配内存组。
第三方面,提供了一种计算机,包括用于执行第一方面所提供的方法的处理器以及多根内存条。
第四方面,提供了一种计算机可读存储介质,包括计算机序指令,当计算机程序指令由计算设备执行时,该计算设备执行第一方面所提供的方法。
第五方面,提供了一种包含指令的计算机程序产品,当该指令被计算机设备运行时,使得该计算机设备执行第一方面所提供的方法。
提供的内存分配方法、装置及计算机,可以为软件颗粒分配到满足该软件颗粒的可靠性要求的内存组,使得该软件颗粒能够满足软件颗粒的可靠性要求的内存组中运行,从而可以保障高可靠性要求软件颗粒的运行稳定性。
附图说明
图1A为一种计算机的结构示意图;
图1B为多根内存条交织为一个交织域的示意图;
图2为本申请实施例提供的一种计算机的结构示意图;
图3为本申请实施例提供的一种内存分配方案的流程图;
图4A为本申请实施例提供的一种内存组的可靠性示意图;
图4B为本申请实施例提供的一种计算机的结构示意图;
图4C为本申请实施例提供的一种内存组地址段分布示意图;
图5为本申请实施例提供的一种内存分配方法的流程图;
图6为本申请实施例提供的一种内存分配装置的结构示意图;
图7为本申请实施例提供的一种计算机的结构示意图。
具体实施方式
下面将结合附图,对本申请实施例中的技术方案进行描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。
在本说明书的描述中“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。
其中,在本说明书的描述中,除非另有说明,“/”表示或的意思,例如,A/B可以表示A或B;本文中的“和/或”仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,在本申请实施例的描述中,“多个”是指两个或多于两个。
在本说明书的描述中,术语“第一”、“第二”仅用于描述目的,而不能理解为指示或暗示相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括一个或者更多个该特征。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。
内存(memory也称为主存(main memory或者primary storage),一种常见的内存是DIMM(dual inline memory module,双列直插内存模块)。内存是计算机的关键组件,内存的容量、带宽、可靠性等性能对计算机的性能具有重要影响。特别是,服务器、存储阵列等大型计算机需要大容量的内存。其中,内存的容量是指内存的存储空间的大小。内存的带宽是指内存和处理器之间进行信息交互的最大速率或理论速率。内存的可靠性是指内存故障率高低,内存的故障率越低,内存的可靠性越高。其中,内存的故障率是指内存发生故障的概率
为了满足计算机对内存容量的需要,计算机的内存可以包括多个物理内存条。其中,物理内存条可以简称为内存条。多根内存条可以通过多个内存通道连接到处理器,其中,每根内存条通过一个内存通道连接到处理器。在本申请实施例中,内存通道是指内存条和处理器之间的通信线路,用于处理器访问内存条的存储空间。
以图1A所示的计算机100为例,计算机100的内存由内存条111、内存条112、内存条113和内存条114组成。其中,内存条111通过内存通道131和处理器120连接,内存条112通过内存通道132和处理器120连接,内存条113通过内存通道133和处理器120连接,内存条114通过内存通道134和处理器120连接。
在一种方案了,为了增大处理器120和内存之间的带宽,将内存条111、内存条112、内存条113和内存条114交织(inter leaving)为一个内存地址空间,然后,处理器120利用内存地址空间运行计算机100上的所有软件颗粒(software grain)。
交织是指交错堆叠或排列,多根内存条交织是指将内存条的多个地址段和其他内存条的多个地址段交错排列,以将多根内存条均匀打散到一个内存地址空间中。具体可以参阅图1B,设定内存条111、内存条112、内存条113和内存条114的容量均为32GB,如此,内存条111、 内存条112、内存条113和内存条114交织得到的内存地址空间的总容量为128GB。内存条111、内存条112、内存条113和内存条114可以以256个字节(byte)为粒度进行交织,即内存地址空间中每个连续的1024个字节的地址段由这内存条111中256个字节的地址段、内存条112中256个字节的地址段、内存条113中256个字节的地址段和内存条114中256个字节的地址段组成。如此,当处理器120访问连续的1024个字节的地址段时,处理器120可以从内存通道131、内存通道132、内存通道133和内存通道134同时访问该1024个字节的地址段,从而提高处理器120访问内存的速率。
但是,在该方案中,由于每个连续的1024个字节的地址段均包括了四根内存条的地址段,四根内存条中的任一内存条的故障均可使得每个连续的1024个字节的地址段含有故障,从而使得处理器120难以避免地访问到含有故障的地址段,导致软件颗粒运行不稳定。特别是,在故障为不可纠正错误(uncorrected error),软件颗粒为操作系统时,会发生计算机100重启等问题,导致计算100中所有软件颗粒运行中断,严重影响计算机100的业务连续性。
本申请实施例提供了一种可以保障能够关键软件颗粒稳定运行,进而可保障计算机业务连续性的内存分配方案。概括而言,在该内存分配方案中,计算机中的多根内存条可被分为多个独立、可靠性高低不同的内存组。然后,可以根据计算机中各软件颗粒对内存的可靠性要求和多个内存组的可靠性,将高可靠性的内存组分配给对内存的可靠性要求高的软件颗粒,将低可靠性的内存组分配给对内存的可靠性要求低的软件颗粒。之后,计算机可以调用软件颗粒所分配到的内存组,运行该软件颗粒。其中,操作系统或者操作系统的内核,以及其他关键软件颗粒对内存的可靠性要求高,因此,可以分配到高可靠性的内存组,从而可保障这些关键软件颗粒能够稳定运行。
接下来,对本申请实施例提供的内存分配方案进行具体介绍。
首先,介绍本申请实施例涉及的一些概念。
软件颗粒为计算机进行资源调度(例如内存资源)的粒度,即:计算机以软件颗粒作为调度资源的粒度,不同的软件颗粒可以分配不同的资源。其中,软件颗粒可以为程序(例如操作系统,或者应用程序)、进程(process)(一个程序可以对应1个或者多个进程)或线程(thread)。
在本申请的一些实施例中,软件颗粒可以为进程或线程,即一个软件颗粒为一个进程或线程。其中,进程或线程可以为操作系统中的进程或线程,也可以为应用程序(application)中的进程或线程。在该实施例中,不同的软件颗粒可以是分别隶属于不同程序的进程,也可以是同一程序下的不同进程。例如,两个软件颗粒可以是操作系统中的两个不同进程,或者,两个软件颗粒中的一个软件颗粒为操作系统中的进程,另一个软件颗粒为应用软件颗粒中的一个进程。
在本申请的另一些实施例中,软件颗粒可以为由至少一个进程组成的程序。其中,程序可以为操作系统,也可以为应用程序。
在本申请实施例中,计算机中软件颗粒可以被划分为关键软件颗粒和非关键软件颗粒。其中,关键软件颗粒是指对内存故障或错误容忍度低、需要较高可靠性内存的软件颗粒,即关键软件颗粒对内存具有高可靠性要求的软件颗粒。关键软件颗粒可以包括对计算机的整机运行具有较大影响的软件颗粒,例如操作系统(软件颗粒为程序时)或操作系统内核(软件颗粒为进程时)。关键软件颗粒还可以包括用于执行计算机基本功能或业务的软件颗粒,例如对智能手机这一计算机而言,它的基本功能是电话功能,用于实现电话功能的通信软件颗粒为关键软件颗粒。
关键软件颗粒的运行不稳定,甚至复位或退出,对计算机的整机运行或者基本功能或业务的实现具有较大影响。为了能够保障计算机的运行以及基本功能或业务的实现,关键软件颗粒需要运行在高可靠性内存中,即关键软件颗粒对内存的可靠性要求高。
其中,关键软件颗粒或者软件颗粒对内存的可靠性要求的高低可以是预先配置的。示例性的,计算设备的厂商或设计者,可以基于上述对关键软件颗粒的定义或说明,预先将一个或多个软件颗粒配置为对内存的可靠性要求高的软件颗粒,即关键软件颗粒。
计算机中关键软件颗粒之外的软件颗粒可称之为非关键软件颗粒。非关键软件颗粒对内存故障或容忍度较高,对内存的可靠性要求较低。具体而言,非关键软件颗粒的运行是否稳定对计算机的运行以及计算机的基本功能或业务没有影响或影响较小。举例而言,对智能手机这一计算机而言,它可以安装电子邮箱客户端。电子邮箱客户端的运行稳定与否,较少影响到手机的整机运行、以及通话功能等基本功能。再例如,计算机操作系统自带的绘图进程的运行是否稳定,较少影响手机的整机运行,以及不用于实现计算机的基本功能,因此该绘图进程也为非关键软件颗粒(软件颗粒为进程时)。因此,在可靠性较低的内存中运行非关键软件颗粒,即使非关键软件颗粒的运行不稳定,甚至复位或退出,对手机的整机运行、以及通话功能等基本功能具有较小影响。
另外,在本申请实施例中,为方便描述,软件颗粒对内存的可靠性要求可以简称为软件颗粒的可靠性要求。
在本申请实施例中,一个内存组由一根或多根内存条组成,计算机中的多根内存条组成多个独立的内存组。其中,不同的内存组不具有相同的内存条,即一根内存条仅属于一个内存组。其中,每个内存组中的所有内存条构成一个内存地址空间,即一个内存组可以理解成一个内存地址空间。
多个独立的内存组的意思是该多个内存组中不同内存组的地址段独立、不重合或者说没有重合部分。如上所述,一个内存组由一根或多根内存条组成,当一个内存组由一根内存条组成时,该内存组的地址段即为该内存条的地址段。当一个内存组由多根内存条组成时,该内存组的地址段由该多根内存条的地址段组成。其中,在该内存组的地址段中,该多根内存条的地址段可以相互交织,即该多根内存条的地址段被打散在该内存组的地址段中。具体而言,可以设定该内存组的地址段可以被划分为多个子地址段,其中,每个子地址段均包括了该多根内存条中每根内存条的一段地址。如此,每当处理器访问到一个子地址段时,可以访问到该多根内存条中的每根内存条,由此,处理器可以利用该多根内存条运行软件颗粒。
另外,可以说明的是,内存条的地址段由内存条中内存空间的地址组成,内存条的地址段中的一段地址代表该内存条中的一块内存空间。处理器通过该段地址可以访问该段地址所代表的内存空间,例如向该内存空间中写入数据,或者读取该内存空间中存储的数据等。相应地,内存组的地址段中的一段地址代表了该内存组中的一块内存空间。其中,内存组的内存空间由组成该内存组的内存条的内存空间组成。其中,内存组的内存空间是指内存组的存储空间,内存条的内存空间是指内存条的存储空间。
在本申请实施例中,内存组具有可靠性,内存组的可靠性与组成该内存组的内存条的数量负相关,即组成内存组的内存条的数量越多,该内存组的可靠性越低。不难理解,若单根内存条的故障率为P,那么由Q根内存条组成的内存组的故障率为1-(1-P)Q。因此,组成内存组的内存条的数量越多,该内存组的可靠性越低。
在本申请实施例中,上述多个内存组中的至少两个内存组的可靠性是不同的。也就是说,该至少两个内存组中不同内存组所包括的内存条的数量不同。
计算机中的每个内存组可以通过一个或多个内存通道与该计算机的处理器连接。处理器可以通过该处理器与内存组之间的内存通道访问该内存组的内存空间。不难理解,内存组和处理器之间的带宽与内存组和处理器之间的内存通道的数量正相关。即内存组和处理器之间的内存通道的数量越多,内存组和处理器之间的带宽越大。内存组和处理器之间的带宽越大,处理器访问内存组的速率越高。
本申请实施例提供了一种计算机200。计算机200可以用于实施本申请实施例提供的内存分配方案。
计算机200为使用内存来运行软件颗粒的装置、设备、集群以及平台等。在一些实施例中,服务器、存储阵列(storage array)、交换机、终端等。其中,终端可以为手机、平板电脑、可穿戴设备、智能电视、智能音箱、智能手表、车载终端等。
参阅图2,计算机200可以包括多根内存条和处理器220。
在一些实施例中,计算机200的内存条可以为动态随机存取内存(dynamic random-access memory,DRAM)。在一个例子中,计算机200的内存条可以为同步动态随机存取内存(synchronous dynamic random-access memory,SDRAM)。在一个例子中,计算机200的内存条可以为双倍数据率同步动态随机存取存储器(double-data-rate synchronous dynamic random access memory,DDR SDRAM)。在其他实施例中,计算机200的内存条还可以为其他类型的内存条。本申请实施例对内存条的具体实现形式不做限定。
如图2所示,计算机200的多根内存条可以组成内存组211、内存组212、内存组213等多个内存组。其中,内存组211由K根内存条组成,内存组212由L根内存条组成,内存组213由M根内存条组成。示例性的,可以设定单内存条的故障率为P,那么内存组211的故障率为1-(1-P)K,内存组211的故障率为1-(1-P)L,内存组211的故障率为1-(1-P)M。K、L、M均为大于或等于1的整数,且K、L、M不完全相等。即内存组211、内存组212、内存组213的可靠性不完全相等。
在一些实施例中,内存组211、内存组212、内存组213中内存条个数最少的内存组中的内存条的品质高于其他内存组中的内存条,如此,可以进一步提升高可靠性内存条的可靠性。
在一些实施例中,处理器220可以为中央处理器(central processing unit,CPU)。在一些实施例中,处理器220可以为图形处理器(graphics processing unit,GPU))。在一些实施例中,处理器220可以为专用集成电路(application specific integrated circuit,ASIC)。其他实施例中,处理器220还可以实现为其他形式。本申请实施例对处理器220的具体实现形式不做限定。
处理器220可以运行软件颗粒1、软件颗粒2等多种软件颗粒。示例性的,计算机200还可以包括外部存储器230。外部存储器230可以存储软件颗粒1、软件颗粒2等多种软件颗粒的代码。处理器220运行软件颗粒时,外部存储器230中的软件颗粒的代码可以被加载到相应的内存组中,然后,处理器220可以运行内存组中的代码,实现软件颗粒的运行。
计算机200可以按照软件颗粒对内存的可靠性要求,从计算机200的多个内存组中,选择可靠性与该软件颗粒的可靠性要求匹配的内存组。然后,处理器220可以利用为该软件颗粒选择出的内存组运行该软件颗粒。其中,计算机200为一个软件颗粒选择一个内存组。也就是说,处理器220可以根据多种软件颗粒对内存的可靠性要求和多个内存组的可靠性,将多个内存组分配给多种软件颗粒。其中,一个软件颗粒分配到一个内存组,软件颗粒所分配到的内存组用于处理器运行该软件颗粒。
需要说明的是,“软件颗粒”一词在没有强调数量时,可以是单个软件颗粒也可以是多个 软件颗粒(例如多个线程),换言之,本实施例中可以一次性为单个软件颗粒分配一个内存组,也可以一次性为多个软件颗粒分配一个内存组。
在为软件颗粒分配内存组以后,软件颗粒就可以使用内存组中的存储空间存储数据。并且,一旦某个软件颗粒分配了某个(或多个)内存组,则被分配的内存组中的每个内存条都会被软件颗粒使用。例如,一个分配了4个内存条的软件颗粒需要使用80MB的内存空间,那么这4个内存条都会被这个软件颗粒所使用,一种分配方案是每个内存条为软件颗粒所提供的内存空间大小相同,那么,每个内存条给这个软件颗粒提供的内存空间80MB/4=20MB。分配到同一个内存组的多个软件颗粒属于同一个内存故障域。也就是说,当一个内存组中有单根或者多根内存故障时,使用这个内存组的所有软件颗粒都会受到影响;而未分配到这个内存组的软件颗粒不会受到影响。
接下来,结合图2所示的计算机200,对本申请实施例提供的内存分配方案进行说明。
该内存分配方案可以包括如图3所示的步骤。其中,图3所示的步骤可以由计算机200的内存分配装置执行。在一些实施例中,内存分配装置可以实现为软件,例如,内存分配装置可以由操作系统中的内存管理器担任。在该实施例的一个示例中,内存分配装置可以由处理器220运行。也就是说,处理器220可以通过运行内存分配装置,来执行内存分配方案。在一个例子中,在计算机200启动时,处理器220可以将内存分配装置加载到计算机200中的任一内存组中,并利用该内存组运行该内存分配装置。由此,处理器220可以执行内存分配方案。在一些实施例中,内存分配装置还可以通过硬件方式实现。本申请实施例对内存分配装置的实现方式不做具体限定。
参阅图3,内存分配装置可以执行步骤301,获取多个内存组的可靠性。其中,该多个内存组可以包括内存组211、内存组212、内存组213。
在一些实施例中,计算机200的基本输入输出系统(basic input output system,BIOS)可以将内存组的可靠性上报至内存分配装置。在一些实施例中,计算机200的BIOS可以将组成内存组的内存条的数量上报至内存分配装置。内存分配装置可以根据组成内存组的内存条的数量,得到该内存组的可靠性。
在一些实施例中,计算机200的操作系统可以为操作系统。可以复用统一可扩展固件接口(unified extensible firmware interface,UEFI)规范中定义的内存属性和Linux主线代码,高可靠性的内存组的地址段属性上报为EFI_MEMORY_MORE_RELIABLE。其中,EFI_MEMORY_MORE_RELIABLE可以简称RELIABLE。将低可靠性的内存组的地址段属性上报为default。其中,内存分配装置将地址段属性为RELIABLE的内存组视为高可靠性内存组,以及将地址段属性为default的内存组视为低可靠性内存组。在该实施例中,通过复用UEFI规范中定义的内存属性和Linux主线代码,可以在无需更改现有的内存申请/释放等接口的情况下,将内存组的可靠性上报至内存分配装置,从而避免了大量的软件适配等工作。
在一些实施例中,可以将计算机200的多个内存组中内存条数量最少的内存组上报为高可靠性内存组,将其他内存组上报为低可靠性内存组。
在一些实施例中,不难理解,按照上文对关键软件颗粒的定义或说明,一个计算机中的关键软件颗粒为少数。因此,关键软件颗粒所需的内存空间也较小。即使一个内存组中只包括一根内存条的情况下,该内存组的内存空间也大于所有关键软件颗粒所需的内存空间。为了避免内存空间的浪费,可以将高可靠性内存组中的一部分内存空间作为高可靠性内存空间上报给内存分配装置,另一个部分内存空间作为低可靠性内存空间给内存分配装置。其中,高可靠性内存空间的大小需要满足计算机中所有关键软件颗粒对内存空间的需要。举例而言, 如图4A所示,可以设定计算机200中的内存组211为高可靠性内存组,它的一部分内存空间作为高可靠性内存空间上报给内存分配装置,另一个部分内存空间作为低可靠性内存空间给内存分配装置。
内存分配装置可以将作为高可靠性内存空间上报的内存空间视为高可靠性内存空间,将作为低可靠性内存空间上报的内存空间视为低可靠性内存空间。在一个例子中,可以将高可靠性内存组中的一部分内存空间的地址段属性上报为RELIABLE,如此,内存分配装置可以该部分内存空间视为高可靠性内存空间。将高可靠性内存组中的另一部分内存地址空间的地址段属性上报为default,如此,内存分配装置可以该部分内存空间视为低可靠性内存空间。
高可靠性内存组中一部分内存空间被视为高可靠性内存空间。内存分配装置在为软件颗粒分配内存时,可以认为高可靠性内存空间所在的内存组满足高可靠性要求的软件颗粒,从而将高可靠性内存空间所在的内存组(即高可靠性内存组)分配给高可靠性要求的软件颗粒。高可靠性内存组中另一部分内存空间被视为低可靠性内存空间。内存分配装置在为软件颗粒分配内存时,可以认为该低可靠性内存空间所在的内存组满足低可靠性要求的软件颗粒,从而将该低可靠性内存空间所在的内存组(高可靠性内存组)分配给低可靠性要求的软件颗粒。
由此,在高可靠性内存组的内存空间的大小大于高可靠性要求的软件颗粒所需空间的大小的情况向,使得高可靠性要求的软件颗粒和低可靠性要求的软件颗粒可以共享该高可靠性内存组,从而避免了内存空间的浪费,也使得低可靠性要求的软件颗粒也能够运行在高可靠性内存组中,提高了低可靠性要求的软件颗粒的运行稳定性。
另外,在下文描述中,内存空间也可以简称为空间。
在一些实施例中,内存组具有可靠性等级,可靠性等级用于表示内存组的可靠性高低。具体而言,内存组的可靠性等级越高,内存组的可靠性越高。可以将内存组的可靠性等级和内存组的地址段管理。内存分配装置在为软件颗粒分配内存组时,可以通过待分配内存组的地址段,得到待分配内存组的可靠性,进而将待分配内存中满足软件颗粒的可靠性要求的内存组分配给该软件颗粒。
通过上述方式,内存分配装置可以获取内存组的可靠性。
在一些实施例中,不同的内存组可能具有不同的带宽,例如,内存通道数量不同的内存组的带宽是不同的,其中,内存通道数量越多,内存组的带宽越大。此处的内存组的内存通道是指连接处理器220和内存组中的内存条、用于处理器220和内存组中的内存条通信的内存通道。举例而言,如图4B所示,内存组211的内存通道为1个,内存组212的内存通道为2个,内存组213的内存通道为3个,那么内存组211的带宽<内存组212的带宽小于内存组213的带宽。
在该实施例的一个说明性示例中,计算机200的BIOS可以将内存组的带宽上报至内存分配装置。在该实施例的另一个说明性示例中,可以将内存组的带宽和内存组的地址段关联。内存分配装置在为软件颗粒分配内存组时,可以通过待分配内存组的地址段,得到待分配内存组的带宽,进而可以根据内存组的带宽,为软件颗粒分配内存组。通过前述方式,内存分配装置可以获取内存组的带宽。
通过上述方式,内存分配装置可以获取内存组的可靠性和/或内存组的带宽。内存分配装置可以基于内存组的可靠性和/或内存组的带宽,为软件颗粒分配内存。接下来,以软件颗粒1为例,示例介绍为软件颗粒分配内存的方案。
继续参阅图3,内存分配装置可以执行步骤302,筛选可靠性满足软件颗粒1的可靠性要求的内存组,得到包括至少一个内存组的内存组集合C1。
在一些实施例中,处理器220在确定需要运行软件颗粒1时,可以调用内存分配装置执行步骤302,以为软件颗粒1分配内存。示例性的,软件颗粒1为操作系统或者操作系统中的一个进程(例如操作系统的内核)。那么在处理器220启动操作系统时,可以调用内存分配装置为软件颗粒1分配内存。示例性的,软件颗粒1为应用软件颗粒或应用软件颗粒中的一个进程。那么在处理器220检测到用于启动该应用软件颗粒的操作(例如针对该应用软件颗粒的鼠标双击操作)时,可以调用内存分配装置为软件颗粒1分配内存。
在执行步骤302时或之前,内存分配装置可以获取软件颗粒1的可靠性要求。在一些实施例中,软件颗粒1的标识可以关联有可靠性要求,内存分配装置可以根据软件颗粒1的标识关联的可靠性要求,得到软件颗粒1的可靠性要求。在一些实施例中,可以配置软件颗粒和可靠性要求的映射表,该映射表记录了多个软件颗粒所对应的可靠性要求。内存分配装置可以读取该映射表,得到软件颗粒1对应的可靠性要求。软件颗粒1对应的可靠性要求即软件颗粒1的可靠性要求。
在步骤302中,内存分配装置可以判断每个内存组的可靠性是否满足软件颗粒1的可靠性要求,并记录满足可靠性满足软件颗粒1的可靠性要求的内存组,得到包括至少一个内存组的内存组集合C1。其中,即内存组集合C1中的每个内存组的可靠性均满足软件颗粒1的可靠性要求。
在一些实施例中,可靠性要求可以分为高可靠性要求和低可靠性要求,内存组的可靠性分为高可靠性和低可靠性。其中,高可靠性的内存组的可靠性满足高可靠性要求,低可靠性的内存组的可靠性满足低可靠性要求。示例性的,计算机200中高可靠性的内存组为计算机200中内存条数量最少的内存组,计算机200中的其他内存组为低可靠性要求。例如,软件颗粒1为关键软件颗粒,它的可靠性要求为高可靠性要求,则步骤302得到的内存组集合C1中的内存组为计算机200中的高可靠性的内存组。再例如,软件颗粒1为非关键软件颗粒,它的可靠性要求为低可靠性要求,则步骤302得到的内存组集合C1中的内存组为计算机200中的低可靠性内存组。
继续参阅图3,若步骤302得到的内存组集合C1中的内存组的数量为1,则内存分配装置执行步骤304a,将内存组集合C1中的内存组分配给软件颗粒1。
若步骤302得到的内存组集合C1中的内存组的数量大于1,即内存组集合C1包括至少两个内存组,则将该至少两个内存组中的一个内存组分配给软件颗粒1,从而使得软件颗粒1只分配到一个内存组,以便后续利用这一个内存组运行软件颗粒1。
在一些实施例中,如图3所示,若步骤302得到的内存组集合C1包括至少两个内存组,则执行步骤304b,将内存组集合C1中带宽的最大的内存组分配给软件颗粒1。如上所述,不同的内存组的带宽不同。通过步骤304b,将可靠性满足在软件颗粒1的可靠性要求的最大带宽内存组分配给软件颗粒1,从而在软件颗粒1的可靠性要求得到满足的情况下,保障了软件颗粒1运行时的处理器220和内存组之间的通信速率,从而保障了处理器220运行软件颗粒1的性能。
在一些实施例中,可以按照内存组的带宽,设置内存组的地址段的高低,其中,内存组的带宽越大,内存组的地址段越低。举例而言,可以设定内存组213的带宽大于内存组212的带宽,如图4C所示,内存组的地址段低于内存组212的地址段。如此,可以在不更改现有内存分配机制的情况下,优先将大带宽的内存组分配给软件颗粒1。具体而言,现有内存分配机制为:按照地址段的从低到高的顺序为软件颗粒分配内存空间,即低地址段的内存空间优先分配给软件颗粒。因此,将大带宽的内存组设置在低地址段,将小带宽的内存组设置在 高地址段,可以优先将大带宽的内存组分配给软件颗粒。
回到步骤304b,通过上述实施例的方案,内存组集合C1中的大带宽的内存组的地址段低,最大带宽的内存组的地址段是内存组集合C1中所有内存组的地址段中最低的。如此,在不更改现有内存分配机制的情况下,通过步骤304b中,将内存组集合C1中最大带宽的内存组分配给软件颗粒1。
在一些实施例中,可以设定软件颗粒1为高可靠性要求的软件颗粒,相应地,内存组集合C1中的内存组为高可靠性内存组。如图3所示,内存分配装置还可以执行步骤305,在内存组集合C1只包括一个内存组的情况下,判断内存组集合C1所包括的内存组的空间是否大于软件颗粒1所需空间。若内存组集合C1中的内存组的空间大于软件颗粒1所需空间,那么在计算机200启动软件颗粒2时,可以执行步骤306,将内存组集合C1中的内存组分配软件颗粒2,使得软件颗粒2和软件颗粒1可以共享内存组集合C1中的内存组。其中,软件颗粒2的可靠性要求低于软件颗粒1的可靠性要求,空间为内存空间。内存组的空间是否大于软件颗粒所需空间是指内存组的空间的大小是否大于软件颗粒所需空间的大小。
由此,不同可靠性要求的软件颗粒可共享高可靠性内存组,从而在避免高可靠性内存组的空间浪费的同时,也提高了低可靠性要求软件颗粒的运行稳定性。
通过上述方案可以将满足软件颗粒的可靠性要求的内存组分配给软件颗粒,使得高可靠性要求的软件颗粒能够分配到高可靠性内存组,从而保障了高可靠性要求的软件颗粒(即关键软件颗粒)的运行稳定性。并且,在满足软件颗粒对内存的可靠性要求的情况下,将大带宽的内存组分配给软件颗粒,从而保障了软件颗粒的运行性能。
在将内存组分配给软件颗粒后,处理器220可以利用软件颗粒所分配到的内存组运行软件颗粒。其中,在软件颗粒运行期间,处理器220调用该软件颗粒所分配到的内存组中的所有内存条,以运行软件颗粒。也就是说,处理器220可以同时利用软件颗粒所分配到的内存组中的所有内存条,来运行软件颗粒。具体而言,如上所述,在内存组中的内存条为多根时,该多根内存条的地址段可以相互交织,即该多根内存条的地址段被打散在该内存组的地址段中。其中,可以设定该内存组的地址段可以被划分为多个子地址段,其中,每个子地址段均包括该多根内存条中每根内存条的一段地址。如此,每当处理器220访问到一个子地址段时,可以访问到该多根内存条中的每根内存条,由此,处理器220可以利用该多根内存条运行软件颗粒。在一个例子中,可以设定组成内存组的内存条的数量为Q,则每个子地址段的长度可以为Q×256个字节,其中,在每个子地址段中,每根内存条共享了256个字节。如此,每当处理器220访问Q×256个字节的地址段时,可以访问到该Q根内存条。
示例性的,该Q根内存条中的每根内存条可以通过一个内存通道连接到处理器220,该Q根内存条通过Q个内存通道连接到处理器220。每当处理器220访问Q×256个字节的地址段时,可以通过Q个内存通道访问来访问Q×256个字节的地址段,从而提高了处理器220访问内存的速率,提高了软件颗粒的运行性能。
综合以上,本申请实施例的方案将计算机中的多根内存条划分为多个内存组,从而降低了单根内存条故障的影响范围。并且,多个内存组中内存组的可靠性高低不同,从而可以满足不同可靠性要求的软件颗粒对内存的需求,可以保障关键软件颗粒的运行稳定性,还可以保障非关键软件颗粒的运行性能。
基于上文所描述的内存分配方案,本申请实施例提供了一种内存分配方法。可以理解的是,该方法是上文所描述的内存分配方案的另一种表达方式,两者是相结合的,该方法中的部分或全部内容可以参见上文对内存分配方案的描述。
本申请实施例提供的内存分配方法可以应用于计算机,该计算机包括能够运行多种软件颗粒的处理器、多根内存条,其中,所述多根内存条组成多个独立的内存组,且一根内存条仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关。
如图5所示,该方法包括步骤501,为第一软件颗粒分配一个用于运行第一软件颗粒的内存组,其中,为所述第一软件颗粒分配的内存组的可靠性不低于所述第一软件颗粒的可靠性要求。。具体可以参考上文对图3中步骤302的介绍实现,在此不再赘述。
在一些实施例中,在所述第一软件颗粒的运行期间,所述处理器调用为所述第一软件颗粒所分配的内存组中的所有内存条的存储空间,以运行所述第一软件颗粒。具体可以参考上文对内存组的介绍实现,在此不再赘述。
在一些实施例中,不同内存组的带宽不同;所述为第一软件颗粒分配一个用于运行第一软件颗粒的内存组包括:在所述多种内存组中至少两个内存组的可靠性均满足所述第一软件颗粒的可靠性要求的情况下,优先将所述至少两个内存组中带宽最大的内存组分配给所述第一软件颗粒。具体可以参考上文对图3中步骤302至步骤304b的介绍实现,在此不再赘述。
在该实施例的一个示例中,所述带宽最大的内存组的地址段低于其他内存组的地址段,所述其他内存组为所述至少两个内存组中除所述带宽最大的内存组之外的内存组。
在一些实施例中,该方法还包括:为第二软件颗粒分配一个用于运行第二软件颗粒的内存组,其中,为所述第二软件颗粒分配的内存组的可靠性不低于所述第二软件颗粒的可靠性要求,其中,为第二软件颗粒分配的内存组与为第一软件颗粒分配的内存组相同或者不同。具体可以参考上文对图3中步骤302的介绍实现,在此不再赘述。
在一些实施例中,所述多个软件颗粒包括第一软件颗粒和第二软件颗粒,其中,所述第二软件颗粒的可靠性要求低于所述第一软件颗粒的可靠性要求,且所述多个内存组中的第一内存组的可靠性满足所述第一软件颗粒的可靠性要求;所述方法还包括:在所述第一内存组的空间大于所述第一软件颗粒所需的空间的情况下,将所述第一内存组分配给所述第一软件颗粒、第二软件颗粒共同使用。具体可以参考上文对图3中步骤305和步骤306的介绍实现,在此不再赘述。
在一些实施例中,所述内存组的地址段关联有可靠性等级,所述可靠性等级用于表示所述内存组的可靠性高低;所述为第一软件颗粒分配一个用于运行第一软件颗粒的内存组包括:根据所述第一软件颗粒的可靠性要求和所述多个内存组的地址段,为所述第一软件分配内存组。具体可以参考上文对图3中步骤301的介绍实现,在此不再赘述。
在一些实施例中,软件颗粒为程序、进程、线程中的任一种。具体可以参考上文对软件颗粒的介绍实现,在此不再赘述。
本申请实施例提供的内存分配方法,可以为软件颗粒分配满足其可靠性要求的内存组,从而可以满足软件颗粒对内存的可靠性要求,以及保障高可靠性要求软件颗粒的运行稳定性。
参阅图6,本申请实施例还提供了一种内存分配装置600。装置600可以配置于计算机,例如,计算机200。其中,该计算机包括能够运行多种软件颗粒的处理器、多根内存条,其中,所述多根内存条组成多个独立的内存组,且一根内存条仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关,所述多种软件颗粒中的不同软件颗粒对内存的可靠性要求不同。
如图6所示,装置600包括:获取单元610,用于获取第一软件颗粒的可靠性要求;分配单元620,用于为第一软件颗粒分配一个用于运行第一软件颗粒的内存组,其中,为所述第一软件颗粒分配的内存组的可靠性不低于所述第一软件颗粒的可靠性要求。
装置600的功能单元的功能可以参考上文对图5或图3所示各方法实施例的介绍实现,在此不再赘述。
本申请实施例提供了一种计算机700。如图7所示,计算机700包括处理器710、存储器720以及多根内存条730。其中,多根内存条730组成多个独立的内存组,且一根内存条730仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关。处理器719能够运行多种软件颗粒,该多种软件颗粒中的不同软件颗粒对内存的可靠性要求可能不同。存储器720存储有存储计算机指令。处理器710用于执行存储器720存储的计算机指令,使得处理器700可以执行上文图3所示的内存分配方案或图5所示的内存分配方法。
本申请实施例还提供了一种包含指令的计算机程序产品。所述计算机程序产品可以是包含指令的,能够运行在计算设备上或被储存在任何可用介质中的软件或程序产品。当所述计算机程序产品在计算设备上运行时,使得计算设备执行图5所示方法。
本申请实施例还提供了一种计算机可读存储介质。所述计算机可读存储介质可以是计算设备能够存储的任何可用介质或者是包含一个或多个可用介质的数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘)等。该计算机可读存储介质包括指令,所述指令指示计算设备执行图5所示方法。
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的保护范围。

Claims (14)

  1. 一种内存分配方法,其特征在于,应用于计算机,所述计算机包括用于运行软件颗粒的处理器、多根内存条,其中,所述多根内存条组成多个独立的内存组,且一根内存条仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关;
    所述方法包括:为第一软件颗粒分配一个用于运行所述第一软件颗粒的内存组,其中,为所述第一软件颗粒分配的内存组的可靠性不低于所述第一软件颗粒的可靠性要求。
  2. 根据权利要求1所述的方法,其特征在于,在所述第一软件颗粒的运行期间,所述处理器调用为所述第一软件颗粒分配的内存组中的所有内存条的存储空间,以运行所述第一软件颗粒。
  3. 根据权利要求1所述的方法,其特征在于,不同内存组的带宽不同;所述为第一软件颗粒分配一个用于运行所述第一软件颗粒的内存组包括:
    在所述多种内存组中至少两个内存组的可靠性均满足所述第一软件颗粒的可靠性要求的情况下,优先将所述至少两个内存组中带宽最大的内存组分配给所述第一软件颗粒。
  4. 根据权利要求3所述的方法,其特征在于,所述带宽最大的内存组的地址段低于其他内存组的地址段,所述其他内存组为所述至少两个内存组中除所述带宽最大的内存组之外的内存组。
  5. 根据权利要求1所述的方法,其特征在于,所述方法还包括:为第二软件颗粒分配一个用于运行所述第二软件颗粒的内存组,其中,为所述第二软件颗粒分配的内存组的可靠性不低于所述第二软件颗粒的可靠性要求,其中,为第二软件颗粒分配的内存组与为第一软件颗粒分配的内存组相同或者不同。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述内存组的地址段关联有可靠性等级,所述可靠性等级用于表示所述内存组的可靠性高低;
    所述为第一软件颗粒分配一个用于运行所述第一软件颗粒的内存组包括:
    根据所述第一软件颗粒的可靠性要求和所述多个内存组的地址段,为所述第一软件颗粒分配内存组。
  7. 根据权利要求1-6任一项所述方法,其特征在于,所述软件颗粒为程序、进程、线程中的任一种。
  8. 一种内存分配装置,其特征在于,配置于计算机,所述计算机包括能够运行软件颗粒的处理器、多根内存条,其中,所述多根内存条组成多个独立的内存组,且一根内存条仅属于一个组,每个内存组的可靠性与组成该内存组的内存条的数量负相关,所述多种软件颗粒中的不同软件颗粒对内存的可靠性要求不同;
    所述装置包括:
    获取单元:用于获取第一软件颗粒的可靠性要求;
    分配单元,用于根据所述第一软件颗粒的可靠性要求,为第一软件颗粒分配一个用于运行所述第一软件颗粒的内存组,其中,为所述第一软件颗粒分配的内存组的可靠性不低于所述第一软件颗粒的可靠性要求。
  9. 根据权利要求8所述的装置,其特征在于,不同内存组的带宽不同;所述分配单元用于:在所述多种内存组中至少两个内存组的可靠性均满足所述第一软件颗粒的可靠性要求的情况下,优先将所述至少两个内存组中带宽最大的内存组分配给所述第一软件颗粒。
  10. 根据权利要求8所述的装置,其特征在于,所述分配单元还用于:为第二软件颗粒分配一个用于运行所述第二软件颗粒的内存组,其中,为所述第二软件颗粒分配的内存组的可靠性不低于所述第二软件颗粒的可靠性要求,其中,为第二软件颗粒分配的内存组与为第一软件颗粒分配的内存组相同或者不同。
  11. 根据权利要求8-10任一项所述的装置,其特征在于,所述内存组的地址段关联有可靠性等级,所述可靠性等级用于表示所述内存组的可靠性高低;所述分配单元用于:根据所述第一软件颗粒的可靠性要求和所述多个内存组的地址段,为所述第一软件分配内存组。
  12. 一种计算机,其特征在于,包括用于执行如权利要求1-7任一项所述方法的所述处理器以及所述多根内存条。
  13. 一种计算机可读存储介质,其特征在于,包括计算机程序指令,当所述计算机程序指令由计算设备执行时,所述计算设备执行如权利要求1-7任一项所述的方法。
  14. 一种包含指令的计算机程序产品,其特征在于,当所述指令被计算机设备运行时,使得所述计算机设备执行如权利要求1-7任一项所述的方法。
PCT/CN2023/088113 2022-07-19 2023-04-13 内存分配方法、装置及计算机 WO2024016751A1 (zh)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN202210855152 2022-07-19
CN202210855152.4 2022-07-19
CN202211007369.6A CN117453385A (zh) 2022-07-19 2022-08-22 内存分配方法、装置及计算机
CN202211007369.6 2022-08-22

Publications (1)

Publication Number Publication Date
WO2024016751A1 true WO2024016751A1 (zh) 2024-01-25

Family

ID=89595376

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/088113 WO2024016751A1 (zh) 2022-07-19 2023-04-13 内存分配方法、装置及计算机

Country Status (2)

Country Link
CN (1) CN117453385A (zh)
WO (1) WO2024016751A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252422A (zh) * 2013-06-26 2014-12-31 华为技术有限公司 内存访问方法和内存控制器
KR20150127434A (ko) * 2014-05-07 2015-11-17 에스케이텔레콤 주식회사 메모리제어장치 및 메모리제어장치의 동작 방법
CN106844050A (zh) * 2017-01-19 2017-06-13 郑州云海信息技术有限公司 一种内存分配方法及装置
CN107305506A (zh) * 2016-04-20 2017-10-31 阿里巴巴集团控股有限公司 动态分配内存的方法、装置及系统
CN110287127A (zh) * 2019-05-14 2019-09-27 江苏大学 一种多粒度多核可扩展的非易失性内存管理方法及系统
US20200110639A1 (en) * 2018-10-07 2020-04-09 Hewlett Packard Enterprise Development Lp Memory allocator
CN111309644A (zh) * 2020-02-14 2020-06-19 苏州浪潮智能科技有限公司 一种内存分配方法、装置和计算机可读存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104252422A (zh) * 2013-06-26 2014-12-31 华为技术有限公司 内存访问方法和内存控制器
KR20150127434A (ko) * 2014-05-07 2015-11-17 에스케이텔레콤 주식회사 메모리제어장치 및 메모리제어장치의 동작 방법
CN107305506A (zh) * 2016-04-20 2017-10-31 阿里巴巴集团控股有限公司 动态分配内存的方法、装置及系统
CN106844050A (zh) * 2017-01-19 2017-06-13 郑州云海信息技术有限公司 一种内存分配方法及装置
US20200110639A1 (en) * 2018-10-07 2020-04-09 Hewlett Packard Enterprise Development Lp Memory allocator
CN110287127A (zh) * 2019-05-14 2019-09-27 江苏大学 一种多粒度多核可扩展的非易失性内存管理方法及系统
CN111309644A (zh) * 2020-02-14 2020-06-19 苏州浪潮智能科技有限公司 一种内存分配方法、装置和计算机可读存储介质

Also Published As

Publication number Publication date
CN117453385A (zh) 2024-01-26

Similar Documents

Publication Publication Date Title
WO2021004231A1 (zh) 一种闪存设备中的数据存储方法及闪存设备
US10795837B2 (en) Allocation of memory buffers in computing system with multiple memory channels
US20070043923A1 (en) Apparatus, system, and method for modifying data storage configuration
KR20160124794A (ko) Dram 결함들의 커널 마스킹
WO2021008197A1 (zh) 资源分配方法、存储设备和存储系统
WO2024093517A1 (zh) 内存管理方法及计算设备
WO2023045483A1 (zh) 一种存储设备、数据存储方法及存储系统
US20220107752A1 (en) Data access method and apparatus
US20210149804A1 (en) Memory Interleaving Method and Apparatus
CN115904688A (zh) 内存管理方法、装置、处理器及计算设备
WO2024016751A1 (zh) 内存分配方法、装置及计算机
US20230350795A1 (en) Dual-port memory module design for composable computing
CN115543222B (zh) 一种存储优化方法、系统、设备及可读存储介质
US20200364126A1 (en) Information Handling System to Allow System Boot when an Amount of Installed Memory Exceeds Processor Limit
US8788748B2 (en) Implementing memory interface with configurable bandwidth
WO2022063273A1 (zh) 一种基于numa属性的资源分配方法及装置
CN115512758A (zh) 应用感知存储器巡查擦洗技术
WO2024045846A1 (zh) 存储介质的迁移带宽调整方法、装置、系统以及芯片
US20230376427A1 (en) Memory system and computing system including the same
US20240143220A1 (en) Data swapping method and apparatus
WO2023240719A1 (zh) 内存测试方法及装置、存储介质及电子设备
CN117149447B (zh) 带宽调整方法、装置、设备及存储介质
US11733927B2 (en) Hybrid solid-state drive
US20230266883A1 (en) Memory allocation method and apparatus, electronic device, and storage medium
CN117785755B (zh) Cxl内存模组及资源配置方法、控制芯片、介质和系统

Legal Events

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

Ref document number: 23841824

Country of ref document: EP

Kind code of ref document: A1