Compressed Computer Memory Access
By using sector-based memory management and sector-based translation metadata, the problem of low efficiency in managing variable memory page sizes and address translation in compressed storage systems is solved, resulting in more efficient memory utilization and access speed.
Patent Information
- Application Number
- CN201980074978.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-11-14
- Publication Date
- 2024-11-29
- Estimated Expiration
- 2039-11-14
AI Technical Summary
Existing technologies in compressed storage systems suffer from problems such as low efficiency in managing variable storage page sizes, locating data in compressed storage, and large amounts of metadata or long waiting times during address translation, leading to low memory utilization and stability issues.
A sector-based memory management method is adopted, which represents compressed memory blocks as sectors, uses sector-based translation metadata for address translation, and manages memory space rationally through sector merging units and compressors, thereby reducing the amount of metadata and improving memory utilization and access efficiency.
Effective management of free space in compressed storage improves data location efficiency, reduces the amount of metadata involved in address translation, enhances storage utilization and access speed, and avoids stability issues.
Smart Images

Figure CN113015966B_ABST
Abstract
Description
Technical Field
[0001] The present subject matter relates generally to the field of data compression of memories in electronic computers. Background Art
[0002] Data compression is a general technique for storing and transferring data more efficiently by encoding frequent data sets more efficiently than infrequent data sets (collection of data). For many reasons, it is usually meaningful to store and transfer data more efficiently. In computer memory, such as in a memory that holds data and computer instructions that a processing device runs on, such as a main memory or cache memory, it is interesting to store the data more efficiently, say K times, because the size of the memory can be potentially reduced to 1 / K of the original, the data can be transferred between the memory and another memory using the communication capacity that is potentially reduced to 1 / K of the original, and the data can be stored and transferred within or between computer systems and / or between memories using the energy cost that is potentially reduced to 1 / K of the original. Optionally, K times of data can be potentially stored in available computer memory compared to without data compression. It is interesting to obtain K times the potential performance of a computer without adding more memory, which may be expensive or may be less than ideal due to resource constraints. As another example, the size and weight of a smartphone, tablet, laptop / desktop, or set-top box is limited because a larger or heavier smartphone, tablet, laptop / desktop, or set-top box is less valuable to the end user; thus potentially reducing the market value of such products. However, more storage capacity may potentially increase the market value of the product because more storage capacity can lead to higher performance, thereby increasing the usefulness of the product.
[0003] In summary, in the overall layout of a computerized product, including isolated devices or interconnected devices, data compression can potentially improve performance, reduce energy consumption, or reduce the cost and area of memory overhead. Therefore, data compression has broad utility in a variety of computerized products beyond those mentioned herein.
[0004] Prior art compression storage systems typically compress storage pages as they are created, either by reading from disk or via memory allocation. Compression can be accomplished using a variety of well-known methods, either through software routines or hardware accelerators. When a processor requests data from memory, the data must be decompressed before servicing the requesting processor. Since such requests ultimately end up on the critical memory access path, decompression is typically hardware accelerated to minimize the impact on memory access time.
[0005] One problem with compressed memory systems is that they face the problem of managing memory pages of variable size. Unlike conventional memory systems without compression, where all pages are the same size, in compressed memory systems the size of each page depends on the compressibility of the page, which is highly data-dependent. Furthermore, since modifications to the data in a page may affect its compressibility, the size of each page may change during its lifetime in main memory. To this end, a fundamental problem is how to dynamically manage the amount of memory freed up by compression.
[0006] In compressed storage systems, the existing technology for managing freed storage space takes a variety of approaches. Typically, storage management is an integral part of the operating system, and more specifically, the virtual memory management (VMM) routines. The task of the VMM is to efficiently manage the available physical main storage space. At boot time, the VMM typically establishes how much physical main memory is available. From there, it can decide which pages should reside in the available physical storage space based on demand; when necessary, the VMM typically chooses pages that are unlikely to be accessed soon as victims of page out to disk. However, in compressed storage, the amount of available storage capacity changes dynamically. For this reason, conventional VMM routines do not work because they assume that the amount of physical memory is fixed at boot time.
[0007] An alternative approach is to modify the VMM to understand the amount of memory available at any point in time. However, this is highly undesirable because changes to the operating system must be applied to the computer system regardless of whether the operating system uses compression. In contrast, several approaches in the prior art address the management problem in a way that is open to the operating system. One approach is to have the operating system boot up with the assumption that the amount of physical memory is greater than the amount of available memory. If the amount of memory freed by compression is less than that amount, pages are swapped to disk to reduce memory pressure. However, this solution may have stability issues due to thrashing and is therefore undesirable.
[0008] Another method exposed to the operating system is to reserve a storage area in the main memory as swap space. Instead of evicting pages to a secondary storage device (such as a disk), the pages are evicted to the reserved swap space. The advantage of this is that it can be much faster than transferring from the secondary storage to the memory, which may be much slower than the memory. However, this reduces the size of the memory directly accessible to the system. Pages swapped to the swap space can be selectively compressed, thereby making more efficient use of the swap space. However, the swap space is usually a small portion of the available physical storage capacity, usually a few tens of percent. For example, assume that the swap space occupies 20% of the available physical storage capacity. In addition, assume that the compression ratio is 2. When the swap space is combined with compression, it will release 0.8×1+0.2×2=1.2, that is, 20% of the storage space. On the contrary, if all data in the entire memory is compressed, 100% of the storage space can be released.
[0009] Clearly, there is a need for systems and methods to manage free space in compressed memory that are open to the operating system and that allow all memory to be compressed without suffering from stability issues.
[0010] Another problem associated with compressed storage systems is how to efficiently locate an item in compressed storage. In compressed storage, each individual cache line or storage block (hereinafter, block and line are used interchangeably), like a storage page, has a variable size. In addition, the variable-sized compressed data must be compacted, which may change the layout of the memory. Therefore, storage pages and blocks do not have to be placed in their original locations in conventional non-compressed storage systems.
[0011] In the prior art, one method of coordinating address conversion between physical addresses and compressed addresses is to divide the physical memory into fixed-size units, referred to herein as segments. For example, a 4KB storage page can be divided into four segments, making the size of the segment 1KB. Now, if the compression factor of the page is 2, it will require two segments instead of four segments as in a conventional non-compressed storage system. In order to locate storage blocks using the concept of segmentation, metadata is required as part of the address conversion to locate the segment where the requested storage block resides. The advantage of larger segments is that the amount of metadata required to locate the segments is reduced, but the disadvantage is that it leads to more internal fragmentation, thereby reducing memory utilization. Therefore, this method either has a large amount of metadata or low memory utilization.
[0012] Cache systems typically manage data at the granularity of a storage block, which is typically 64B in size. Since storage blocks have variable sizes in a compressed storage system, there is an additional problem of how to locate them within a compressed storage page. One method in the prior art is to use a pointer to locate a block within a storage page. For example, if the page size is 4KB, a 12-bit pointer can locate any block within the page. Assuming the block size is 64B, there are 64 blocks within a 4KB storage page. Therefore, each storage page requires up to 64×12 bits=768 bits of metadata.
[0013] Another method in the prior art is to associate each block with the size of the block. For example, if 64 different sizes are accommodated, the metadata for encoding the size of each storage block will require 6 bits. In this case, the amount of metadata associated with the storage page used to locate each block is 64×6=384, which is much less than using pointers. However, to locate a certain block, such as the last block, it will be necessary to sum the sizes of all blocks before the block in the storage page, which may cause a lot of latency in the address conversion process. In order to shorten the latency, the size of the compressed block can be limited. However, this will greatly reduce the utilization of the compressed memory. For example, assume that the four blocks are compressed by factors of 2, 4, 8 and 16. Using a pointer-based method, all possibilities of compression will be obtained, resulting in a compression factor of 4 / (1 / 2+1 / 4+1 / 8+1 / 16)=4.3, while limiting the size to 4 will produce a compression factor of 4 / (1 / 2+1 / 4+1 / 4+1 / 4)=3.2.
[0014] The metadata required to locate storage blocks in a compressed storage system is typically cached on the processor chip, similar to the role of translation-lookup-buffering in conventional computer systems for virtual to physical address translation to avoid having to access memory to locate storage blocks in physical memory. Because this address translation mechanism must be fast, it is limited in size and is generally unable to store all required metadata. Therefore, all metadata needs to be placed in memory (or storage). Therefore, it is necessary to limit the amount of metadata to save storage space and reduce the additional memory accesses required to bring metadata from memory to the address translation mechanism on the processor chip. However, as previously described, methods for reducing the size of metadata in the prior art may increase a large amount of waiting time in the address translation mechanism, or may result in poor utilization of compressed memory due to fragmentation.
[0015] Therefore, prior art address translation methods suffer from either large amounts of metadata, large amounts of latency in the address translation process, or poor compressed memory utilization due to fragmentation. Clearly, there is a need for a system, apparatus, and method to more efficiently locate data in a modified physical address space or additional compressed address space than is known in the prior art.
[0016] Furthermore, there is a substantial need for a system and method for managing free space in a compressed memory more efficiently than methods known in the prior art. Summary of the invention
[0017] It is an object of the present invention to provide improvements in the field of data compression in the memory of an electronic computer and to solve, eliminate or mitigate one or more of the above problems.
[0018] The first aspect of the present invention is a device for accessing a compressed computer memory residing in a physical computer memory, the device comprising an address translation table, a compressed address calculator unit, a sector request unit, a selector unit, a sector merging unit, a decompressor and a compressor.
[0019] The address translation table, the compressed address calculator unit, and the sector request unit are configured in combination to translate a physical memory access request into a sector-based compressed memory request, wherein a sector ID is automatically extracted using the address of the physical memory access request, the sector ID is used to determine the location of the sector in the compressed computer memory from the sector-based translation metadata, calculate the compressed address and size of the determined sector, and make a sector request to the compressed computer memory based on the compressed address and size.
[0020] The decompressor and selector units are configured in combination to operate on compressed sector data retrieved from a compressed computer memory in response to a sector request to obtain read request response data from the compressed sector data using the address and size of the physical memory access request, and to return the obtained read request response data in a decompressed form to the source of the physical memory access request as a read request.
[0021] The sector merging unit and the compressor are configured in combination to merge the data of the compressed sector data (such as retrieved from the compressed computer memory in response to the sector request) with the data in the physical memory access request to obtain sector-based write request data using the address and size of the physical memory access request as a write request, and store the obtained sector-based write request data as compressed sector data in the compressed computer memory.
[0022] A second aspect of the present invention is a corresponding method for accessing a compressed computer memory residing in a physical computer memory. The method comprises: a) converting a physical memory access request into a sector-based compressed memory request, wherein a sector id is automatically extracted using the address of the physical memory access request, the sector id is used to determine the location of the sector in the compressed computer memory from the sector-based conversion metadata, calculate the compressed address and size of the determined sector, and make a sector request to the compressed computer memory based on the compressed address and size.
[0023] The method also includes: b) operating on compressed sector data retrieved from a compressed computer memory in response to a sector request to obtain read request response data from the compressed sector data using the address and size of the physical memory access request, and returning the obtained read request response data in a decompressed form to the source of the physical memory access request as a read request.
[0024] In addition, the method includes: c) merging the data of the compressed sector data retrieved from the compressed computer memory in response to the sector request with the data in the physical memory access request to obtain sector-based write request data using the address and size of the physical memory access request as a write request, and storing the obtained sector-based write request data as compressed sector data in the compressed computer memory.
[0025] A third aspect of the present invention is a method for accessing compressed computer memory residing in physical computer memory. The method includes representing compressed memory blocks as sectors, wherein all sectors contain a fixed number of compressed memory blocks, such as cache lines, the sectors have a fixed logical size in the form of a fixed number of compressed memory blocks, and all sectors have a varying physical size in the form of a total size of data stored in each compressed memory block; providing sector-based translation metadata to track sectors within a compressed memory page; receiving a physical memory access request including an address in a physical computer memory; using the address in the physical memory access request to derive a memory block index; using the memory block index and the fixed logical size of the sector to determine a sector id; using the sector-based translation metadata to locate a sector having a sector id in a compressed memory page; and using the address of the physical memory access request to locate requested data within the sector.
[0026] A fourth aspect of the present invention is an apparatus for accessing compressed computer memory residing in a physical computer memory. The apparatus includes: means for representing compressed memory blocks as sectors, wherein all sectors contain a fixed number of compressed memory blocks, such as cache lines, all sectors have a fixed logical size in the form of a fixed number of compressed memory blocks, and all sectors have a varying physical size in the form of a total size of data stored in each compressed memory block; means for providing sector-based translation metadata to track sectors within a compressed memory page; means for receiving a physical memory access request including an address in a physical computer memory; means for using the address in the physical memory access request to derive a memory block index; means for using the memory block index and the fixed logical size of the sector to determine a sector id; means for using the sector-based translation metadata to locate a sector having a sector id in a compressed memory page; and means for using the address of the physical memory access request to locate requested data within the sector.
[0027] A fifth aspect of the present invention is a method for deriving compression metadata of a specific size that maximizes a target effect for compressing a block of data. The method includes: analyzing the size of the compressed block; and deriving the frequency and size distribution of the compressed block; identifying one or more candidate compressed block sizes to which the compressed block will be rounded; evaluating whether the identified size maximizes the target effect when represented by the metadata of the specific size; if so, generating a compression metadata format accordingly, or, otherwise, repeating the method from the deriving step.
[0028] The sixth aspect of the present invention is a device for deriving compression metadata of a specific size, which maximizes the target effect for compressing a block of data. The device includes: a device for analyzing the size of the compressed block; and a device for deriving the frequency and size distribution of the compressed block; a device for identifying one or more candidate compressed block sizes to which the compressed block will be rounded; a device for evaluating whether the identified size maximizes the target effect when represented by the metadata of the specific size; and a device for generating a compressed metadata format, which undergoes successful evaluation by the device for evaluating.
[0029] A seventh aspect of the present invention is a sector-based memory compression system comprising a compressed memory; a device for accessing compressed computer memory according to the first aspect of the present invention; and a free memory management device. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1A prior art computer system is described that includes a microprocessor chip having one or more processing units, a typical three-level cache hierarchy, one or more memory controllers connected to one or more off-chip memories.
[0031] Figure 2 Describes Figure 1 A prior art computer system is shown, which is configured to compress and decompress data and instructions in a memory.
[0032] Figure 3 Describes Figure 1 A prior art computer system is shown which can implement compressed memory using operating system functions and the concept of swap memory.
[0033] Figure 4 Describes Figure 2 Shown is how a computer system with compressed memory augmented with selectors and auxiliary memory as disclosed herein interacts with an operating system and disk.
[0034] Figure 5 The memory layout of the disclosed compressed storage space is described.
[0035] Figure 6 A process by which an auxiliary memory maintains a memory layout of a compressed storage space is described.
[0036] Figure 7 Describes the data structures used to locate pages stored in secondary storage.
[0037] Figure 8 An exemplary layout of the contents of secondary storage is described.
[0038] Fig. 9 The process by which auxiliary storage intercepts and responds to page-out requests from the VMM is described.
[0039] Fig.10 The process by which auxiliary storage intercepts and responds to page-in requests from the VMM is described.
[0040] Fig.11 Describes the address translation from virtual addresses to physical addresses to compressed addresses.
[0041] Fig.12 An exemplary memory layout of compressed pages for a zero-copy auxiliary memory implementation and the metadata required to support the layout are described.
[0042] Fig.13 An exemplary process for a swap-in operation in a zero-copy secondary storage implementation is described.
[0043] Fig.14 An exemplary process for a swap-out operation in a zero-copy secondary storage implementation is described.
[0044] Fig.15 An exemplary memory layout of compressed pages is described for use in embodiments where compressed page segmentation is used to better utilize free storage space.
[0045] Figure 16 includes two pairs Fig.16A and 16B . Fig.16A describes the layout of the uncompressed pages that contain cache lines, while Fig. 16B The same page described in compressed form contains both compressed and compacted cache lines.
[0046] Fig.17 An exemplary memory layout for a coarse-grain segmented memory is described in which compressed pages are associated with contiguous segments.
[0047] Fig.18 An exemplary memory layout of a coarse-grained segmented memory is described in which compressed pages are associated with non-contiguous segments.
[0048] Fig.19 An exemplary memory layout for a fine-grain segmented memory is described in which compressed pages are associated with contiguous segments.
[0049] Fig. 20 An exemplary sector layout in uncompressed form is described.
[0050] Fig.21 An exemplary sector layout in compressed form is described.
[0051] Fig. 22 An exemplary sector-based translation metadata format is described, where the sector metadata includes a sector pointer (PTR).
[0052] Fig.23 An exemplary sector-based translation metadata format is described, where the sector metadata includes a sector pointer (PTR), and compression size metadata (CSM) is mixed with the compressed data.
[0053] Fig.24An exemplary sector-based translation metadata format is described, where the sector metadata includes a sector pointer (PTR) and a compressed sector size (SIZE) and compressed size metadata (CSM) is mixed with compressed data.
[0054] Fig.25 A first embodiment of a method for accessing compressed computer memory residing in physical computer memory is described, wherein conversion metadata follows Fig. 22 An exemplary format of and wherein the method is Fig. 27 Associated with the devices in.
[0055] Fig.25B A third embodiment of a method for accessing compressed computer memory residing in physical computer memory is described, wherein the method is Fig.28 Associated with the devices in.
[0056] Fig.26 A second embodiment of a method for accessing compressed computer memory residing in physical computer memory is described, wherein the conversion metadata follows Fig.23 or Fig.24 The exemplary format of this method is Fig.27B Associated with the devices in.
[0057] Fig. 27 A first embodiment of an apparatus for accessing compressed computer memory residing in physical computer memory is described, wherein the apparatus is Fig.25 The methods in are associated.
[0058] Fig.27B A second embodiment of a device for accessing compressed computer memory residing in physical computer memory is described, wherein the device is Fig.26 The methods in are associated.
[0059] Fig.27C An alternative to the second embodiment of an apparatus for accessing compressed computer memory residing in physical computer memory is described.
[0060] Fig.28 A third embodiment of an apparatus for accessing compressed computer memory residing in physical computer memory is described, wherein a dynamic data selection control (Ctrl) mechanism is added, and wherein Fig.25B The relevant method is shown in .
[0061] Fig.29 An exemplary sector-based hybrid translation metadata format is described, where the address translation metadata includes a sector pointer (PTR) and a cache line size (CL-SIZE).
[0062] FIG. 30A to FIG. 30B A first example of a sector-based hybrid conversion method is described, where the conversion metadata follows Fig.29 An exemplary format of , and wherein sectors are always fetched upon a read request, but compressed data is written at a sector or cache line interval size, wherein Fig. 30B yes Fig. 30A Detailed view of some parts of the .
[0063] FIG. 31A to FIG. 31D A second example of a sector-based hybrid conversion method is described, where the conversion metadata follows Fig.29 An exemplary format of wherein a dynamic data selection control (Ctrl) process is added to decide whether the compressed data extracted according to the read request is a compressed sector or a compressed cache line, and wherein FIG. 31B to FIG. 31D yes Fig.31A Detailed view of the .
[0064] Fig.32 A fourth embodiment of an apparatus for accessing compressed computer memory residing in physical computer memory is described, wherein the conversion metadata follows Fig.29 An example format of .
[0065] Figure 33 includes Fig.33A and Fig.33B Each figure describes an exemplary sector-based hybrid translation metadata format, where the compressed cache lines within each sector are limited to a specific size, so the address translation metadata includes a sector pointer (PTR) and one CL-SIZE per sector. Fig.33A The sector log size (SectorLogSize) is 8. Fig.33B The number in the middle is 4.
[0066] Fig.34 An exemplary sector-based transformed metadata format is described, where the order of the compressed data within each sector has been changed to coefficients of spatial reference locality (a stride of 2 in this figure).
[0067] Fig.35 Exemplary compressed pages are described in which compressed cache lines are compacted and can be placed at any byte position.
[0068] Fig.36 Describes Fig.35 An exemplary compressed page of FIG. 1 , where compressed cache lines are associated with fixed-size segments so their locations in the compressed space are aligned with segment boundaries.
[0069] Fig.37 Describes Fig.35An exemplary compressed page of , where compressed cache lines are associated with segments of variable size, so their location in the compressed space adapts to the most frequently compressed cache line size. This uses the same Fig.36 Same metadata, but enables better compression and compression space utilization.
[0070] Fig.38 An implementation of a heuristic method is described that finds an appropriate variable-length segment format that minimizes overhead.
[0071] Figure 39 includes two Fig.39A and Fig.39B . Fig.39A An exemplary page frame is described in which sectors are compressed but aligned in their original positions (as when uncompressed), leaving unused free space. Fig.39B Describes Fig.39A where sector 1 has expanded in size due to dynamic data changes within sector 1.
[0072] Figure 40 includes two Fig.40A and Fig.40B . Fig.40A An exemplary page frame is described, in which a compressed page includes sectors compressed and compacted adjacent to each other so as to utilize free space (release area) to map a victim page and a range associated with the compressed page. Fig.40B Describes Fig.40A where sector 1 has expanded in size due to dynamic data changes within sector 1.
[0073] FIG. 41A to FIG. 41C An embodiment of a sector overflow method is described, wherein FIG. 41B to FIG. 41C yes Fig.41A Detailed view of the .
[0074] Fig.42 Implementations of a sector overflow device are described.
[0075] Fig.43 An embodiment of a memory compression system is described, which includes a sector-based address translation device, a sector overflow device, an auxiliary memory device, a compression and decompression device, and a compressed memory, which also includes intervals and compressed data.
[0076] Fig.44 A compressed memory management method for a computer system as described herein is described.
[0077] Fig.45 Methods for accessing compressed computer memory residing in physical computer memory as described herein are described. DETAILED DESCRIPTION
[0078] Computer systems without compressed memory
[0079] Figure 1 An exemplary embodiment of a conventional computer system 100 is described in . The system includes a microprocessor chip 110 and one or more memory modules, which are denoted as M1 151, M2 152 to MK 153 and are collectively referred to as main memory. The microprocessor chip can be a discrete system or integrated on a system on a chip (SoC) in any available technology. The microprocessor 110 includes one or several processing units, denoted as P1 131, P2 132 to PN 133, sometimes referred to as CPU or core and a memory hierarchy. On the other hand, the memory hierarchy includes several cache levels, such as Figure 1 100 and are denoted as C1, C2, and C3. The levels may be implemented with the same or different memory technologies, such as SRAM, DRAM, or any type of non-volatile technology, including, for example, phase change memory (PCM). The number of cache levels may vary in different embodiments, and exemplary embodiment 100 depicts three levels, with the last cache level being C3 120. The levels are connected using some interconnection means (e.g., a bus or any other interconnection network, such as a mesh or spiral ring). In the exemplary embodiment, levels C1 and C2 are private and are accessed only by their respective processing units i, denoted as Pi (e.g., Figure 1 It is well known to those skilled in the art that alternative implementations may have any number of private cache levels, or alternatively, such as Figure 1 As shown in the third level C3 120 in FIG. 1 , all cache levels are shared. Any implementation is possible with respect to the inclusion strategy of data in the cache hierarchy and can be understood by those skilled in the art. For example, C1 can be included in C2, while C2 can be non-inclusive with respect to level C3. Those skilled in the art can understand alternative implementations. Figure 1 The exemplary computer system 100 includes one or more memory controllers, which are represented as MCTRL1 141, MCTRL2 142, through MCTRLL 143. The last cache level ( Figure 1 The memory controller is connected to the memory controller, which in turn is connected to one or more memory modules. The memory controller can be integrated on the microprocessor chip 110, or can be implemented outside the microprocessor chip. Finally, the computer system runs one or more tasks. A task can be any software application or part thereof that can be run on a particular system.
[0080] like Figure 1 As illustrated in the embodiment of FIG. 1 , a computer system may suffer from limited capacity of memory represented as M1 151 through MK 153 and cache memory regardless of the level (e.g., Figure 1 C1, C2 and C3 in ). Limited cache capacity can manifest itself as a higher fraction of memory requests that must be serviced at the next level in the storage hierarchy, resulting in performance loss or higher energy consumption. To alleviate this problem, it may be considered to increase the cache capacity, thereby reducing the number of requests that need to be serviced by the next level of the storage hierarchy. Increasing the capacity of the cache level on a microprocessor chip will lead to several problems. First, the cache access request time will increase, resulting in performance degradation. Second, the energy expended by access requests to larger caches may potentially be higher. Third, a larger cache level implemented using more silicon or equivalent materials on a microprocessor chip may have to be traded for less processing power. Therefore, it is desirable to implement more cache capacity without the above problems. Limited storage capacity has similar problems and can manifest itself in more memory requests that will have to be serviced at the next level of the storage hierarchy, which is usually implemented as a storage level of the storage hierarchy. Typically, the access speed of such a storage level is quite slow and may result in a considerable loss of performance and energy consumption. Increased storage capacity can alleviate these disadvantages. However, more storage capacity increases the cost of the computer system at the component level or in terms of energy costs. In addition, more memory costs more space, which may limit the practicality of the computer system, especially in products with limited form factors, including, for example, mobile computers such as tablets, smartphones, wearable devices, and small computerized devices connected to the Internet (also known as IoT (Internet of Things) devices). Finally, the bandwidth provided by the storage module may not be sufficient to respond to requests from the processing unit. This may manifest itself as reduced performance.
[0081] Computer system with compressed memory
[0082] In order to specifically address the issues of limited main storage capacity and limited memory bandwidth, Figure 1 The exemplary system in can be configured to compress data and instructions into main memory. Figure 2Such a computer system 200 is shown. Three functional blocks are added to the microprocessor chip 210. These blocks include an address translation unit 211, a compressor unit 212, and a decompressor unit 213. These blocks are connected to the memory controller on one side and to the last level cache C3 on the other side. The purpose of the address translation unit 211 is to convert the conventional physical address PA into a compressed address CA to locate the storage block in the compressed memory. Those skilled in the art recognize that such address translation is needed in the compressed memory because the fixed-size page (e.g., 4KB) used in the uncompressed conventional system can be compressed to any size that is less than the fixed size of the physical address space in the compressed storage system.
[0083] The purpose of the compressor unit 212 is to compress memory blocks that have been modified and evicted from the last level cache. In order to have a negligible impact on the performance of the memory system, compression must be fast and is usually accelerated by a dedicated compressor unit. Similarly, when a memory block is requested by a processor and is in any level cache (e.g., Figure 2 The storage block must be requested from the main memory M1-MK when it is not available in C1, C2 and C3 in the exemplary embodiment of the present invention. The address translation unit 211 will locate the block, but before installing it in the cache level, for example in C1, it must be decompressed. The purpose of the decompressor unit 213 is to speed up this process so that the impact on the performance of the storage system is negligible. Those skilled in the art recognize that the functions of the compressor unit and the decompressor unit depend on the type of compression algorithm used. In one embodiment, a base-delta encoding can be used, in which the difference between the value and the base value is stored instead of the value itself. In another embodiment, Huffman encoding can be used, in which more frequent values than other values use more dense encoding. Those skilled in the art recognize that there are multiple methods with their own advantages and disadvantages when it comes to the compression ratio they achieve and the impact on performance during the compression process and the decompression process.
[0084] One of the goals of a compressed memory system is to efficiently increase the primary memory and avoid costly accesses to secondary slower memory or secondary storage devices (eg, disks). Figure 3 As an exemplary embodiment, a computer system 300 is shown, which has been expanded (with Figure 23) has secondary storage in the form of disk 330. In conventional computer systems, when a memory block cannot be located in the main memory (e.g., memory chips M1 to MK), the corresponding memory page is transferred from the secondary storage (i.e., disk 330). By compressing the memory blocks in the main memory, more pages can be stored, thereby avoiding certain costly page transfers to the disk. These additional pages are stored in the storage space released during the compression process, hereinafter referred to as free space.
[0085] like Figure 1 A conventional computer system without compressed memory as shown in can still obtain the capacity increase using conventional support in the operating system. Figure 3 Shown according to Figure 1 A conventional computer system 300 without compressed memory according to an embodiment of the present invention is shown. In a conventional memory system, the virtual memory manager (VMM) in the operating system 320 is responsible for making requests to the disk 330 when a new page is requested (page in) or a modified page is evicted to make room for another page (page out). Some systems provide a fixed-size area in the physical memory (here, the memory modules M1 and M2 311 are used as an example), called swap memory 340, to accommodate certain pages that are evicted or paged out, regardless of whether they have been modified. Optionally, they are compressed before being stored in the swap memory (for example, as in ZSWAP or ZRAM). However, such swap memory usually only occupies a small portion of the available physical memory, usually tens of percentages, such as 20%, to avoid costly disk accesses, and does not use the free space provided by the compressed storage system, which has the potential to compress all pages. Instead, what is disclosed next is an auxiliary memory that manages the space freed up in the available physical memory through compression to give people the illusion of larger physical memory. Next, we will provide an overview of the basic concepts and operations of auxiliary memory. Later, we will explain in detail how auxiliary memory is implemented and how it operates.
[0086] Auxiliary Memory - Basic Concepts
[0087] In a compression storage system, some portion of a fixed-size physical memory will be used to compress storage blocks - called the active portion, while the rest of the physical memory will include the portion that is freed up by memory compression and is not used - the passive portion. Auxiliary memory consists of the passive portion to expand the capacity of the physical memory. Auxiliary memory management expands the capacity of the memory by placing pages in the freed-up portion for use by the processor. In some embodiments, pages are moved between the active and passive portions of the physical memory, while in other embodiments, the active and passive portions are accessed directly.
[0088] Figure 4 An overview of the disclosed auxiliary memory concept is provided. A compressed memory management arrangement 405 is provided for a computer system 400. The computer system 400 has one or more processors P1-PN, a compressible main memory 414, a secondary memory, and an operating system 420. The compressible main memory 414 has a compressed storage space including an active portion directly accessible to the one or more processors P1-PN and an inactive portion not directly accessible to the one or more processors P1-PN, the compressed storage space being in the form of memory released by memory compression.
[0089] The compressed memory management arrangement 405 includes an auxiliary memory 440 for maintaining a layout of a compressed memory space of the compressible main memory 414. The layout includes the size and location of each memory page and free memory areas in the compressed memory space. In addition, the compressed memory management arrangement 405 includes a selector function 430 that enables the operating system 420, the secondary memory, and the auxiliary memory 440 to interact.
[0090] As will be described in detail below, the memory management settings 405 are configured to a) trigger compression of storage pages in the compressible main memory 414; b) intercept page-in requests made from the operating system 420 to the secondary memory, use the layout of the compressed storage space maintained by the auxiliary memory 440 to locate the page requested by the page-in in the auxiliary memory 440 when available, and make the located requested page available in the active portion of the compressed storage space; and c) intercept page-out requests made from the operating system 420 to the secondary memory, use the layout of the compressed storage space maintained by the auxiliary memory 440 to obtain a free area for the page requested by the page-out request, and accommodate the requested page in the free area obtained in the auxiliary memory 440.
[0091] In some embodiments, the auxiliary memory 440 (i.e., the inactive portion of the compressed storage space) physically resides in the compressible main memory 414 and represents the area of the compressible main memory 414 that is freed up by memory compression. In other embodiments, the auxiliary memory 440 may maintain the layout of the compressed storage space of the compressible main memory 414 in the form of a memory that is physically separate from the compressible main memory 414.
[0092] As will be explained in further detail below, the selector function 430 of the compression memory management setting 405 can be configured to trigger the compression of the memory page according to system conditions and related policies. In addition, when a memory page is to be paged out or when a memory page is to be paged in, the selector function 430 can be configured to trigger the compression of the memory page in the allocation of a new memory page (see below). Figure 6 611 in triggers the compression of storage pages.
[0093] Fig.44 A corresponding general compressed memory management method 4400 for a computer system 400 is disclosed in . The compressed memory management method 4400 includes maintaining 4410 in the auxiliary memory 440 a layout of a compressed storage space of the compressible main memory 414, the layout including the size and location of each storage page and free storage areas in the compressed storage space. The method also includes: a) triggering 4420 compression of storage pages in the compressible main memory 414; b) intercepting 4430 a page-in request made from the operating system 420 to the secondary memory, using 4432 the layout of the compressed storage space maintained by the auxiliary memory 440, locating the page requested by the page-in request in the auxiliary memory 440 when available, and making 4434 the located requested page available in the active part of the compressed storage space, and c) intercepting 4440 a page-out request made from the operating system 420 to the secondary memory, using 4442 the layout of the compressed storage space maintained by the auxiliary memory 440 to obtain a free area for the page requested by the page-out request, and accommodating 4444 the requested page in the obtained free area of the auxiliary memory 440.
[0094] Reference Figure 4 , at any point in time, the free space is composed of Figure 4 The auxiliary storage 440 shown is tracked and managed. The auxiliary storage 440 can interact with the computer system 410 through a device driver (herein referred to as a selector and implements the selector function 430 described above), which is as shown in FIG. Figure 2The supported compressed memory shown is usually accessed by conventional operating system routines. In one exemplary embodiment, the device can have an interface similar to a disk. In another exemplary embodiment, the device can have an interface similar to a front-end swap. Selector 430 can also trigger the compression of pages. The auxiliary memory can access the free space of the main memory in a manner to be described later. Similar to the memory devices proposed in the prior art (such as ZSWAP or ZRAM), the goal of the auxiliary memory is to avoid expensive access to the disk by swapping them to a certain area in the physical memory (freeing up space) instead of swapping to the disk. However, technologies such as ZSWAP specifically demarcate fixed storage areas for memory devices and optionally attempt to compress their contents to make room for more pages in the above-mentioned areas. However, they do not take advantage of the storage space released in the entire physical memory provided by the compressed storage system.
[0095] The auxiliary memory disclosed herein collects all the storage space released in the compression storage system. Since the amount of memory released varies over time, depending on the current compression ratio, the auxiliary memory does not have a fixed size. Its size is the same as the current amount of free space available, and will change over time in accordance with the compressibility of the pages present in the main memory.
[0096] Secondary Memory - First Implementation
[0097] Now, a detailed description is given of how the auxiliary memory is implemented and operated in one embodiment. Figure 5-9 . This embodiment should not be interpreted as a preferred embodiment. Those skilled in the art may implement alternative embodiments. It is intended that such alternative embodiments are also included in the content disclosed in the present invention.
[0098] Figure 5 An exemplary memory layout is shown of how physical pages in physical address space 510 are mapped into compressed memory in compressed address space 520. In a conventional memory system, physical pages are mapped one by one in main memory as shown in the memory layout of physical address space 515. For example, assuming a page size of 4KB, the first page starts at address 0, and the next page starts at byte address 212, and so on.
[0099] In the described embodiment, it is assumed that any physical page will start at the same address in the compressed memory space as in a conventional non-compressed (linear) physical address space. For example, as seen in the memory layout of compressed address space 525, page 0 starts at the first address in both the physical address space and the compressed address space, as depicted by dashed line 530. Similarly, the second page starts at byte address 212 in both the physical address space and the compressed address space. The difference between the page mappings in the physical address space and the compressed address space is that a physical page always occupies the same amount of memory defined by the page size (e.g., 4KB). In contrast, a page in a compressed address space can occupy less space. For example, Figure 5 As shown, page 0 occupies only a small portion of the physical page space, and the freed space is shaded grey 540. As shown by arrow (550), the accumulated free space in the compressed storage system is composed of all grey shaded fragments of all pages. Figure 4 The purpose of the auxiliary memory is to jointly manage the free space composed of fragments (such as the fragment marked in gray 540), and how this is done will be described below.
[0100] Figure 6 A process 610 is shown by which the secondary storage may trigger the compression of a page at any point in time and maintain an up-to-date record of how the physical page is mapped in the compressed address space and where all the free segments are located in the compressed address space. Just like in a conventional storage system, a new page is allocated in the main memory 611 in response to a disk read operation or a page allocation event. Unlike conventional storage systems, in a compressed storage system, and referring to the first action in process 610, each new page entering the main storage system will potentially be first compressed by the hardware accelerator. In this process, in addition to the starting address and size of the free fragments, the size of the page is also determined. This is recorded in a dedicated area of the memory 640, and the mechanisms in the secondary memory 630 and the compressed memory 650 are consistent and can be read and modified by both. The dedicated storage area 640 is also called MetaStorage (hereinafter, dedicated storage area and metastorage are used interchangeably). In alternative embodiments, pages may or may not be compressed when they are allocated, and may be compressed under certain system conditions, such as when system memory utilization is high or when pages are swapped out.
[0101] The auxiliary memory tracks the location of each new compressed page 613 and all free fragments that contribute to the free space 614 in the following manner. Each time the VMM allocates a new page, the allocation request is Figure 4The selector 430 in the VMM 640 intercepts the request, which forwards the request to the auxiliary memory 440 along with the physical starting address of the page. In an alternative embodiment, the selector 430 can decide which pages to compress based on system conditions. For example, in one embodiment, when a page is evicted by the VMM, the page is compressed. Since the auxiliary memory can access the size of each compressed page through the dedicated area 640, it can calculate the size and starting address of the corresponding free fragment. The auxiliary memory maintains an index of the free fragments in a data structure, which can be effectively searched using the size of the fragment as an attribute. Figure 6 An exemplary implementation of such a search tree 620 is shown, which provides a search operation in logarithmic time, where the fragment size of each record (am_ff) 621 is an attribute. As shown in the exemplary search tree, if the size is less than or equal to the current record, the search proceeds to the left 622, and if the size is greater than the current highest record, the search proceeds to the right 623. In different implementations, data structures with probabilistic guarantees (such as skip lists) can be used. The end result is that the auxiliary memory at any point in time keeps track of the memory layout regarding the location of each page mapping and the location and size of all free fragments, that is, the currently available free memory obtained from memory compression.
[0102] Therefore, as mentioned above, Figure 6 As explained, when a storage page is triggered to be compressed, Figure 4 The compressed memory management setting 405 in can be configured to: compress storage pages and determine the size of the compressed storage pages 612; determine the starting address and size of the storage area released by the compression of the storage pages; insert the compressed storage pages 613 into the layout of the compressed storage space maintained by the auxiliary memory 440; and insert the starting address and size 614 of the released storage area into the layout of the compressed storage space maintained by the auxiliary memory 440.
[0103] in addition, Figure 4 The compressed memory management settings 405 in can be configured to insert 614 the starting address and size of the released storage area into a data structure (such as a search tree 620) attributed to the size of the released storage area, which is part of the layout of the compressed storage space maintained by the auxiliary memory 440.
[0104] Attention is now directed to how auxiliary storage acts as a fast backup storage for pages evicted by the VMM. In conventional systems, these pages are typically discarded if they are not modified or otherwise sent to disk or a fixed-size dedicated swap space (such as ZSWAP or ZRAM). In a fixed-size dedicated swap space, page-in (pages read from disk to physical memory) and page-out (pages evicted from physical memory) operations are trivial and well understood. In contrast, auxiliary storage is of varying size, as are the sizes of the individual fragments, depending on how compressed each page is in compressed storage. This presents some of the problems that the disclosed invention seeks to solve.
[0105] Review again Figure 4 In a page-out operation, the operating system will use a device driver to send a request to the disk. In the disclosed invention, a new device driver (called selector 430) is proposed, which will intercept all page-out operations from the VMM in the operating system. The selector will try to store the page in the free space available in the auxiliary memory 440, rather than discarding the page or writing it back to the disk, in order to avoid costly disk access later. In the case where the auxiliary memory does not have space for the page, it will have to make room for it by evicting one or more currently stored pages. These pages are then evicted to the disk 450. Similarly, in a page-in operation, the selector will intercept the request instead of requesting the page from the disk. If the page exists in the auxiliary memory, the auxiliary memory will respond and transfer the page from the free fragment to a location determined by the operating system. Optionally, in order to avoid costly transfer operations through basic load and store operations, DMA (direct memory transfer) support can be used to accelerate this operation. Note that the page transferred from the auxiliary memory will not be decompressed. In the event that the secondary storage does not have the requested page, the page must be retrieved from disk 450. Each of these processes is now described in detail. Figure 7-9 shown.
[0106] For the described implementation, some key data structures are first described that are used by the auxiliary memory to locate pages residing therein. Figure 7 A data structure is shown in the form of a tree that tracks the location of each page stored in the auxiliary memory. Each page residing in the auxiliary memory is associated with a starting address, its size (after compression), and an identification (denoted as Id). The starting address is determined by the location where the page is stored in the auxiliary memory, and the process of determining this address will be described later. Figure 6The size of the disk is known from the aforementioned data structure called "dedicated storage area". The identifier, "Id", is provided by the VMM in the operating system. Any request from the VMM to the disk is handled according to the relevant Figure 4 , intercepted by selector 430. The selector creates a data structure containing information about any page stored in auxiliary storage and using Id as a unique identifier. Thus, Id can be used by the selector to determine whether the page resides in auxiliary storage. Back Figure 7 , the pages residing in the auxiliary memory are tracked by the exemplary tree structure shown. To locate a page, the Id is used as a key, and the tree is traversed to locate the record of the located page in logarithmic time. At each node, if the Id is less than the Id of the node, a search is performed in the left branch 720, otherwise a search is performed in the right branch 730. In different embodiments, other data structures that support keyword-based searches instead of trees may be used, such as hash tables and key value storage.
[0107] Returning to the exemplary but arbitrary point-in-time memory layout of the compressed storage system, according to Figure 5 , the free space 550 is made up of all the free fragments. Recalling that these free fragments make up the memory available for auxiliary storage, consider an exemplary snapshot of how this "freed" space is used. This is in Figure 8 810. It shows the memory layout of three exemplary pages (page 0, page 1, and page 2). Focusing on the exemplary use of the page frame storing page 0 (810), Figure 8 , note that page 0 (810) occupies the first portion of the physical page frame allocated to it. The freed space, if not in use, is associated with the remainder. In the exemplary snapshot, the page currently using the freed space is allocated in the free fragment, denoted as the "swapped out page" 830. In the described embodiment, pages stored in auxiliary storage will be allocated in the free fragments that have not yet been allocated, and the pages will be stored at the end of the page frame. Therefore, the "swapped out page" 830 is placed. After the swapped out page is allocated, a new free fragment (820) will be created, whose size is the size of the page frame minus the difference between the size of the compressed page and the swapped out page, that is, the storage page allocated in the original free fragment.
[0108] As allocation and deallocation requests from the VMM arrive at secondary memory, free fragments will be occupied by swapped-out pages and new free fragments will be created. As an exemplary snapshot, consider Figure 8Here, page 1 is allocated at the beginning of the page frame, followed by a free fragment, then a page stored in auxiliary storage (a swapped out page), then a free fragment, and finally another swapped out page. Finally, for Figure 8 At the far right, the page frame is occupied by allocated pages, representing page 2, while the rest of the page frame is free fragments.
[0109] Fig. 9 Describes the process by which auxiliary storage handles page-out requests. When the operating system's VMM has decided to evict a page, review the Figure 4 As explained, the corresponding page call-out request is intercepted by the selector 430. The auxiliary memory starts by retrieving the page entry information 910 of the page from the selector 430. The next step is to retrieve the size of the page from the memory layout 920. Figure 6 As explained, the auxiliary memory can access the size of each page in its memory layout through a dedicated area in the memory 640, as shown in Figure 5 It then passes through Figure 6 The information is used to find space for the page by searching in the tree data structure 620 of the search space 930. If there is space, corresponding to a "yes" in decision box 940, a transfer of the page from its current location to the free fragment identified in the search space is initiated 950. This can be done with a simple load / store operation, or accelerated by direct memory access (DMA). The new record corresponding to the page is updated with Figure 7 The search structure 700 described above is referenced so that it can be located later. On the other hand, if there is no space, then a page or possibly multiple pages currently residing in auxiliary memory may have to be evicted and transferred to disk 960. When there is space in auxiliary memory for the evicted page, the page is copied from the end of the fragment so that it can be located later. Figure 8 As shown in the exemplary memory layout of FIG, compressed pages that share the same page frame are moved as far away as possible. This is important when the size of the compressed page will increase due to dynamic data changes. In a different embodiment, if the page to be evicted is compressed and there are other swapped out pages residing in the same frame, such as in Figure 8 0, the selector may choose to transfer the compressed page 810 and the swapped out page 830 to another part of the auxiliary memory at the same time, which is called "eager page out eviction". Those skilled in the art may consider using an alternative implementation of lazy eviction that relies on the overflow mechanism described later.
[0110] However, unless the page already stored in auxiliary storage is of exactly the same size as the free fragment, a new free fragment is created that is smaller than the original free fragment. This free fragment is kept in Figure 6 In the search structure of 620, to help the subsequent page call-out operation.
[0111] As will be understood from the above, Figure 4 The compressed memory management arrangement 405 in is therefore further configured to obtain a free area for the page requested by the page callout request by checking the layout of the compressed storage space maintained by the auxiliary memory 440 to find a free area that is large enough for the requested page. If a large enough free area is found, the compressed memory management arrangement 405 accommodates the requested page in the found free area, otherwise a victim page is selected in the auxiliary memory 440, the victim page is evicted by writing the victim page to the secondary memory, and a free area is obtained from the space freed by evicting the victim page. In an alternative embodiment, if a large enough free area is not found, a victim page is selected in the auxiliary memory 440, and the victim page is split into a plurality of sub-pages as long as there are a plurality of free areas that are large enough to accommodate all the sub-pages obtained by splitting the victim page. Otherwise, the victim page is evicted by writing the victim page to the secondary memory to obtain a free area from the space freed by evicting the victim page. In another alternative embodiment, if a sufficiently large free area is not found, the requested page is split into multiple sub-pages as long as there are multiple free areas large enough to accommodate all the sub-pages obtained by splitting the requested page. Otherwise, a victim page is selected in the auxiliary memory 440 and the victim page is evicted by writing the victim page to the secondary memory, wherein the free area is obtained from the space freed by evicting the victim page.
[0112] Fig.10 The process 1000 of auxiliary memory handling page call requests is described. First, in each page call request, the VMM will provide page entry information 1010 including the virtual address or unique Id of the requested page and the physical address to which the page will be copied (called the "free page frame address" for subsequent reference). The selector 430 keeps track of all pages currently stored in auxiliary memory and their associated Ids. If the page is not found, that is, there is no matching Id, then decision box 1030 selects that the next step is to retrieve the page from disk 1050, as in a conventional system. On the other hand, if there is a match, the next step is to locate the page in auxiliary memory 1040. The request is then forwarded to the auxiliary memory with the above-mentioned "free page frame address". The auxiliary memory uses the Id provided by the selector to locate the page by identifying it with the disk. Figure 7The block is located by searching the record associated with the page in the data structure 700 described above. When the record is located, it can retrieve the size and starting address of the requested page in the free space maintained by the auxiliary memory. However, before it can copy the page to the "free page frame address" controlled by the VMM, it must determine that the size of the requested page is the same as or smaller than the size of the above-mentioned "free page frame address". The auxiliary memory will be in the relevant Figure 6 The dedicated storage area 640 is searched to establish the size available for the requested page. If the requested page size is larger than the available size, space must be reclaimed. This involves moving one or more pages stored in the free fragments of the page frame to other available free fragments in auxiliary storage. This follows from Fig. 9 The page out process described in this document. This may result in multiple memory-to-memory copy operations, which can be supported by ordinary load / store or alternative DMA. In order to avoid some of these copy operations, several heuristic methods can be used. One heuristic method is to not consider uncompressed pages stored in auxiliary memory. Another heuristic method is to only store pages compressed to a certain degree in auxiliary memory. Other heuristic methods can be considered, which methods can be understood by those skilled in the art and are intended to be part of this patent disclosure.
[0113] As already mentioned, the size of a compressed page may change dynamically during its lifetime. The present invention includes systems, devices, and methods that track such changes and assist in maintaining the memory layout. When the size of a compressed page is modified during a memory write operation, which modification may be done by a hardware accelerator, the page may be extended to a subsequent free fragment (e.g., Figure 8 The device responsible for handling the changes in the actual compressed size of the page as new write requests for the page arrive at the memory is now referred to as the overflow device. Fig.43 An exemplary embodiment of a sector overflow device and associated sector overflow processing is described; however, as the skilled person will readily recognize, other embodiments are also fully contemplated. In the event that the length of the compressed page extension is sufficient to consume the entire underlying free fragment and conflict with the swapped out page, the present invention includes an interrupt mechanism. The interrupt mechanism ensures that the swapped out page is not overwritten and that the auxiliary memory is appropriately moved to the free space for the compressed page extension.
[0114] One embodiment of a system for tracking dynamic changes in page size is now described in detail. Information about the sizes of compressed pages and their boundaries with free fragments is tracked in a dedicated storage area (640). Figure 8An exemplary page frame is shown in FIG. The information includes the size of the compressed page, a boundary (803) showing where the first free fragment begins, and a boundary (806) showing where the swapped out page resides (if any). Since both the compressed memory mechanism (i.e., the overflow device described above) and the auxiliary memory may modify the information in the dedicated storage area (640), a locking mechanism is included to protect the data from being corrupted. The overflow device can freely expand the size of the compressed page using the free fragment below and move the relevant boundary (FB 803) appropriately, but not beyond the boundary (VB 806) indicating where the swapped out page is located. Whenever a free fragment needs to be used, the modification of the compressed size can be tracked by the auxiliary memory by verifying the contents of the dedicated storage area. In different embodiments, this verification can be performed periodically. In another embodiment, an additional hardware accelerated information system can be used to propagate such changes from the overflow device to the auxiliary memory. The auxiliary memory modifies the contents of the dedicated storage area (640) when the auxiliary memory utilizes the free fragment and places the swapped out page, or when the auxiliary memory processes a page call request. Going back to the case where the overflow device might expand the compressed page, if the free fragment below is not large enough and the two boundaries collide, the overflow device causes an interrupt, and the auxiliary storage handles it by moving the swapped page, similar to a page-out operation, to free up more space.
[0115] As described above, the memory management arrangement 405 is configured to handle dynamic data changes in the compressed page. In addition, the memory management arrangement 405 is configured to track dynamic data changes by: enabling the compressed storage page to be expanded to a free storage area (possibly an adjacent free storage area) in the compressed storage space as a result of one or more new write requests; causing an interrupt if the compressed storage page is expanded to an adjacent swapped-out page in the compressed storage space; and protecting the swapped-out page from being overwritten by capturing the interrupt and moving the swapped-out page to the free storage area, thereby enabling the compressed storage page to be expanded.
[0116] Secondary Memory - Second Implementation
[0117] An "active page" is defined as a page of memory that is currently being used by an application or system, which means that it exists in physical memory, i.e., in the operating system's page table, with a valid mapping between its virtual address and its physical address. Therefore, it can be read or written directly by the processor using standard load and store instructions. Storage pages that have been discarded from physical memory are called "inactive pages", for example, pages that have been selected for storage in a lower part of the hierarchy (e.g., swap memory space). Therefore, based on the present invention as described in the previous auxiliary memory embodiment, active pages and inactive pages can exist simultaneously in the main memory (i.e., the actual compressed memory) addressed using a compressed address space. The difference is that, for example, when a processor load or store command is triggered, or as a second example, when the operating system triggers a page call-out operation, the active page must be able to be found instantly. On the other hand, inactive pages placed in the compressed memory by the auxiliary memory are retrieved by the memory.
[0118] exist Figure 5 In the exemplary memory layout of FIG. 1 , the physical address space maintains an uncompressed view of memory that is exposed to the operating system and processor, making memory compression transparent to the rest of the processor / operating system. The compressed address space is also divided into page frames, where each frame has the same fixed size as the physical address space. In the exemplary memory layout, the active page mapped by the OS to the physical page frame, such as page 1 ( Figure 5 ), is also expected to be found in the same frame in the compressed address space, i.e. also page 1 ( Figure 5 ). The difference is that in physical address space the size of a page is always fixed (e.g., 4KB), while in compressed address space the size of a page may vary. Therefore, with such a memory layout, the translation from physical address space to compressed address space only needs to include the actual size of the compressed active page so that the auxiliary memory knows how much data to copy or move when needed (e.g., during a page-out operation).
[0119] In other words, all active pages are located and aligned with memory frames in non-compressed storage systems. This means that the address of the physical page frame given by the operating system implicitly points to the beginning of the data in the compressed space. To support this conversion, the system needs to copy or move compressed pages to and from the auxiliary storage space whenever a page is selected for a swap-in or swap-out situation. This may result in unnecessary data transfer.
[0120] In the second proposed implementation of the auxiliary memory, called Zero-Copy, the aforementioned page transfer between the auxiliary memory space and the physical memory space managed by the operating system can be avoided by introducing an alternative memory translation process from physical addresses to compressed addresses. Fig.11 As shown, the page number 1114 in the virtual address 1110 is converted by the operating system into a frame number 1124, resulting in a physical address 1120. This frame number is then converted into a physical memory frame (also called a compressed frame - CFrame) 1134 and a compressed frame offset (CF-Offset) 1136 in the case where the zero copy is a virtual frame, because there is no alignment between the start address of the page in the physical address space and the compressed address space. Using the data stored in the metastore ( Figure 6 This final transformation 1124 is performed using additional metadata (described in detail in the next paragraph) in the dedicated storage area 640.
[0121] In the first exemplary management of compressed space and free space, the beginning of the compressed frame is left empty so that the OS can easily allocate new storage space. Therefore, in zero copy, the page is moved once when it first becomes the target of a swap-out event. Fig.12 An example of the evolution of a memory layout with example swap events is shown in ; for three execution points indicated by Latin numbers, there are three exemplary instances of the layout: i, ii and iii.
[0122] The compressed memory 1210 includes page frames 1211 (e.g., 1211ai, 1211bi, etc. in the memory layout 1210i). The active page PA1214i is initially aligned with the page frame 0×10 1211ai. The active page also has corresponding space for increasing its size if its content causes the compression ratio to change; in the aforementioned auxiliary memory implementation, the space is based on Figure 8The free fragment defined by the middle boundaries FB 803 and VB 806. The space is called a range; for PA 1214i, the range is RA1212i, that is, the remaining space in frame 1211ai. The conversion metadata for compressed page PA 1214i includes two pairs of fields: one pair is compression frame 1222i and compression frame offset 1224i, which define the location where the page is stored in the compressed memory; the second pair RAb 1226i and RAe 1228i define the range boundaries associated with PA; RAb 1226i is the starting address of range RA, and RAe 1228i is the ending address of the range. In addition, in the first layout instance i, there are two other pages PB 1215i and PC 1217i, which are inactive and stored in frame 1211ci. If the system now requests a swap-out event for PA 1214i, the auxiliary memory is called and a free fragment is given to PA in frame 1211bii (layout instance ii). This page is selected not to be completely placed at the end of the frame 1211bii so that an interval can be allocated there whenever PA becomes active. For another new event, which is a swap-in event for page PC 1217ii, the inactive page is not moved to the frame 0×15 mentioned in the swap in request 1230iii, but is maintained in the frame 0×12 where it is located and is set to "active" by the zero-copy auxiliary memory system by modifying the corresponding entry in the metastore 1220iii. The first pair of fields is compressed frame 0×121222iii and compressed frame offset 0×70 1224iii, indicating the starting address and offset of the compressed page PC; the second pair of fields defines the interval associated with the PC, which is RC 1219iii, and its address interval is RCb 1226iii and RCe 1228iii. Note that the metastore entry for the page PC is determined by the frame number (0x15) provided by the OS in the swap-in event. As shown, active pages can now be anywhere in memory, not just aligned to frame boundaries.
[0123] In an alternative embodiment, when PA1214i is swapped out to frame 1211bii, the page is placed at the end of the frame, making more efficient use of free space than the previous embodiment. However, if it becomes active, then if there is no available space in the frame to allocate to the interval, or it is allocated to a remote interval, or it is not allocated to any interval at all, then the page may be moved to another frame with space for the interval, and if the "interval" is extended, it needs to be moved to another frame.
[0124] exist Fig.13The sequence of events followed by a swap-in event in a zero-copy implementation is presented in the flowchart of . If a swap-in event is issued to bring page X from swap space to frame Y, it is first checked whether page X exists in the auxiliary storage space 1310. If the page does not exist, a sufficiently large free fragment needs to be found, the page content is brought in 1320, and the free fragment position is recorded 1330. Note that the free fragment does not need to be aligned with the start of the frame as in the previous implementation. The page is then transferred 1340 using, for example, a DMA operation as described above. The starting address of its location is provided by the compressed frame and compressed frame offset, which need to be copied to the first pair of fields in the metadata of frame Y (1370). The remaining free fragment space is used as an interval allocated to the input page 1360, so its boundary addresses (start and end) are also copied to the metadata entry of frame Y 1370.
[0125] If the page exists in the auxiliary memory (yes in check 1310), its starting address (i.e., the pair of compressed frame and compressed frame offset) is filled in the meta storage entry of frame Y. An interval is allocated for the page by filling in the remaining fields of the meta storage entry of frame Y with the start and end addresses of the interval (Rb and Re). Note that in this case, no data is transferred to set the page in the auxiliary memory to the active state.
[0126] exist Fig.14 The sequence of steps followed by a swap-out event in a zero-copy secondary memory implementation is presented in the flowchart of FIG. A swap-out event is issued for page X, which is currently allocated to frame Y; the allocation of frame Y is done by the OS, but not necessarily the frame in which page X is stored in compressed memory. First, a check is made to see if this is the first swap-out of page X 1410. This is done by checking if the compressed frame offset is equal to 0, which means that the page is aligned to a frame boundary because, as previously described, execution brings pages from the beginning of the frame to the end of the frame. In the case that this is the first time page X is swapped out, a query is made in the secondary memory for a free fragment to store the page 1420. Note that if no free fragment is found, the execution program will evict pages from the secondary memory to free up the required space, as described in paragraph
[00105] . When a free fragment is identified, the page is moved to that destination 1430. This is the only default data transfer in a zero-copy implementation. The updated size and page information for the free fragment are managed by the secondary memory runtime 1440. Since the page is now inactive, the metadata in the metastore for frame Y is deleted (1450).
[0127] For the case where this is not the first time page X has been swapped out ("No" outcome of 1410), then the procedure deactivates the page 1450 by deleting the entry for frame Y in the metastore.
[0128] In an implementation of the zero-copy auxiliary memory, no page movement is required except for the default page transfer during the first swap-out operation. In an alternative implementation, if the compressed size of the page changes due to dynamic changes in the page data, resulting in the page not being able to fit into the specified area of the frame, and thus requiring the page to be moved, the page can be moved. In a second alternative implementation, other pages or data can be moved instead. In a third implementation, the page can be decompressed. Other alternatives can be implemented by those skilled in the art.
[0129] In the aforementioned embodiments of the auxiliary memory, when there is a request to move a page to a free fragment in the auxiliary memory, if there is no free fragment large enough to store the page, the page needs to be stored in a lower level storage hierarchy (i.e., swap space). Although a single free fragment may not be able to satisfy the request, the total available free fragment space may be large enough to satisfy the same request. Therefore, the optimization scheme for these embodiments is called Split-Page, and is able to split the compressed page into different blocks, which can be stored in multiple available free fragments. The blocks are not fixed size, so page splitting is not affected by internal fragmentation.
[0130] exist Fig.15 In the exemplary embodiment 1500 of , a compressed page 1514i is split into two blocks 1514aii and 1514bii upon a swap-out event. In alternative embodiments, the splitting can be extended to any number of blocks at the expense of additional metadata information to track the free fragments in which different portions of the original page are stored. If each page can be stored in two different free fragments, it is necessary to track the two starting addresses of the two fragments to store the two split portions of the original compressed page. Obviously, if the splitting of compressed pages into N portions is to be supported, this will result in the storage of N pointers to possible blocks, where the portions will be stored in auxiliary storage.
[0131] In a first embodiment of the auxiliary memory management system, in which compressed pages are aligned with physical frames, the system needs to keep track of where swapped out pages are stored; therefore, the internal data structure used to store the locations of compressed inactive pages needs to be extended to support two pointers to the starting addresses of the two portions where data may be stored.
[0132] On the other hand, for the zero-copy auxiliary memory implementation, each metastore entry must be extended to contain two pairs of frame number and offset, one of which is the start address of the free fragment where the split data is located, since each entry can now contain either an active page or an inactive page. Therefore, each entry of the metastore contains two pairs, where either both pairs contain valid values, or only one of the two pairs contains a valid value if the page content is not split. It is important to note that for zero-copy, a page may become active after being split, so the metadata entry needs to be updated accordingly. The split page optimization scheme can make better use of the available free fragment space, thus avoiding data transfer to lower levels of the storage hierarchy. However, some data operations may be slower: for the first implementation of the auxiliary memory, inactive split pages must be merged during the swap-in operation and thus read from different memory locations. For the zero-copy implementation, after the split page is swapped in, its content will still be split; if the former requires more storage lines to be activated simultaneously than the latter, this may result in slower memory access times than non-split pages. In an alternative embodiment, whenever a larger free fragment is available, the split pages may be recompacted to reduce the overhead.
[0133] Concluding remarks on the differences between the first and second embodiments of the auxiliary memory are as follows. In the first embodiment, the memory management settings 405 are configured to make the located page of the page-in request available in the active portion of the compressed memory space by transferring the located page from the inactive portion to the active portion of the compressed memory space, wherein the memory management settings 405 are configured to make the page of the page-out request accommodated in the obtained free area of the auxiliary memory 440 by transferring the requested page from the active portion to the inactive portion of the compressed memory space.
[0134] On the other hand, in a second embodiment, the memory management settings 405 are configured to make the located page of the page-in request available in the active part of the compressed storage space by updating the metadata to reflect that the located page belongs to the active part of the compressed storage space, wherein the memory management settings 405 are configured to make the page requested by the page-out request accommodated in the obtained free area of the auxiliary memory 440 by updating the metadata to reflect that the requested page belongs to the inactive part of the compressed storage space.
[0135] The methods corresponding to the memory management arrangement 405 and its various implementations described herein will include the functional steps performed by the memory management arrangement 405 and its various implementations.
[0136] Optimization plan
[0137] In addition to the described implementations, many optimizations can be considered. One aspect of the optimization involves making room for new paged-out pages when auxiliary storage does not have room for paged-outs. Another aspect of the optimization involves how to more effectively manage free fragments. In the following paragraphs, some of these optimizations will be discussed.
[0138] There are several alternatives to make room for pages paged out by new pages when a free fragment of sufficient size cannot be found. One alternative is to track the "age" of the pages currently stored in auxiliary storage. With age, it can be thought of as how long (logical or physical wall clock) a page has been resident in auxiliary storage. Age can be tracked based on auxiliary storage requests as a "wall clock" or logically by the request rate from the VMM. Each page stored in auxiliary storage has an "age" associated with it as a counter in a tabular form. At each request to auxiliary storage, the counter values of all pages currently stored in auxiliary storage are incremented. One page with the largest counter value is evicted and sent to disk when space is needed.
[0139] In compressed memory, pages have varying sizes. Only pages with low age and small size (high compressibility) will be selected to be stored in auxiliary memory. Conversely, pages with high age and large size (low compressibility) may be selected to be evicted and sent to disk. To this end, heuristics for evicting pages from auxiliary memory to disk may be established based on age and size characteristics. Those skilled in the art will appreciate that age can be modeled by the concept of least recently used (LRU), and heuristics may be established based on this concept with approximations based on, for example, reference bits used in VMM.
[0140] Regarding how to manage free fragments more effectively, the goal is to use free fragments as efficiently as possible. Figure 8 , and considering how the page frame storing page 1 is used, we note that it stores three pages: page 1 and two swapped-out pages that currently use the free fragments associated with the page frame and managed by auxiliary storage. We note that in the exemplary scenario, the utilization of the page frame can be very low. One way to improve the utilization of free space is to occasionally run a compaction program, whose purpose is to compact the space within the page frame.
[0141] One approach is to create as much space as possible between the pages currently mapped to the page frame and the pages that reside in the auxiliary memory and utilize the free fragments. This approach can be achieved by pushing all the pages that reside in the auxiliary memory to higher addresses in the page frame. This will produce the largest free fragment in the middle of the allocated pages and the pages that utilize the free fragments in the auxiliary memory. Other alternatives are also possible, as will be appreciated by those skilled in the art, and they are all contemplated in the disclosed invention.
[0142] In a page out operation, the proposed selector 430 will intercept all page out operations from the VMM in the operating system. In the case where the outgoing page is not compressed, the selector may choose to compress the page using the compressor unit 212, potentially using a hardware accelerator to compress the page. Then, the attempt from step 930 will be made to Fig. 9 The same process described in , where the selector will attempt to store the page in available free space in auxiliary storage 440 to avoid costly disk access later.
[0143] Address Translation
[0144] Now we turn our attention to the required address translation between physical addresses and addresses in compressed memory. As mentioned earlier, memory pages are not necessarily placed in their original locations in conventional non-compressed memory systems, which require a translation step to locate them in the compressed address space (CAs). In addition, cache systems typically manage data at the granularity of memory blocks or cache lines (hereinafter, blocks and lines are used interchangeably), which are typically 64B in size, and which also have variable sizes in compressed memory systems, so there is an additional step: locating the cache lines in the compressed memory pages. Fig.16A An exemplary memory page 1610 including an uncompressed cache line 1620 is shown, and Fig. 16B The same page 1610 is shown with its cache line 1620 compressed and compacted. When converting from a conventional physical address (PA) to a compressed address (CA), for example by Figure 2 When the address translation unit (211) in the exemplary system of performs translation, the translation must be supported.
[0145] The prior art follows different approaches to provide address translation between PA and CA. One approach uses a large amount of metadata to determine the exact location of each compressed block within the page by maintaining an inbound pointer for each compressed block; a page with 64 cache lines (64B per cache line when uncompressed) requires metadata of size 64×12b=768 bits (b), since a 12-bit pointer is used to point to any byte position within the page. The second approach uses only the compressed size, so it requires significantly less metadata (64×6b=384b per page), but suffers from high latency when calculating the compressed position, since it requires accumulating the compressed sizes; for example, calculating the compressed address of the 64th block requires accumulating 63 sizes. Yet another approach is to limit the cache lines to one size (i.e., the maximum compressed size in the page); this approach requires a negligible amount of metadata (2b per page), but greatly limits the possibilities of compression (and free space).
[0146] Other approaches attempt to reduce the conversion metadata by dividing the memory into fixed-size segments and encoding in the metadata the number of segments used by the compressed data. The segments can be coarse-grained or fine-grained. Fig.17 A coarse-grained segmentation implementation is shown, where the memory is divided into 1KB segments (1720). In this example, the uncompressed page 1710 is 4KB, the same page compressed 1730 is 2321B, and 3 segments are used (1722, 1724, and 1726). Another page 1740 may only require one segment 1728 when compressed 1750. Metadata 1760 needs to encode the starting segment and the number of segments for each page because the compressed pages are mapped to consecutive segments. However, because the actual compressed size of the page is not exactly the same as the segment size, the compressed space is not fully utilized, resulting in internal fragmentation (1774 and 1778). Fig.18 Shows Fig.17 An alternative embodiment in which compressed page 1830 is mapped to non-contiguous segments 1822, 1826, and 1829. This results in more metadata fields (1864a-d), however, the internal fragmentation problem (1874 and 1878) still exists. Fig.19 A fine-grained segment layout is shown, where memory 1910 is divided into 8B segments 1915. Page metadata 1930 includes the compressed size 1934 (i.e., the number of segments) for each compressed cache line 1925. For example, CL0 has a size of 3 segments 1934a (24B), while Fig. 16B In the non-segmented translation layout, CL0 has a size of 18 bytes 1635a. Therefore, while segmentation helps reduce metadata, it has a negative impact on compressibility.
[0147] Even if there is a buffer on the chip (similar to the translation lookaside buffer) to hold the translation metadata for the translation from physical addresses to compressed addresses, this buffer cannot cache all the metadata due to area limitations. Therefore, the metadata must be stored in memory. A large amount of metadata introduces a large overhead in storage capacity, and if the metadata needs to be transferred from memory to the address translation unit on the chip, the bandwidth gain due to compression will disappear. Reducing the metadata overhead either increases latency resulting in performance degradation or limits the compression rate resulting in a devastating impact on storage capacity and bandwidth gains. In addition, all segmentation-based approaches experience internal fragmentation, which limits capacity and bandwidth gains because they allocate unnecessary space to align compressed data with segment boundaries.
[0148] Address Translation: Sector-Based Implementation
[0149] The present invention discloses an apparatus and method for solving the above problems by introducing a new data entity, called a sector. A sector has a fixed "logical" size, called SectorLogSize, but a variable "physical" size, called SectorPhysSize, depending on its compression ratio. The logical size quantifies the number of cache lines (or ordinary blocks) it contains, while the physical size quantifies its size (e.g., in bytes). A sector includes a fixed number of cache lines, for example, 2, 3, or 10, but the logical size is usually preferably a power of 2: 2, 4, 8, 16, etc. Fig. 20 Sector 2020 is shown in uncompressed form, while Fig.21 The same sector 2120 is shown in compressed form, where the physical size is measured in bytes; SectorLogSize is 8 cache lines, while SectorPhysSize is the sum of the compressed CL sizes 2130, which in the exemplary sector is 18+44+10+22+60+54+2+8=218B.
[0150] The fixed logical size (SectorLogSize) allows any memory request to be automatically converted to a sector request without the need to maintain additional metadata. The correct sector is automatically found based on the address of the original memory request by using the integer portion of the result of dividing the cache line index by the SectorLogSize. For example, if the SectorLogSize is 8 and the memory request is made after cache line 5, then sector 0 must be requested. If it is cache line 50, then sector 6 must be requested Furthermore, whether a sector or sectors must be accessed is determined by their address and size, e.g. if cache lines 6-10 are requested, both sectors 0 and 1 must be accessed.
[0151] The motivation behind variable physical size is that it alleviates internal fragmentation issues since compressed data of variable sizes can be accessed from memory. Another advantage of sectors is that it packs many consecutive cache lines together. Therefore, if the running system and / or application exhibits spatial reference locality, the bandwidth improvement due to compression can be guaranteed even if the data must be relocated to handle dynamic data changes. For example, if the compressed cache line size increases, it will likely cause the sector size to increase. If the compression overflow mechanism were to move a sector elsewhere, all cache lines within that sector would be moved together. The compression overflow mechanism handles dynamic data changes as described in paragraphs [00212-00218].
[0152] Another important benefit of sector-based translation is that it requires substantially less metadata.In a first implementation of the sector-based translation metadata format, the metadata includes pointers identifying the location of sectors within a compressed page. Fig. 22 It shows how to identify compressed sectors 2220 within compressed pages 2210. There are 8 sectors (a 4KB uncompressed page includes 64 CLs, so the SectorLogSize of 8 sectors is 8); the required metadata is 8(sectors)×12b; each pointer (PTR2234) identifies the sector location within the compressed page, i.e. <= 4KB). The metadata for each page 2230 is only 96 bits. The sector size is determined by subtracting the current pointer from the next pointer; for example, the size of sector 1 2226 is derived from Sec2 PTR 2234b-Sec1 PTR 2234a. The size of the last sector is obtained by subtracting its PTR from the compressed page size; if the page size is not maintained in the metadata, the size of the last sector is part of the metadata. In another embodiment of the sector-based conversion metadata format, such as Fig.23 As shown, compressed size metadata (CSM) 2318 is stored mixed with the data in a fixed area at the beginning of the sector (2323, 2326, etc.). If one or more specific compressed blocks 2314 within the sector must be decompressed and returned first when accessing the sector, the CSM determines the amount of shift within the sector. In yet another embodiment, the CSMs can be distributed across the sectors by placing each CSM before each compressed block. Other alternative embodiments may be implemented by those skilled in the art. In this embodiment, the CSM corresponds to metadata for compressed cache lines, but can be generalized to any compressed block entity. Fig.24In the fourth implementation of the sector-based conversion metadata format described in , the metadata includes a pointer (PTR) 2434 that identifies the location of the sector within the compressed page and the size of the sector (SIZE) 2438. The amount of metadata required is only 8 (sectors) × 12b + 8 (sectors) × 8b = 160b. The width of the sector size metadata field is determined by the maximum size of the sector, and when the SectorLogSize of the sector is 8, the uncompressed sector size is 512B. Uncompressed sectors are encoded as size 0 in SIZE, but another compressed sector size (e.g., 511) can be used to encode uncompressed sectors. The advantage of the sector-based metadata conversion format is that it allows sectors to be reordered so that dynamic changes in sector data can be handled more flexibly. This is achieved with a small amount of metadata (about 60b) based on one of the three aforementioned implementations, while in the prior art, a large amount of metadata is required, potentially up to 8 times the metadata. Other alternatives can be implemented by those skilled in the art.
[0153] The benefit of reducing the width of the conversion metadata is that the metadata requires less space in the memory, reducing the overall metadata overhead in the memory. In addition, in the case of a conversion metadata buffer on the chip, the value of the smaller metadata width is converted into less area overhead in the chip space, resulting in potentially less power and energy. Conversely, the saved area can be used to increase the coverage of the conversion metadata table, that is, the number of page conversions, to improve performance.
[0154] Fig.45 A general method 4500 for accessing compressed computer memory residing in physical computer memory according to the teachings herein is described. The method includes representing compressed memory blocks as sectors, wherein all sectors contain a fixed number of compressed memory blocks, such as cache lines, all sectors have a fixed logical size in the form of the fixed number of compressed memory blocks, and all sectors have a varying physical size in the form of the total size of data stored in each compressed memory block 4510. The method also includes providing sector-based translation metadata to track sectors within a compressed memory page 4520, receiving a physical memory access request including an address in a physical computer memory 4530, deriving a memory block index using the address in the physical memory access request 4540, determining a sector id using the memory block index and the fixed logical size of the sector 4550, locating a sector having the sector id in a compressed memory page using the sector-based translation metadata 4560, and locating the requested data within the sector using the address of the physical memory access request 4570.
[0155] A corresponding device for accessing compressed computer memory residing in physical computer memory would include means for executing the functional steps of method 4500.
[0156] Fig.25 A first embodiment of a method for accessing compressed computer memory residing in physical computer memory is described in the disclosure, the method involving sector-based metadata translation including compression and decompression as part of a memory read or write request. Fig. 27 The relevant equipment is described in . The conversion metadata of the compressed page also includes the starting address of the page (PageStAddr), which is used as the reference address when calculating the compressed address using the sector-based metadata. Figure 5 In the exemplary layout of , PageStAddr is not required because the physical frames are aligned with the frames in the compressed address space as described above. Fig.12 In the second exemplary layout, PageStAddr includes the PFN and the offset. In the third exemplary layout, if the sector metadata can point to an arbitrary location in the memory instead of within a compressed page, PageStAddr can be omitted.
[0157] In this first embodiment, each memory request must be converted to a sector-based request. In this method embodiment, the sector-based conversion converts the request R into one or more sector requests R' depending on the original size of the request R. First, the conversion metadata retrieval process 2510 is triggered, in which it is checked whether the conversion metadata is available (2513). If not, a metadata request for the metastore is triggered (2516). When the conversion is available, the sector-based calculation 2520 is triggered, and the R' address is calculated based on the PageStAddr and the sector pointer 2523. Depending on the address of the request R and its size, it may be necessary to request one or more sectors S. The size of R' is the sector size 2526, in Fig.24 In the exemplary sector metadata format of , it is available (2526a), while Fig.23In the second exemplary sector metadata format, it is calculated using the sector pointer (2526b). When the request R' attribute is ready, R' is sent to the memory 2529. When the memory responds with compressed sector data 2530, the sector is decompressed 2540. If the request R is a read request, the requested data is returned (based on R→addr and R→size) 2550; otherwise (R is a write request), the sector-based compression process 2560 is followed: the old sector data is merged with the new data (the merge is driven by R→→addr and Rvsize) 2564, the new sector S' is recompressed 2568, and then written to the memory; when the request is a write request, the conversion metadata (i.e., sector SIZE and / or sector PTR) is also updated accordingly. In one embodiment, the meta storage is stored in the main memory. In a second embodiment, it is stored as a file on the disk. Other alternatives can be implemented by technicians in this field.
[0158] Fig.26 A second embodiment of a method for accessing compressed computer memory residing in physical computer memory is described in Fig.23 or Fig.24 The exemplary metadata format of 2610 is replaced by the conversion metadata retrieval 2610 and the sector-based CA calculation 2620 with Fig.25 2630, one or more compressed blocks corresponding to the requested data (derived based on R→addr and R→size) may be located based on CSM 2318 / 2418 and decompressed first, rather than decompressing the entire sector 2660, thereby potentially reducing decompression latency. This only applies to read requests; if the request is a write request, sector-based compression 2650 is followed as in the previous embodiment. Fig.26 The methods and Fig.27B Associated with the devices in.
[0159] In an alternative to the second embodiment, using Fig.23 or Fig.24 If the request R is a write request, the compressed sector S data and the new data (R->data) can be merged while decompressing and recompressing the entire sector S, but only by compressing R->data and using the CSM metadata to replace the old compressed data with the new compressed data. Fig.27C An apparatus operating according to this alternative is described in .
[0160] In another alternative, if the entire sector is decompressed on a read request, the remaining decompressed data that has not yet been requested can be buffered for future requests. This often happens if the application or program being run exhibits spatial reference locality. Another scenario is that if the entire sector is decompressed on a read request, all of the decompressed data can be buffered for future requests. This often happens if the application or program being run exhibits time and / or spatial reference locality. In yet another alternative, on a write request, the entire sector can be buffered (in compressed or decompressed form) for subsequent other write requests to this sector. This often happens if the application or program being run exhibits time and / or spatial reference locality.
[0161] Other alternatives may be realized by those skilled in the art, and it is intended that all such alternatives be considered.
[0162] Fig. 27 A first embodiment of a device 2700 for accessing compressed computer memory residing in physical computer memory is described. The device 2700 is used to Fig.25 The device 2700 includes a sector-based conversion device (2710-2730, 2760-2770) and a compressor 2780 (CMPR) and a decompressor 2750 (DCMP) in a sector-based memory compression system. Fig. 27 At the bottom, there is also a main memory 2740 that stores data in compressed form. In a specific CPU system implementation, such as Figure 2 In the exemplary system of FIG. 1 , the compression system is described as being between the memory controller 210 (which is connected to the compressed main memory) and the processor and cache hierarchy. The compression system receives memory requests (2704-2706) from the top of the block diagram. Figure 2 In the exemplary system described in FIG. 1 , such a memory request may be issued by the C3 cache. However, other units may generate memory requests, such as a GPU, a display controller, etc.
[0163] exist Fig. 27 In the system, the sector-based conversion device includes an address translation table (ATT) 2710, a compressed address calculator unit (CA Calc) 2720, a sector REQ unit 2730, a sector merging unit 2770 and a selector (SEL) 2760. All memory requests are Fig. 27The compression system intercepts the memory request. Regardless of whether the memory request is a memory read request or a memory write request (R in either case), its physical address 2704 is passed to the ATT 2710. The ATT is addressable based on physical pages (i.e., physical frame numbers (PFNs)) and caches translation metadata for each physical page. This translation metadata includes PageStAddr 2714 and sector metadata 2718. If the metadata format is Fig. 22 or 23, the sector metadata also includes a pointer for each sector, or if the metadata format is Fig.24 If it is one of the following, the sector metadata includes a pointer and size for each sector. If the ATT 2710 has cached the page translation of the input request R, it is an ATT hit, otherwise it is an ATT miss. In the latter case, a metadata request 2719 is made to the memory (meta storage). The metadata 2742 is returned from the memory and the ATT is updated. As mentioned above, the ATT is addressed based on the physical frame number (PFN), which is calculated as follows: R→Addr>>12b, assuming that the physical page is 4KB. The CA calculation unit 2720 converts the physical address to a compressed address, as follows: CA=PageStAddr+sector→PTR; the size of the request R is converted into a sector size request (i.e., for Fig. 22 and 23 , or for Fig.24 The metadata format of the converted request R' 2735 is returned from ATT). The sector REQ unit 2730 creates a new request R' which is a sector request and is associated with the request R, and the unit 2730 also retains the association of the original request R 2704 with the converted request R' 2735. When the compressed sector data 2745 is returned from memory, it is decompressed by the DCMP 2750. If the original request R 2704 was a read request, the decompressed data corresponding to R is returned 2708 and the rest of the data is discarded. This is done by the selector 2760 using R→<Addr,Size> 2705. If the original request R 2704 is a write request, the decompressed sector 2755 is merged with the new data (of R) 2706 by the sector merging unit 2770. Fig. 27 As shown, the old data is based on R→<Addr,Size> The new sector is overwritten by the new data at 2705. The new sector is compressed by CMPR 2780 and written back to memory 2740. If the size of the original write request coincides with one or more sectors, the sector read and merge steps can be omitted.
[0164] Fig.28 A third embodiment of a device 2800 for accessing compressed computer memory residing in physical computer memory is described in Fig.25BIn the second embodiment, a dynamic data selection control unit 2890 is added. The unit includes a PB (prefetch buffer) 2898, which buffers the (decompressed) sector data 2855 arriving from the memory upon a memory request R' in uncompressed form, a demultiplexer 2894 and a selector 2892. Based on the fact that the running application and / or operating system can exhibit high spatial reference locality, and because the sector has a larger logical size than the typical cache line granularity required by the processor and the cache, the "prefetched" sector data that is accessed due to the request R requiring a specific cache line within the sector can now be pre-decompressed (prefetched in advance) and stored in the PB in anticipation of future access to it. Fig.28 In the sector-based conversion device implementation, the address and size of the input read request (R→<Addr,Size> 2805) accesses the PB (in this embodiment, it is not checked whether the PB is used for a write request). If the data exists in the PB (PB hit), there is no need to dispatch a memory request to the memory, and the data is returned from the PB through the selector 2892. The selector is controlled by the hit (H, Hit) / miss (M, Miss) signal of the PB 2898. If it is a PB miss, the Fig. 27 2804 is converted into a sector request R' 2835 by the same procedure described in the previous embodiment of the present invention. Data stream 2895 shows that only the sector data corresponding to request R that has not yet been returned is stored in PB 2898. However, in an alternative embodiment, all decompressed sector data 2855 can be stored. This selection is done by the demultiplexer unit 2894, which is also composed of R→<Addr,Size> 2805 control. Fig.28 The switching device of 2898 illustrates the full possibilities of sector-based switching, as the massive bandwidth and latency in a compression system can be improved by combining the effects of compressibility and spatial reference locality, both of which are exhibited by programs running in a processor system. In an alternative embodiment, the PB 2898 and ATT 2810 can be accessed in parallel, thereby reducing the overall switching latency.
[0165] In an alternative, if there are back-to-back read and write requests to the same sector, the write request can also benefit from the presence of the PB. If the sector data not touched by the write request is found in the PB, then the read request does not need to be scheduled before the write request, saving even more bandwidth. In another alternative implementation, the same PB or another PB can be placed in front of the sector merger to store sectors. This may be beneficial if there are back-to-back write requests to the same sector.
[0166] In use Fig.23 or Fig.24 In an alternative to the metadata format of , where the CSM can be used to selectively decompress requested compressed blocks within a sector, the entire sector or a portion thereof can be stored in a PB placed before the DCMPR so that it holds the input (from memory) sector data in compressed form. The working principle of this PB is similar to the PB of the previous embodiment. However, the data will not be decompressed unless it is explicitly requested to be decompressed. If there is low spatial reference locality or no spatial reference locality, this can potentially save bandwidth and dynamic energy due to decompression.
[0167] In another alternative, the conversion device in each of all the previous embodiments may be pipelined so as to be able to convert and process multiple memory requests simultaneously.
[0168] Other implementations and alternatives may be realized by those skilled in the art.
[0169] The above-described sector-based conversion format solves the internal fragmentation problem due to its variable physical size, while it can significantly reduce the amount of metadata required and improve bandwidth. However, in order to avoid or mitigate the severe overhead of memory bandwidth caused by the sector reads required for memory writes, especially if the memory writes have no spatial reference locality, or if the reuse distance of the read sectors (to be merged with the write request) is greater than the size of the prefetch buffer itself, further improvements can be made. An example of such an improvement will now be described.
[0170] Address translation: hybrid sector based implementation
[0171] An alternative to a purely sector-based translation format combines sector metadata with cache line metadata and stores it in Fig.29 . Such a conversion format is called hybrid metadata. In the format, for a compressed page 2910 including compressed sectors 2920, the metadata of each page 2930 includes sector metadata 2931 and cache line metadata 2932 for each sector 2934. The sector metadata 2931 only includes sector pointers 2931a, 2931b, etc., and the cache line metadata includes cache line sizes (CL-SIZE) 2932a, 2932b, etc. Each CL-SIZE subfield metadata encodes the cache line size 2940 of the respective CL. For example, the CL-SIZE subfield 2932a1 encodes the compressed size of the first cache line of sector 0 2923. In Fig.29In the embodiment, SectorLogSize is 8, so the cache line metadata includes 8 CL sizes. In alternative embodiments, where SectorLogSize is different, the sector and cache line metadata will include more or fewer sub-fields. Such a metadata format can allow more flexibility when accessing compressed data, because it can now extract or write one or more sectors or one or more cache lines. In addition, as described in the previous paragraph, it can also reduce the overhead of sector read or write operations, thereby potentially improving bandwidth usage. In this hybrid format embodiment, the size of the conversion metadata has been increased to: (8×12b)+(64×6)=96b+384b=480b, which is the same as Fig.24 Compared with the sector metadata format (sector pointer + size), the metadata overhead increases by 320b.
[0172] In the alternative, the cache line metadata may be replaced with other metadata, for example, compressed size metadata (CSM) if the compression granularity of the data is smaller than the cache line granularity.
[0173] FIG30 depicts a first example of a sector-based hybrid conversion method, including a conversion metadata retrieval process 3010, a sector-based hybrid CA calculation process 3020, a sector-based compression 3070, a sector-based decompression 3050, and other processes present in a memory compression system. Fig.25 and Fig.26 When a conversion is available for an input request R (arrow "yes" of 2513), it is first checked whether it is a read request or a write request. If it is a read request, then in a similar manner to Fig.25 After calculating the compressed address 3021 and size 3022, the entire sector is requested 3023. However, if it is a write request, the write data of request R can be compressed immediately 3030; its size (CS) is compared with the old size 3027, which is further determined by the CLi→Size metadata of the sector to which the write request belongs. Fig.25The sector 3025 is calculated as in 2523 / 2623 of / 26; CLi (i.e., the index of the CL within the sector) 3025 is calculated by shifting the 6 least significant bits of the address (for a physical cache line of 64Bytes), and the modulus of the remaining address is calculated using SectorLogSize. If the size of the write request is larger than one cache line, the size of the old data is determined by the sum of the CLs involved in this write request (CL→Size). Comparing CS with the old CL size, three possible results can be obtained: If CS>old data (the result of 3027 is "yes"), the cache line of the sector after the cache line involved in the write request must be shifted in the compressed memory to avoid being overwritten by the new write data. Therefore, the entire sector needs to be read (steps 3021-3023, 3040), decompressed 3050, merged with the new data 3073, compressed (3076) and written to the memory (3079). An optimization to reduce memory traffic is to read only the cache lines of the affected sector in memory (rather than the entire sector), decompress 3050, merge with the new data 3073, compress 3076 and write to memory as a sequence of consecutive cache lines (i.e., a sub-sector request). This optimization can only be applied if the write request does not cause a sector overflow, otherwise the entire sector must be read (or, in the alternative, all rows of the sector except the one currently being modified by the write request). This will be discussed later with reference to FIGS. 39 to 41. Fig.43 Describe the processing of sector overflow. If CS = old data (the result of 3027 is "No"), the compressed data can be immediately written to the memory 3080 through step 3029 after calculating its accurate compressed address and size, without reading the sector.
[0174] Finally, if CS < old data, writing the new compressed data and updating CL→Size in the metadata can result in a conversion metadata error. Therefore, there are different ways to handle this problem. In one embodiment, the compressed data can be written to the memory immediately (the path of steps 3029 and 3080), but the compressed data is first filled with as many "don't care" bits as the difference (old data-CS), which can produce untraceable internal fragmentation. In another alternative, internal fragmentation can be tracked by adding one bit per CL per sector (for page metadata, a total of 64b), which is set when internal fragmentation occurs. In another embodiment, in the most common case, when the uncompressed cache line gradually changes to compressed form, one of the possible CL→Size values can be "borrowed" to encode the internal fragmentation, so that the internal fragmentation can be detected when the cache line within the sector is about to be compacted to form a compressed sector. In another alternative, this situation can be treated as a case where CS> old data (the result of 3027 is "yes"), although external fragmentation will occur (i.e., the fragment is no longer part of the sector). However, external fragmentation can be eliminated by recompacting sectors (periodically or on demand) without the need for additional metadata. As will be appreciated by those skilled in the art, the space occupied by external fragmentation can be retrieved using sector pointer metadata and CL-size metadata. In this latter alternative, sub-sector write requests can be created by reading only the cache lines of the affected sectors and applying the same optimizations described in paragraph 00164 after merging with the modified data of the current write request.
[0175] After determining which write scheme has to be applied, the translation metadata (ie sector SIZE and / or sector PTR and / or CL size) needs to be updated accordingly.
[0176] In the alternative, when an entire sector needs to be read, it may not be necessary to merge the new sector data with the old sector data as previously described to decompress the sector.
[0177] If the size of the write request is inconsistent with a cache line where available conversion metadata exists, the entire sector is read, decompressed, merged with the new data, and written back, or the cache line is involved. Other alternative implementations may be implemented by those skilled in the art, which may be more or less complex, depending on how often this request situation occurs. Such other implementations are also contemplated.
[0178] exist FIG. 31A to FIG. 31D (in FIG. 31B to FIG. 31D yes Fig.31AIn a second example of a sector-based hybrid conversion method with a detailed view of ), selective extraction of compressed sectors or compressed cache lines can also be applied to read requests, improving read bandwidth and latency accordingly. When there is spatial reference locality, or when the compression ratio (CR) is high (i.e., CR>=SectorLogSize), it is advantageous to read the entire sector, otherwise it is preferred to read as much as the original request R. Therefore, this second embodiment requires some modifications to the method: 1) Add a dynamic data selection control process 3190, which includes something like Fig.28 1) modifying the sector-based hybrid CA calculation process 3020 by adding a process step 3124 for calculating the CA and the compressed size R' that is smaller than the sector. In one embodiment, the spatial reference locality can be determined by measuring the utilization of the prefetch buffer, and the CR is already known from the conversion metadata. The utilization of the prefetch buffer is tracked by measuring, for example, the hit rate of the sector data stored in the buffer. In an alternative scheme, one can choose to read only the compressed cache lines, but mark the prefetch buffer with shadow sector data to simulate the utilization of the prefetch buffer.
[0179] In the second example of the sector-based hybrid conversion method 3100, the decision criteria of the decision process step 3196 can therefore be determined by the following formula:
[0180]
[0181] where 512 is the uncompressed physical size of the sector in bytes (8×64B if SectorLogSize is 8), 1+7×U: 1 cache line is accessed in an uncompressed system, while 7×U is the number of additional cache lines fetched by the sector read, and U is the prefetch buffer utilization (i.e., how many of them are actually accessed),
[0182] 64: Uncompressed physical size of the cache line in bytes.
[0183] If the solution formula makes CR the decision variable, the following conditions must be met:
[0184]
[0185] In another alternative, the formula can be modified to compensate for the extra traffic due to metadata, for example as follows:
[0186]
[0187] Those skilled in the art may solve the formula under different parameters, such as under another SectorLogSize value. In addition, the judgment criteria of the present disclosure are not limited to a specific formula, but those skilled in the art may be aware of other similar formulas to combine the effects of compressibility and sector prefetch utilization, or other criteria; for example, using only compressibility, or PB utilization, or monitoring and predicting access patterns to determine whether it is more desirable to fetch sectors or individual cache lines.
[0188] Fig.32 A fourth embodiment of a device 3200 for accessing compressed computer memory residing in physical computer memory is described. The device 3200 includes a sector-based hybrid conversion device and a compressor 3280 (CMPR) and a decompressor 3250 (DCMP) in a hybrid sector-based memory compression system. Fig.32 Also included is a compressed memory 3240. All memory requests are Fig.32 The sector-based hybrid conversion device includes a sector-based conversion and address calculation unit, a dynamic data selection control 3290, and a sector-based hybrid write unit 3270. ATT 3210 includes PageStAddr 3214 for each page, as well as sector-based hybrid metadata PTR 3216 and sector CL-SIZE 3218. The access and update of ATT is similar to Fig. 27 and Fig.28 Implementation method 2710 / 2810.
[0189] The address and size (R→<Addr,Size> 2805) to access the PB 3298 of the dynamic data selection control 3290. If the data exists in the PB (PB hit), there is no need to schedule a memory request to the memory, and the data is returned from the PB through the selector 3292. The selector is controlled by the hit (H) / miss (M) signal of the PB 3298. If it is a PB miss, the request R 3204 must be converted into a sector request R' 3235. Based on the decision made by the decision unit 3299 (described in detail later) of the dynamic data selection control 3290, the CA calculation unit 3220 will derive one or more sector requests, or one or more CL requests (derive one or more sectors or CLs based on the address and size of the request R). The sector / CL REQ 3230 creates a converted R' request to the compressed memory. The unit 3230 also retains the association between the original request R 3204 and the converted request R' 3235. The compressed data 3245 returned from the compressed memory is decompressed by the DCMP 3250. If the original request R is a read request, the decompressed data 3255 is directed to the dynamic data selection control unit 3290, which returns the data for R using the selector 3292. If the decompressed data 3255 is a sector, all or part of it (similar to the previous embodiment) is stored in the PB 3298. If the data 3255 is one or more cache lines, the PB can be marked with a shadow sector (the purpose of which will be described in detail later).
[0190] If the original request R is a write request, the data (of R) 3206 is first compressed by the CMPR 3280. The compressed size (CS) of the compressed data is sent to the CL ovf (overflow) unit 3278 of the sector-based hybrid write unit 3270. The CL ovf 3278 implements a write operation similar to FIG. 31A to FIG. 31D Those functions in 3125, 3127, and 3129 described in the previous embodiment of the present invention. If there is no CL overflow, the compressed data can be written to the memory immediately; otherwise, similar to Fig. 27 and Fig.28 In an embodiment of the present invention, a compressed sector request must be created by the sector-based translation and address calculation unit, which must then be decompressed by 3250, merged with new data in 3274, compressed again in 3280, and then finally written to compressed memory 3240. If the size of the original write request coincides with one or more sectors, the sector read step can be omitted.
[0191] In the hybrid sector-based device 3200, the decision unit 3299 of the dynamic data selection control 3290 predicts whether the request R should be converted into a sector request, a sub-sector request (i.e., multiple consecutive cache lines), or a CL request. The prediction decision can be based on one or more criteria. In one embodiment, one criterion is the monitored compressibility; in an alternative embodiment, the criterion can be PB utilization; in another embodiment, the decision can be made using formula (1), (2) or (3) described in paragraph
[00170] . In one example, the compressibility can be monitored by tracking the compressed data size in the CMPR 3280; in an alternative embodiment, the compressed sector or CL size from the ATT 3210 can be used to calculate the compressibility of a particular page. The utilization of the PB can be quantified by measuring the hit rate of the PB 3298. However, when only CLs are preferred for reading, the PBs may not have enough data because their data is not usually stored in the PBs. Therefore, when the decompressed data 3255 does not correspond to a sector but to one or more CLs, the sector to which the CL belongs can be marked in the PB using a pseudo-valid metadata bit, which defines that its data is not actually in the PB, but if the sector is accessed, it may already be in the PB. In this case, when the PB is looked up and the pseudo-valid bit is set, it is a pseudo-hit (rather than a hit) and can be used similar to a hit when measuring PB utilization. Other implementations of quantifying PB utilization or compressibility monitoring can be implemented by those skilled in the art, and such implementations are also contemplated.
[0192] In an alternative sector-based translation format, sector metadata is combined with cache line metadata, however Fig.33AAs shown, the cache lines within each sector are restricted to a specific compressed size; the format is called a sector-based hybrid restricted conversion format because it limits the amount of additional metadata. For example, the CL-size metadata is only 6 bits per sector, instead of SectorLogSize×metadata_width; while in the hybrid metadata format, the CL-size metadata overhead is 8×6=48 bits per sector, for a total of 384 bits per page, while in the metadata format of this example, it is 6 bits per sector, for a total of only 48 bits. In this alternative sector-based conversion, the total amount of metadata for each page 3330 is 96+48=144 bits. However, this metadata format greatly reduces compressibility because all cache lines within a sector must have the size of the largest compressed cache line 3314. For example, the compressed size of sector 0 3323 is now 480 bytes, while in the sector-based hybrid, the size of sector 0 2223 / 2323 is 218 bytes instead. Such a metadata format may be more beneficial for sectors with smaller SectorLogSize. Fig.33B In the alternative, SectorLogSize is set to 4, so there are 16 sectors. This corresponds to Fig.33A The size of sectors 0 3323, compressed sectors 0 3423, and compressed sectors 1 3426 is now 416 bytes (instead of Fig.33A However, the sector translation metadata is now Fig.33A If this format is chosen, one skilled in the art can identify which metadata overhead vs. compression efficiency is best.
[0193] The method and device for supporting such sector-based hybrid restricted conversion format are respectively the same as the aforementioned sector-based hybrid conversion method (FIG. 30 and FIG. 31) and device ( Fig.32 ) except for the following functions: 1) The compressed address of a particular cache line is calculated as follows: R'→Addr=PageStAddr+S→PTR+#pCLs×S→CL-Size, where #pCLs is the number of cache lines preceding the cache line in the requested sector; 2) When a sector is written to memory, the maximum compressed size among the compressed cache lines in the sector must be determined; 3) If the size of the compressed cache line is larger than CL-size, all cache lines in the sector must be read, decompressed, merged and recompressed (equivalent to reading, decompressing, merged and compressing the sector); 4) If the size of the compressed cache line increases and must be stored in an uncompressed manner, the entire sector must be decompressed.
[0194] exist Fig.34In another alternative to the sector-based conversion format described in , the order of the compressed data within each sector can be changed in addition to compression, thereby further improving memory bandwidth. This is in the presence of PB 2898 ( Fig.28 ) and 3298( Fig.32 ) will be particularly advantageous in the case of PB, as this can improve the utilization of PB. The conversion format is called a compressed data reordering sector-based conversion format. Fig.34 In the exemplary format, sector 0 3423 collects cache lines (CL) 0, 2, 4, 6, 8, 10, 12, 14; sector 1 3426 collects CL1, 3, 5, 7, 9, 11, 13, 15; sector 2 3429 collects CL16, 18, 20, 22, 24, 26, 28, 30; and so on. If the stride of the memory request is 2, the exemplary format organizes the sector compressed data. The organization of the sector data is encoded in an additional field sector encoding 3432 so that the address translation method and device can associate the memory request with a specific sector. The amount of additional metadata required is negligible compared to the previously disclosed embodiments. The metadata is saved per page, allowing different reordering types to be applied to different pages. In the alternative, the metadata can be omitted if one reordering type is applied to the entire sector-based compressed memory.
[0195] In the example where compressed data is reordered based on sector translation, a reordering of data organized in sectors occurs when a page is compressed. There is a set of preconfigured reordering patterns, for example, strides of 2, 3, 4 of the size of the accessed data (e.g., typically cache lines). The exact type of reordering is determined by a prediction process that monitors the access traffic to the data within the page before the data is compressed and attempts to match it to one of the preconfigured reordering patterns. When the page is first compressed, the best match is selected. In alternative embodiments, the type of reordering can be adjusted by recompressing the page, particularly if the predictor finds that the previous prediction was inaccurate.
[0196] If memory traffic is monitored for regular access patterns, then in an exemplary embodiment where the monitored access patterns are based on strides, the boundaries of the stride value set can be limited by the total number of data blocks of the access pattern monitored per page divided by SectorLogSize (measured in the number of data blocks). For example, if the access pattern is monitored at cache line granularity, then for a 4KB page including 64 cache lines, and for a SectorLogSize of 4 cache lines, the stride belongs to the value set [0,16]; for stride 16, sector 0 will include cache lines (CL) 0, 16, 32, 48; sector 1 will include CL1, 17, 33, 49; and so on. If memory traffic is monitored for non-regular access patterns, then in an exemplary embodiment, the monitoring mechanism can include a 2D array of counters, where the width of each dimension is determined by the number of data blocks monitored in a page (e.g., cache line). The 2D array tracks possible dependencies between consecutive block accesses within a page. One skilled in the art can implement an implementation that can monitor consecutive block accesses within a page, even if the accesses occurred in different pages in between. One dimension of the 2D array is used to refer to the previous data block access, and the other dimension is used to refer to the current data block access, so based on the combination of the previous access and the current access, the associated counter will increment. For example, the counter at (10, 40) represents the number of consecutive accesses between blocks 10 and 40 within the page. The counter group is evaluated periodically or on demand to determine whether the array of counters can derive a formal correlation-based pattern that will be used to group data blocks within a sector. The grouping can still be encoded with the sector encoding metadata field, but it requires the generation of a hash function so that the correct sector can be determined for the input memory request address.
[0197] If the access pattern of each page is monitored in isolation, this may require a large amount of resources to maintain all the access patterns. In yet another embodiment, the access patterns of more than one page may be used to determine the type of reordering for a particular page. Such predictions may be less accurate, but the predictor requires fewer resources to make the determination. The monitored traffic may be read-only traffic, write-only traffic, and / or both.
[0198] In an alternative to reordering compressed data based on sector conversion, the data organized in sectors is reordered when the data in a page is first compressed. In this case, the entire page needs to be read from memory, compressed, and written back to memory. The data reordered within each sector is a cache line, however, in other alternative implementations, other sizes of data blocks can be considered for reordering.
[0199] Prior sector-based address translation methods (and devices) can support compressed data reordered in a sector-based translation format if enhanced by a prediction method (device) that monitors Fig.25 , Fig.26 , Figure 30 and Figure 31 ( Fig. 27 , Fig.28 and Fig.32 ), and the first time the page is compressed (metadata determines whether the page is compressed) the data for the page is read, reordered, compressed, and stored in memory by updating metadata 3434a, b, c, etc. and sector encoding 3432 accordingly. In alternative embodiments, the page need not already be compressed, but can be recompressed if the current sector encoding type does not match the predicted sector encoding type.
[0200] In alternative embodiments of the reordering, method and apparatus based on the sector conversion format, in addition to achieving better spatial alignment, the compressed data within a sector may be reordered based on other criteria. In another alternative embodiment, the compressed data within a sector may be reordered based on its compressed size to facilitate better alignment with potential existing fixed-size storage block sizes. Such an embodiment would be preferred in situations where data compression is used to minimize traffic to / from memory. For example, if the sizes of compressed blocks within a sector are 40B, 50B, 20B, and 10B, the memory access block size is 64B, and the goal is to minimize the worst-case traffic (i.e., the traffic of compressed data should be less than or equal to the uncompressed data for each block of data accessed, so extracting isolated compressed data blocks - when the access pattern is not conducive to extracting sectors - should not result in extracting more memory blocks than uncompressed memory), then the compressed data is sorted in the original order, resulting in a 50B compressed data block spanning two memory access blocks; to solve this problem without reordering the blocks within the sector, it would be necessary to introduce a fragment after pushing the 40B sized blocks so that the 50B blocks fit into a block of size equal to the memory access block size, however, this would result in the need to further push the 20B and 10B sized blocks, which requires additional space and reduces compressibility; instead, by reordering the compressed blocks as follows 40B, 20B, 50B, 10B, the same level of compressibility can be maintained while also achieving alignment. Reordering the data within a sector based on the compressed block size requires a small amount of metadata per sector that defines the ordering of the compressed data blocks, i.e., SectorLogSize×(log2(SectorLogSize)); for the aforementioned example, where SectorLogSize=4, the amount of metadata is 8 bits / sector. If the reordering is limited to compressed blocks within a sector, then the reordering can be performed at any time when the sector is compressed. However, if the reordering of the data occurs in such a way that all sectors are affected, then it is preferred that the reordering be performed when the entire page is compressed, similar to the previous embodiment.
[0201] The above reference Figures 20 to 34The various embodiments and alternatives described can be summarized as follows. The device 2700, 2800, 3200, 2700', 2700" for accessing compressed computer memory 2740, 2840, 3240 residing in physical computer memory includes an address translation table 2710, 2810, 3210, a compressed address calculator unit 2720, 2820, 3220, a sector request unit 2730, 2830, 3230, a selector unit 2760, 2890, 3290, a sector merging unit 2770, 2870, 3270, a decompressor 2750, 2850, 3250 and a compressor 2780, 2880, 3280.
[0202] The address translation table 2710, 2810, 3210, the compressed address calculator unit 2720, 2820, 3220 and the sector request unit 2730, 2830, 3230 are configured in combination to: convert a physical memory access request R into a sector-based compressed memory request R', wherein a sector id is automatically extracted using the address 2704, 2804, 3204 of the physical memory access request R, and the sector id is used to determine the location of the sector in the compressed computer memory 2740, 2840, 3240 from the sector-based translation metadata 2742, 2842, 3242, calculate the compressed address CA and size Size of the determined sector, and based on the compressed address CA and size Size, make a sector request R' 2735, 2835, 3235 to the compressed computer memory 2740, 2840, 3240.
[0203] The decompressors 2750, 2850, 3250 and selector units 2760, 2890, 3290 are configured in combination to operate on compressed sector data 2745, 2845, 3245 retrieved from a compressed computer memory 2740, 2840, 3240 in response to a sector request R' to obtain read request response data from the compressed sector data 2745, 2845, 3245 using the address and size 2705, 2805, 3205 of the physical memory access request R, and return the obtained read request response data in a decompressed form 2708, 2808, 3208 to the source of the physical memory access request R when it is a read request.
[0204] The sector merging units 2770, 2870, 3270 and the compressors 2780, 2880, 3280 are configured in combination to merge the compressed sector data 2745, 2845, 3245 - data retrieved from the compressed computer memory 2740, 2840, 3240 in response to the sector request R' - with the data 2706 in the physical memory access request R to obtain sector-based write request data using the address and size 2705, 2805, 3205 of the physical memory access request R when it is a write request, and store the obtained sector-based write request data as compressed sector data 2785, 2885, 3285 in the compressed computer memory 2740, 2840, 3240.
[0205] according to Fig. 27 A first embodiment of a device 2700 for accessing compressed computer memory residing in physical computer memory (and its Fig.25 ), according to Fig.27B A second embodiment of the device 2700' (and its Fig.26 ), according to Fig.27C Alternative equipment 2700", according to Fig.28 A third embodiment of the device 2800 (and its Fig.25B ) and according to Fig.32 The fourth embodiment of the device 3200 is an embodiment of the above-mentioned devices 2700, 2800, 3200, 2700', and 2700".
[0206] The corresponding method can be seen as comprising functional steps performed by the above-mentioned devices 2700, 2800, 3200, 2700', 2700".
[0207] For the above-mentioned devices 2700, 2800, 3200, 2700', 2700", the compressed storage blocks in the compressed computer memory 2740, 2840, 3240 are represented as sectors, wherein all sectors contain a fixed number of compressed storage blocks, such as cache lines, all sectors have a fixed logical size in the form of a fixed number of compressed storage blocks, and all sectors have a varying physical size in the form of the total size of the data stored in each compressed storage block.
[0208] In particular, for the first, second and third embodiments of the devices 2700, 2800, 3200, the decompressors 2750, 2850, 3250 are configured to decompress compressed sector data 2745, 2845, 3245 retrieved from the compressed computer memory 2740, 2840, 3240 in response to the sector request R', and to provide the decompressed sector data 2755, 2855, 3255 to the selector unit 2760, 2890, 3290 and the sector merging unit 2770, 2870, 3270. The selector units 2760, 2890, 3290 are configured to obtain data from the decompressed sector data 2755, 2855, 3255 using the address and size 2705, 2805, 3205 of the physical memory access request R, and return 2708, 2808 the obtained data to the source of the physical memory access request R in response to the read request. The sector merging unit 2770, 2870, 3270 is configured to obtain data from the decompressed sector data 2755, 2855, 3255 using the address and size 2705, 2805, 3205 of the physical memory access request R, merge the obtained data with the data 2706 in the physical memory access request R into new uncompressed sector data 2775, 2875, 3275, and provide the new uncompressed sector data 2775, 2875, 3275 to the compressor 2780, 2880, 3280. The compressor 2780, 2880, 3280 is configured to compress the new uncompressed sector data 2775, 2875, 3275 in response to the write request and store it as the compressed sector data 2785, 2885, 3285 in the compressed computer memory 2740, 2840, 3240. The corresponding method may be regarded as also including the functional steps of the apparatus 2700 , 2800 , 3200 of the first embodiment, the second embodiment and the third embodiment.
[0209] In particular, for the second and third embodiments of the device 2800, 3200, the selector unit 2890, 3290 may include a pre-fetch buffer 2898, 3298 configured to buffer all or part of the decompressed sector data 2755, 2855, 3255 resulting from the physical memory access request R as a first read request. The selector unit 2890, 3290 is configured to, for a subsequent physical memory access request as a second read request, use the address and size of the second read request to check whether the requested data is present in the pre-fetch buffer 2898, 3298, and if the requested data is present in the pre-fetch buffer, retrieve the requested data from the pre-fetch buffer 2898, 3298 and return the retrieved requested data to the source of the second read request, or if the requested data is not present in the pre-fetch buffer, retrieve and return the requested data for the second read request, as defined above for the physical memory access request as a read request. The pre-fetch buffer 2898, 3298 may advantageously be configured to buffer portions of the decompressed sector data 2755, 2855, 3255 that have not yet been returned to the source of the first read request. The corresponding method may be viewed as also comprising the functional steps of the second and third embodiments of the apparatus 2800, 3200.
[0210] The compressed storage page in the compressed computer memory 3240 may include a plurality of sectors, each sector containing the fixed number of compressed storage blocks, such as cache lines, and in particular for the third embodiment of the device 3200, for each compressed storage page, the sector-based conversion metadata 3242, 2930 includes: a) sector metadata 2931a, 2931b, PTR, which includes pointers to sectors 2934a, 2934b of the compressed storage page, and b) storage block metadata 2932a, 2932b, CL-SIZE, which includes the size 2932a1, 2932a2 of the storage block of each sector. The device 3200 is configured to selectively convert the physical memory access request R into any of the following i) a sector-based request for at least one sector in the compressed computer memory 3240, or ii) a block-based request for one storage block or multiple consecutive storage blocks in the compressed computer memory 3240.
[0211] In particular, for the third embodiment of the device 3200, the selector unit 3290 may include a decision function 3299 configured to make a decision: to cause the compressed address calculator unit 3220 and the sector request unit 3230 to selectively make a sector-based read request, a sub-sector-based read request, or a block-based read request to the compressed computer memory 3240. The decision function 3299 is operative to make the decision based on any of the following: the monitored compressibility of the compressor 3280, the monitored memory access pattern, the utilization of the pre-fetch buffer as described above, the evaluation of the compression ratio of the requested sector relative to its uncompressed physical size, and the evaluation of the compression ratio of the requested sector relative to its uncompressed physical size and the average metadata for each request. In addition, the selector merging unit 3270 may be configured to selectively convert the physical memory access request R into a sector-based write request, a sub-sector-based write request, or a block-based write request to the compressed computer memory 3240 according to the size of the physical memory access request R. The corresponding method may be considered to also include the functional steps of the third embodiment of the above-mentioned device 3200 .
[0212] It can be recalled that the compressed storage page in the compressed computer memory 2740 includes a plurality of sectors, each sector containing the fixed number of compressed storage blocks, such as cache lines. In particular for the second embodiment of the device 2700', each sector 2423 includes compressed block metadata 2418, CSM, which indicates the respective size of the compressed storage blocks 2414 of the sector 2423. The selector unit 2760 is configured to obtain read request response data from the compressed sector data 2745 retrieved from the compressed computer memory 2740 by using the compressed block metadata 2418, CSM in the compressed sector data 2745 to extract one or more compressed storage blocks, and to provide the extracted one or more compressed storage blocks 2761 to the decompressor 2750. The decompressor 2750 is configured to decompress the extracted one or more compressed storage blocks 2761 and return 2708 the decompressed one or more storage blocks 2753 to the source of the physical memory access request R in response to the read request.
[0213] Further, for the second embodiment of the device 2700′, the selector unit 2760 may be further configured to provide 2762 the compressed sector data 2745 retrieved from the compressed computer memory 2740 to the decompressor 2750. The decompressor 2750 is configured to decompress the compressed sector data 2762 provided by the selector unit 2760, and provide the decompressed sector data 2755 to the sector merging unit 2770. The sector merging unit 2770 is configured to obtain data from the decompressed sector data 2755 using the address and size 2705 of the physical memory access request R, merge the obtained data with the data in the physical memory access request R into new uncompressed sector data 2775, and provide the new uncompressed sector data 2775 to the compressor 2780. The compressor 2780 is configured to compress the new uncompressed sector data 2775 in response to the write request and store it as the compressed sector data 2785 in the compressed computer memory 2740.
[0214] Alternatively, for alternative 2700″ of the second embodiment, the compressor 2780 and the sector merging unit 2770 may be configured to compress the data 2706 in the physical memory access request R into compressed block data, receive the compressed sector data 2745 retrieved from the compressed computer memory 2740, use the address and size 2705 of the physical memory access request R and the compressed block metadata 2418, CSM in the compressed sector data 2745 to merge the compressed block data with the compressed sector data 2745; and store the merged compressed sector data 2745 in the compressed computer memory 2740, 2840 in response to the write request.
[0215] The corresponding method can be regarded as also comprising the functional steps of the second embodiment of the device 2700 ′ or its alternative 2700 ″ as described above.
[0216] Address Translation: Variable Segmentation Implementation
[0217] The metadata overhead can be further minimized (reducing memory bandwidth and overhead even more) by applying segmentation in compressed sectors and / or compressed cache lines (for sector-based hybrid conversion implementations). Fig.35 A compressed page 3510 is shown including a compressed cache line 3514, whose CL-SIZE is measured in bytes. Fig.36An alternative to the page is shown where CL-SIZE is measured in number of segments. Segmentation divides the memory into segments 3634 of fixed size, e.g. 8 bytes, so compressed sectors (or cache lines) are limited to a set of predefined sizes, rather than being encoded as by CL-SIZE metadata 3624a which is determined by the number of segments required to satisfy a certain compressed size. Compressed sizes that do not align to a segment boundary need to be rounded up to the nearest segment boundary. For example, CL0 is 27B, but in Fig.36 The segment metadata conversion needs to be rounded to 32B. This reduces the possible size space, resulting in fewer bits needed to represent the compressed size; however, this results in internal fragmentation and worse compressibility, because wider segments result in greater internal fragmentation, i.e., more space is not fully utilized due to misalignment between compressed data size and segment boundaries.
[0218] Fig.37 An alternative metadata conversion format is described in which the compressed data is segmented, but the length of the segments is variable, based on the observation that certain compressed sizes occur more frequently than other sizes, and therefore certain numbers of segments are more important than other sizes. In one example, the frequency size distribution 3740 segment boundary 26-38 may occur more frequently than other parts. Therefore, the variable length segmentation is based on the compressed data size distribution. The "hot" number of segments (compressed sizes that occur frequently) are narrow, while the "cold" number of segments (compressed sizes that occur less frequently) are wide; for example, segment 0-25B 3734a is cold, while segment 31-32B 3734b is hot. Therefore, the CL-SIZE metadata in the previous embodiment needs to be replaced with CL-meta, which encodes variable length segment boundaries instead of sizes. Variable length segmentation can be applied to cache lines, sectors, or other compressed data entities by those skilled in the art.
[0219] Using variable length segments in any of the above sector-based translation metadata formats (pure sectors, hybrid sectors, restricted hybrid sectors, etc.) triggers the following problem limitations:
[0220] For compressed data, the minimum and maximum possible sizes are S min , S max , given a fixed number (N) of segments [S min , B1], (B1, B2], ..., (B N-1 , S max ], find the boundaries B1, B2, ..., B that minimize the cost N-1 :
[0221] overhead = Sum(freq(s)*(bound(s)-s)), where bound(s) = B i ,if
[0222] s>B i -1 and s<=B i (1)
[0223]
[0224] in
[0225]
[0226] An example approach to solve the previous problem is Fig.38 The tentative step 3800 works as follows:
[0227] exist Fig.38 In, from a single segment [S min , S max ](0, CL_Size)3810 starts, introducing the first boundary B i 3820 to create two segments [S min , B i ] and (B i , S max ], for B i Try S min With S max All values between ; assign the value that minimizes the cost equation given above. Then introduce the second bound B j , the boundary can be smaller or larger than B i , and are also assigned the value that minimizes the cost equation. The process is repeated until the desired number of segments are created (conditional check 3830). In another alternative embodiment, the method can be optimized by further refining the boundaries found by the above process: eliminating boundaries one by one from oldest to newest, and introducing newly discovered boundaries. Once each boundary has been refined, the process is repeated until there is no further cost improvement from one iteration to another.
[0228] Variable segments can be integrated in a Fig. 27 , Fig.28 and Fig.32In the memory compression system of the conversion device embodiment in , by also adding an additional unit, the unit is a mechanism for collecting the compressed size distribution. This is achieved by analyzing the compressed data. In an embodiment of implementing statistical compression, when the compression device collects data value statistics for compression encoding, the collection of compressed size distribution can be completed during sampling. In an alternative embodiment, the distribution can be established by collecting information from the actual compressed data. Two groups of segment boundaries must be supported. During initialization, the boundaries can be initialized to represent segments of fixed size. Then, at runtime, the distribution of compressed sizes is established, and segments of variable size can be defined as the second group of segments. Each compressed entity needs to be mapped to the segment boundary to which it corresponds. This can be done in different granularities (cache lines, sectors, pages) with variable metadata overhead. For example, if each compressed entity is allowed to be mapped to a different segment boundary, the metadata needs to increase 1 bit for each compressed entity. Alternatively, if the compressed entities of the same page are forced to be mapped to the same segment boundary, only one bit needs to be added for each page. Migration from one segmentation scheme to another must be applied to all compressed entities that share the same segmentation set. For example, if all compressed entities in a page are mapped to the same segmentation set, they must all be migrated to the new segmentation set at the same time. In an alternative, migration can be done on demand, i.e., after the new segmentation set is created, each write request arriving triggers a recompression using the new segmentation set. In the case of several compressed entities sharing the same segmentation scheme, all entities must be recompressed when a write request arrives for one of them. When a set of segmentation boundaries is to be updated, each compressed entity mapped to that group needs to be recompressed using the second segmentation set (the one that is not affected).
[0229] The above reference Figures 35 to 38 The described embodiments and alternatives can be summarized as a method for deriving compression metadata of a specific size that maximizes a target effect for compressing blocks of data. The method includes analyzing the size of compressed blocks, deriving the frequency and size distribution of the compressed blocks, identifying one or more candidate compressed block sizes (the compressed blocks will be rounded to this size), evaluating whether the identified sizes maximize the target effect while being represented by metadata of the specific size, and if so, generating a compression metadata format accordingly, or, otherwise, repeating the method starting from the deriving step. The specific size can typically be a given, or a portion of the target effect, to minimize the metadata overhead while maximizing the compression ratio. The data block is typically any of the following: a storage block, a network block, a cache line, a storage page, or a sector.
[0230] A corresponding device for deriving compression metadata of a specific size that maximizes a target effect for compressing a block of data will include means for executing the functional steps of the above method.
[0231] Address translation: data dynamic change - sector overflow processing
[0232] The disclosed sector-based conversion format, method and apparatus present an effective solution to reduce high conversion metadata overhead, eliminate internal fragmentation and increase bandwidth gain, problems faced by previous conversion schemes. Among other things, compressed data overflow due to dynamic data changes is handled by the prior art in one of the following ways: introducing external fragmentation at a fine granularity that requires subsequent (or periodic) significant work to (re)create contiguous space through re-compaction; or being limited to re-compacting cache lines. The former is achievable by retaining metadata that determines the exact location of compressed cache lines and their size, resulting in metadata overhead of more than 1000 bits (i.e., 64×12+64×6=1152 bits, compared to 768 bits described in paragraph
[00138] ) per page; in addition, the bandwidth gain is reduced due to fragmentation caused by the inevitable destruction of spatial reference locality. On the other hand, in the latter case, re-compaction tends to add a lot of latency; this also affects the amount of free memory and has an adverse impact on free memory management.
[0233] exist Fig.39AIn the exemplary page frame of , compressed sectors 3924a, 3924b, etc. of compressed page 3920 are aligned at original positions in page frame 3910, and these positions are determined as follows: sector i×SectorLogSize×64B; for example, sector 1 is placed in the 512th byte of the compressed page. Such placement is beneficial when compressed sectors can help improve memory bandwidth requirements, but increasing storage capacity is not a concern. Therefore, the space released after compression is unused (3928a, 3928b, etc.). In addition, the conversion metadata 2430 of each page needs to include a sector SIZE. Since the maximum sector physical size (SectorPhysSize) is 512B (when the sector is not compressed), the sector SIZE is 8b in this embodiment; therefore, the total size of each page conversion metadata is 64b. In the described embodiment, if the compressed data of a sector expands in size due to dynamic data changes, the compressed sector will expand in size to gain space from unused space; for example, the size of sector 1 in the embodiment of FIG. 39b is 175B, gaining more space from unused space 3928b, and the change is reflected in the metadata. If the compressed sector expands beyond the available unused space, it will be forced to be decompressed and stored in uncompressed form. This expansion of compressed sectors due to dynamic data changes is handled by the disclosed sector-based conversion device and method embodiments detailed above, without the need for additional functionality.
[0234] Fig.40A An alternative page frame layout is shown in which compressed sectors are placed one after another as indicated by sector PTR 4054 of conversion metadata 4050; the placement of compressed sector data is conducive to improving memory bandwidth requirements while also increasing effective storage capacity. In the exemplary page frame implementation, the active page 4020 includes compressed sectors 4024a, 4024b, etc. The area 4014 released due to data compression of the page frame is utilized by the exemplary auxiliary memory by placing two victim pages V1 4038 and V2 4034, while there is a free fragment (ff) 4039. As also shown by interval metadata 4056, the released area also includes intervals 4040 associated with the active compressed page 4020. The metadata 4056 includes information such as Fig.1240b, and also includes an interval use (u) bit 4056c; the u bit 4056c can be used to indicate whether the interval is used. For example, if sector 1 (S1) 4024b is expanded in size due to dynamic data changes of the compressed data of sector 1 and has a new size of 175 bytes, S1 cannot fit in the same position. As shown in Figure 40b, the interval is used to write the expanded sector 1. This results in changing the Sec1PTR 4054a ( Fig.40B ) to point to the new location, SIZE 4058a is updated, the interval boundaries are updated accordingly, in this case Rb4056a points to position 3475 (175 bytes to the right), and the u bit 4056c is set to '1'. The old location of S1 now becomes fragment 4060. In this exemplary embodiment, the fragment location cannot be directly used because it is not recorded, but the location of the fragment can be dynamically tracked using the sector PTR and SIZE metadata. In an alternative embodiment, the created fragments can be recorded in the metadata, but this will increase the overhead of converting the metadata. In an alternative embodiment, if there is a mechanism that can track the intervals used, the u bit can be omitted.
[0235] In one embodiment, the interval associated with a compressed page may be continuous with the compressed page. In an alternative embodiment, the interval associated with a compressed page may be discontinuous with the compressed page, but still within the same page frame. In yet another embodiment, the interval associated with a compressed page may be discontinuous with the compressed page and in a different page frame, however, the embodiment requires more metadata, namely, in addition to the interval boundary, the page frame in which the interval is located.
[0236] The compressed sector overflow handling method has two advantages over the prior art: 1) All compressed data for the sector is still packed together, so if spatial reference locality is present, bandwidth can still be improved by obtaining the entire sector. 2) The fragmentation created is external and therefore traceable; more importantly, it is coarser in granularity and can therefore be better utilized. In another exemplary page frame implementation, one or more fragments 4060 can be used to fill other extended sectors.
[0237] FIG. 41A to FIG. 41C An exemplary implementation of a sector overflow processing method is described in FIG. 41B to FIG. 41C yes Fig.41ADetailed description of the part. The method includes, among other steps, a fragment utilization process 4120, an interval utilization process 4130, a re-compaction process 4140, and an underflow processing process 4180. The sector overflow processing method is to input the size (S') of the new compressed sector version and the size (S) of the old version of the same sector. First, check whether S' is greater than S 4110. If not, the underflow processing process is triggered, which checks whether the size S' is less than the size of S. If so (the result of 4184 is "yes"), a new fragment is created for the unused space, and the sector SIZE metadata is updated with S'→SIZE in the meta storage 4188; if S' and S are the same size (the result of 4184 is "no"), no further processing is required. On the other hand, if S'→SIZE>S→SIZE (the result of 4110 is "yes"), it is a sector overflow.
[0238] First, the fragment utilization process 4120 is triggered, and the fragment 4123 created in the compressed page due to the previous relocation of another sector into the interval is searched in the list; if there is a fragment Fi, in which S'4126 can be accommodated, first, a new fragment F' is created to record the current position (S→PTR) and size (S→SIZE) 4129 (top) of the old version of sector S; after that, the sector conversion metadata (meta storage) 4129 (bottom) is updated. If the size of fragment Fi cannot be fully utilized to accommodate S', the position and size of Fi must be updated to record the unused space of the fragment. As shown by the arrow connecting 4129 and 4123, the fragment lists of Fi and F' must be updated at the same time. In this way, sector overflow can be handled.
[0239] If there is no fragment to be utilized to handle the sector overflow, the interval utilization process 4130 is triggered. The process 4130 first checks whether the interval associated with the page to which the compressed sector belongs is large enough to accommodate S'4134. If so (the result in 4134 is "no"), first, a new fragment F' is created to record the current position (S→PTR) and size (S→SIZE) of the old version of the sector S 4138 (top); then, the sector conversion metadata (meta storage) 4138 (bottom) is updated to make the sector pointer point to the beginning of the interval, and the sector size is updated with the size of S'; in addition, the boundaries of the interval must be updated accordingly and the usage bit of the interval must be set to '1'. In this way, the sector overflow can be handled.
[0240] If the extent exploiter cannot handle the overflow, a recompacting process 4140 is triggered. The goal of the process is to place sectors one after another in order to eliminate any external fragmentation. The process has a pre-processing step 4143, which reads the sector-based conversion metadata sector PTR and sector SIZE; the sector pointer (PTR) is usually in the sector-based conversion metadata; the sector size (SIZE) is either provided ( Fig.24 ); or it can be calculated by subtracting the sector pointer ( Fig. 22 / 23), or by, for each sector, adding the CL-SIZE of all cache lines within the sector ( Fig.29 ), or by multiplying CL-SIZE by the number of cache lines in the sector for each sector (Figure 33). The pre-processing step 4143 can also use a fragment list to quickly determine whether there are available fragments. The pre-processing step 4143 uses the entire interval or a portion of the interval to calculate whether the sector can fit into an existing compressed page if it is re-compacted. If successful (the result of 4146 is "yes"), the re-compaction 4149 is performed by reading the sector from the memory, re-compacting it in the buffer, and writing it back to the compressed memory, thereby updating the sector conversion metadata and interval metadata in the metastore. If unsuccessful (the result of 4146 is "no"), the sector overflow is handled in two ways: either by extending the interval (if possible) 4150 and triggering the interval utilization process again 4130, or by fully decompressing the compressed page 4170; the latter is preferred, especially if the size of the compressed page and its interval exceeds the size of the uncompressed page (i.e., page frame) 4160. In either case, the idle manager of the memory compression system must ensure that the decompressed page or expanded extent does not overwrite other data not related to the compressed page for which the sector overflow was processed.
[0241] In an alternative embodiment, in fragment utilization 4120, if the size of fragment Fi cannot be fully utilized to fit S', the data of sector S' can be padded with don't care bits to fit the remaining fragment space. This can potentially simplify fragment management, but will result in internal fragmentation (in the new sector S'), and the decompressor must be able to decompress data mixed with don't care bits.
[0242] In yet another alternative embodiment, the fragmentation utilization process can be bypassed, trading better space utilization for faster overflow handling. In yet another alternative embodiment, fragmentation utilization can be omitted entirely, trading better space utilization for simpler overflow handling. In yet another alternative embodiment, 4188 can be omitted, thereby creating internal fragmentation (i.e., untraceable fragmentation) in the sector. Other alternative embodiments can be implemented by those skilled in the art, and such embodiments are also contemplated.
[0243] Fig.42 A sector overflow device 4200 is described, which includes the following units: Ovf check unit 4210, fragment utilization unit 4220, interval utilization unit 4230 and re-compactor unit 4240. The units implement FIG. 41A to FIG. 41C The functions described in the method; the Ovf inspection unit 4210 implements the functions of 4110 and 4180, the fragment utilization unit 4220 implements the function of 4120, the interval utilization unit 4230 implements the function of 4130, and the re-compressor unit implements the functions of 4140 and 4160.
[0244] Fig.43An embodiment of a memory compression system 4300 is described, the system including a sector-based address translation device 4310, a sector-overflow device 4320, a free memory manager device 4330, a compression device 4340 and a decompression device 4350, and finally a compressed memory 4360, which also includes intervals 4365 and compressed data or a mixture of compressed data and non-compressed data. The sector-based address translation device 4310 can be any of 2700, 2800 or 3200 (including the decompression device 4350 and the compression device 4340, together forming a device 4305 for accessing compressed computer memory). The sector overflow device can be an embodiment 4200. The free memory management device can be any embodiment of a device for managing free memory, for example, any embodiment of an auxiliary memory device (first embodiment, zero copy). The compression device and the decompression device can implement any compression and decompression algorithm, but the decompression device must be able to decompress data compressed by the compression device. For each compressed page in the memory, there may be an interval 4365 associated with the compressed page; the interval is used as a synchronization point between the sector overflow device 4320 and the free memory management device 4330 to determine how much space is used for storage capacity expansion and overflow processing. As previously described, the sector overflow device 4320 / 4200 can silently handle the overflow until the interval utilization 4230, the fragment utilization 4220 and the re-compactor 4240 can handle the overflow; if the overflow device cannot handle the overflow, the compressed page is decompressed, or the interval is expanded. In either case, the free memory manager 4330 is notified (for example, through an interrupt) to reorganize the compressed memory so that other unrelated data is not overwritten by any of these actions. This is an example of synchronization between the devices. Those skilled in the art may use a locking mechanism or other such mechanism to achieve synchronization of the units. In alternative embodiments, if the overflow device cannot handle the overflow, the entire page can be relocated to another location in memory (as described in paragraph
[00123] ) or the page can be split (as described in paragraph
[00125] ).
[0245] therefore, Fig.43 It can be viewed as a sector-based memory compression system 4300, which includes compressed memory 4360, devices 4305, 2700, 2800, 3200 for accessing compressed computer memory as described previously herein, and a free memory management device 4330.
[0246] Advantageously, the free memory management device 4330 includes a compressed memory management device 405 (see Figure 4and related description), for having one or more processors P1-P N , a computer system 400 having a compressible main memory 414, a secondary memory, and an operating system 420, wherein the compressible main memory 414 has a compressed storage space, the compressed storage space including a direct access to the one or more processors P1-P N active part of the processors P1-P and cannot directly access the one or more processors P1-P N The compressed storage space is in the form of memory released by memory compression. The compressed storage management arrangement 405 includes an auxiliary memory 440 for maintaining a layout of the compressed storage space of the compressible main memory 414, the layout including the size and location of each storage page and free storage areas in the compressed storage space. In addition, the compressed storage management arrangement 405 also includes a selector function 430 for interacting the operating system 420, the secondary storage and the auxiliary storage 440.
[0247] The memory management settings 405 of the free memory management device 4330 are configured to trigger compression of storage pages in the compressible main memory 414, intercept page-in requests from the operating system 420 to the secondary memory, use the layout of the compressed storage space maintained by the auxiliary memory 440 to locate the page requested by the page-in request in the auxiliary memory 440 when available, and make the located requested page available in the active part of the compressed storage space. The memory management settings 405 of the free memory management device 4330 are further configured to intercept page-out requests from the operating system 420 to the secondary memory, use the layout of the compressed storage space maintained by the auxiliary memory 440 to obtain a free area for the page requested by the page-out request, and accommodate the requested page in the obtained free area of the auxiliary memory 440.
[0248] As already explained, the sector-based memory compression system 4300 may further include a sector overflow device 4320, 4200, wherein the sector overflow device 4320, 4200 includes an overflow check unit 4210, a fragment utilization unit 4220, an interval utilization unit 4230, and a re-compaction unit (4240). The overflow check unit 4210 is configured to check whether the size of the new version of the compressed sector is greater than the size of the old version, and if not, allow the old version to be overwritten by the new version of the sector. The fragment utilization unit 4220 is configured to: if the size of the new version of the sector is found to be greater than the size of the old version by the overflow check unit 4210, search for a storage fragment of appropriate size in the free storage fragment list to fit the new version of the sector, and if such a storage fragment is successfully found, insert the new version of the sector into the found storage fragment, and invalidate the old version of the sector by inserting the area where the old version is located in the free storage fragment list. The interval utilization unit 4230 is configured to accommodate the new version of the sector in the interval data 4365, Range by updating the amount of free data in the interval data 4365, Range accordingly, and if so, invalidate the old version of the sector by inserting the area where the old version resides in the free storage fragment list. Finally, the re-compaction unit 4240 is configured to reset the sector data so that different storage fragments are moved together to form a continuous free storage fragment space.
[0249] In one or more embodiments, the overflow check unit 4210 also includes a sector underflow processing unit, which is configured to check whether the size of the new version of the compressed sector is smaller than the size of the old version. If not, the old version is allowed to be overwritten by the new version of the sector. Otherwise, a new storage fragment is inserted into the free storage fragment list, and the size of the new storage fragment is equal to the difference between the old version and the new version of the sector, and the part of the old version of the sector is covered with the new version accordingly.
[0250] The interval data 4365, Range, utilized by the interval utilizing unit 4230 may be a storage space continuous with a sector, a storage space discontinuous with a sector, or a non-storage space.
[0251] In one or more embodiments, the sector-based memory compression system 4300 further includes the Figures 35 to 38 The device for exporting compressed metadata.
Claims
1. A device for accessing compressed computer memory residing in physical computer memory, wherein: The compressed storage blocks in the compressed computer memory are represented as sectors, and wherein all sectors contain a fixed number of compressed storage blocks, all sectors have a fixed logical size in the form of the fixed number of compressed storage blocks, and all sectors have a varying physical size in the form of the total size of the data stored in the compressed storage blocks, the apparatus comprising: Address translation table; Compressed address calculator unit; Sector request unit; selector unit; Sector merging unit; a decompressor; and Compressor, The address translation table, the compressed address calculator unit and the sector request unit are configured in combination to convert a physical memory access request (R) into a sector-based compressed memory request (R'), wherein: automatically extracting a sector id using the address of the physical memory access request (R), the sector id being used to determine the location of a sector in the compressed computer memory from sector-based translation metadata, Calculate the compressed address and size of the determined sector, and Based on the compressed address and size, making a sector-based compressed memory request (R') to a compressed computer memory; The decompressor and the selector unit are configured in combination to: operate on compressed sector data retrieved from the compressed computer memory in response to the sector-based compressed memory request (R') in the case where the physical memory access request (R) is a read request to obtain read request response data from the compressed sector data using the address and size of the physical memory access request (R), and return the obtained read request response data in a decompressed form to the source of the physical memory access request (R) as a read request; and The sector merging unit and the compressor are configured in combination to: when the physical memory access request (R) is a write request, merge the data of the compressed sector data retrieved from the compressed computer memory in response to the sector-based compressed memory request (R') with the data in the physical memory access request (R) to obtain sector-based write request data using the address and size of the physical memory access request (R) as a write request, and store the obtained sector-based write request data as compressed sector data in the compressed computer memory.
2. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 1, wherein: The compressed storage block is a cache line.
3. The device for accessing compressed computer memory residing in physical computer memory according to claim 1 or 2, in, The decompressor is configured to: decompress compressed sector data retrieved from the compressed computer memory in response to the sector-based compressed memory request (R') and provide the decompressed sector data to the selector unit and the sector merging unit; wherein the selector unit is configured to: obtain data from the decompressed sector data using the address and size of the physical memory access request (R), and return the obtained data to the source of the physical memory access request (R) in response to the read request; The sector merging unit is configured to: obtain data from the decompressed sector data using the address and size of the physical memory access request (R), merge the obtained data with the data in the physical memory access request (R) into new uncompressed sector data, and provide the new uncompressed sector data to the compressor; and The compressor is configured to compress the new uncompressed sector data in response to the write request and store the compressed new uncompressed sector data as the compressed sector data in the compressed computer memory.
4. The apparatus for accessing compressed computer memory residing in a physical computer memory according to claim 3, wherein the selector unit comprises: a pre-fetch buffer configured to: buffer all or part of the decompressed sector data obtained by the physical memory access request (R) as the first read request, Wherein, for a subsequent physical memory access request as a second read request, the selector unit is configured to: using the address and size of the second read request to check whether the requested data exists in the prefetch buffer, and, If the requested data exists in the prefetch buffer: then retrieving the requested data from the pre-fetch buffer and returning the retrieved requested data to the source of the second read request, or, If the requested data is not present in the prefetch buffer: The requested data is then retrieved and returned for the second read request.
5. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 4, wherein: The pre-fetch buffer is configured to buffer a portion of the decompressed sector data that has not yet been returned to a source of the first read request.
6. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 1, in, A compressed storage page in the compressed computer memory includes a plurality of sectors, each sector containing the fixed number of compressed storage blocks, Wherein, for each compressed storage page, the sector-based conversion metadata includes: sector metadata, the sector metadata comprising pointers to sectors of the compressed storage page, and ● storage block metadata, including the size of the storage block of each sector; and The device is configured to selectively convert a physical memory access request (R) into any one of the following: a sector-based request for at least one sector in said compressed computer memory, or - Block-based requests for a memory block or a plurality of contiguous memory blocks in the compressed computer memory.
7. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 6, wherein: The selector unit includes a decision function configured to make a decision to cause the compressed address calculator unit and the sector request unit to selectively make a sector-based read request, a sub-sector-based read request, or a block-based read request to the compressed computer memory, the decision function operatively making the decision based on any one of: the monitored compressibility of the compressor, Monitored memory access patterns, ● Utilization of the prefetch buffer, • An estimate of the compression ratio of the requested sectors relative to their uncompressed physical size, and • An estimate of the compression ratio of the requested sectors relative to their uncompressed physical size and average metadata for each request.
8. The apparatus for accessing a compressed computer memory residing in a physical computer memory according to claim 6 or 7, wherein: The sector merging unit is configured to selectively convert the physical memory access request (R) into a sector-based write request, a sub-sector-based write request or a block-based write request to the compressed computer memory according to the size of the physical memory access request (R).
9. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 1, in, A compressed storage page in the compressed computer memory includes a plurality of sectors, each sector containing the fixed number of compressed storage blocks; wherein each sector comprises compressed block metadata indicating a respective size of the compressed storage blocks of the sector; wherein the selector unit is configured to: obtain the read request response data from the compressed sector data retrieved from the compressed computer memory by using the compressed block metadata in the compressed sector data to extract one or more compressed storage blocks, and provide the extracted one or more compressed storage blocks to the decompressor; and The decompressor is configured to: decompress the extracted one or more compressed storage blocks, and return the decompressed one or more storage blocks to the source of the physical memory access request (R) in response to the read request.
10. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 9, in, The selector unit is further configured to: provide the compressed sector data retrieved from the compressed computer memory to the decompressor; as well as Wherein, the decompressor is configured to: decompress the compressed sector data provided by the selector unit, and provide the decompressed sector data to the sector merging unit; The sector merging unit is configured to: obtain data from the decompressed sector data using the address and size of the physical memory access request (R), merge the obtained data with the data in the physical memory access request (R) into new uncompressed sector data, and provide the new uncompressed sector data to the compressor; and The compressor is configured to compress the new uncompressed sector data in response to the write request, and store the compressed new uncompressed sector data as the compressed sector data in the compressed computer memory.
11. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 9, wherein: The compressor and the sector merging unit are configured as follows: compressing the data in the physical memory access request (R) into compressed block data; receiving said compressed sector data retrieved from said compressed computer memory; using the address and size of the physical memory access request (R) and the compressed block metadata in the compressed sector data to merge the compressed block data with the compressed sector data; as well as The merged compressed sector data is stored in the compressed computer memory in response to the write request.
12. A method for accessing compressed computer memory residing in physical computer memory, wherein: The compressed storage blocks in the compressed computer memory are represented as sectors, and wherein all sectors contain a fixed number of compressed storage blocks, all sectors have a fixed logical size in the form of the fixed number of compressed storage blocks, and all sectors have a varying physical size in the form of the total size of data stored in the compressed storage blocks, the method comprising: Convert a physical memory access request (R) into a sector-based compressed memory request (R'), where: automatically extracting a sector id using the address of the physical memory access request (R), the sector id being used to determine the location of the sector in the compressed computer memory from sector-based translation metadata, Calculate the compressed address and size of the identified sector, and ● Based on the compressed address and size, making a sector-based compressed memory request (R') to the compressed computer memory; Where the physical memory access request (R) is a read request, operating on compressed sector data retrieved from the compressed computer memory in response to the sector-based compressed memory request (R') to: - obtaining read request response data from the compressed sector data using the address and size of the physical memory access request (R), and · returning the obtained read request response data in a decompressed form to the source of the physical memory access request (R) as a read request; and In the case where the physical memory access request (R) is a write request, merging data of the compressed sector data retrieved from the compressed computer memory in response to the sector-based compressed memory request (R') with the data in the physical memory access request (R), thereby: · using the address and size of the physical memory access request (R) as a write request to obtain sector-based write request data, and · Storing the obtained sector-based write request data as compressed sector data in the compressed computer memory.
13. The method for accessing compressed computer memory residing in physical computer memory according to claim 12, wherein: The compressed storage block is a cache line.
14. The method for accessing compressed computer memory residing in physical computer memory according to claim 12 or 13, further comprising: decompressing compressed sector data retrieved from said compressed computer memory in response to said sector-based compressed memory request (R'); providing the decompressed sector data to a selector unit and a sector merging unit; The read request is processed in the following manner: · using the address and size of the physical memory access request (R), obtaining data from the decompressed sector data, and · returning the obtained data to the source of the physical memory access request (R); and The write request is processed in the following manner: using the address and size of the physical memory access request (R), obtaining data from the decompressed sector data, · combining the obtained data with the data in the physical memory access request (R) into new uncompressed sector data, compressing the new uncompressed sector data, and Storing the compressed new uncompressed sector data as the compressed sector data in the compressed computer memory.
15. The method for accessing compressed computer memory residing in physical computer memory according to claim 14, further comprising: buffering in a pre-fetch buffer all or part of the decompressed sector data resulting from the physical memory access request (R) as a first read request; as well as For a subsequent physical memory access request which is a second read request: using the address and size of the second read request to check whether the requested data is present in the pre-fetch buffer, and, If the requested data exists in the pre-fetch buffer: retrieving the requested data from the pre-fetch buffer and returning the retrieved requested data to the source of the second read request, or, If the requested data is not present in the pre-fetch buffer: retrieve and return the requested data for the second read request.
16. The method for accessing compressed computer memory residing in physical computer memory according to claim 15, wherein: A portion of the decompressed sector data that has not yet been returned to the source of the first read request is buffered in the prefetch buffer.
17. The method for accessing compressed computer memory residing in physical computer memory according to claim 12, in, A compressed storage page in the compressed computer memory includes a plurality of sectors, each sector containing the fixed number of compressed storage blocks, Wherein, for each compressed storage page, the sector-based conversion metadata includes: sector metadata, the sector metadata comprising pointers to sectors of the compressed storage page, and Storage block metadata, including the size of the storage block for each sector; and The method comprises selectively converting a physical memory access request (R) into any one of the following: a sector-based request for at least one sector in said compressed computer memory, or - Block-based requests for a memory block or a plurality of contiguous memory blocks in the compressed computer memory.
18. The method for accessing compressed computer memory residing in physical computer memory of claim 17, further comprising making a determination to selectively make a sector-based read request or a block-based read request to the compressed computer memory, the determination being made based on any of: Monitored compressibility, Monitored memory access patterns, Utilization of the prefetch buffer, · An estimate of the compression ratio of the requested sectors relative to their uncompressed physical size, and · An estimate of the compression ratio of the requested sectors relative to their uncompressed physical size and average metadata for each request.
19. The method for accessing compressed computer memory residing in physical computer memory according to claim 17 or 18, further comprising: The physical memory access request (R) is selectively converted into a sector-based write request or a block-based write request to the compressed computer memory according to the size of the physical memory access request (R).
20. The method for accessing compressed computer memory residing in physical computer memory according to claim 12, in, A compressed storage page in the compressed computer memory includes a plurality of sectors, each sector containing the fixed number of compressed storage blocks; wherein each sector comprises compressed block metadata indicating a respective size of the compressed storage blocks of the sector; The method further comprises: obtaining the read request response data from the compressed sector data retrieved from the compressed computer memory by using the compressed block metadata in the compressed sector data to extract one or more compressed storage blocks; decompressing the extracted one or more compressed storage blocks; and The decompressed one or more memory blocks are returned to the source of the physical memory access request (R) in response to the read request.
21. The method for accessing compressed computer memory residing in physical computer memory according to claim 20, further comprising: decompressing the compressed sector data retrieved from the compressed computer memory; obtaining data from the decompressed sector data using the address and size of the physical memory access request (R); Combining the obtained data with the data in the physical memory access request (R) into new uncompressed sector data; compressing the new uncompressed sector data; as well as The compressed new sector data is stored as the compressed sector data in a compressed computer memory.
22. The method for accessing compressed computer memory residing in physical computer memory according to claim 20, further comprising: compressing the data in the physical memory access request (R) into compressed block data; receiving said compressed sector data retrieved from said compressed computer memory; using the address and size of the physical memory access request (R) and the compressed block metadata in the compressed sector data to merge the compressed block data with the compressed sector data; as well as The merged compressed sector data is stored in the compressed computer memory in response to the write request.
23. A method for accessing compressed computer memory residing in physical computer memory, the method comprising: representing compressed memory blocks as sectors, wherein all sectors contain a fixed number of compressed memory blocks, all sectors have a fixed logical size in the form of the fixed number of compressed memory blocks, and all sectors have a varying physical size in the form of a total size of data stored in each compressed memory block; Providing sector-based translation metadata to track sectors within compressed storage pages; receiving a physical memory access request including an address in a physical computer memory; Using the address in the physical memory access request to derive a memory block index; Using the storage block index and the fixed logical size of the sector to determine a sector id; using the sector-based translation metadata to locate a sector having the sector id in the compressed storage page; and The address of the physical memory access request is used to locate the requested data within the sector.
24. The method for accessing compressed computer memory residing in physical computer memory according to claim 23, wherein: The compressed storage block is a cache line.
25. An apparatus for accessing compressed computer memory residing in physical computer memory, the apparatus comprising: means for representing the compressed memory blocks as sectors, wherein all sectors contain a fixed number of compressed memory blocks, all sectors have a fixed logical size in the form of the fixed number of compressed memory blocks, and all sectors have a varying physical size in the form of a total size of data stored in each compressed memory block; means for providing sector-based translation metadata to track sectors within a compressed storage page; means for receiving a physical memory access request including an address in a physical computer memory; means for using the address in the physical memory access request to derive a memory block index; means for determining a sector id using the memory block index and the fixed logical size of the sector; means for using the sector-based translation metadata to locate a sector having the sector id in the compressed storage page; and Means for using the address of the physical memory access request to locate requested data within the sector.
26. The apparatus for accessing compressed computer memory residing in physical computer memory according to claim 25, wherein: The compressed storage block is a cache line.
27. A sector-based memory compression system (4300), comprising: Compressed Memory (4360); An apparatus for accessing compressed computer memory as claimed in any one of claims 1 to 11; and Free memory management device (4330).
28. The sector-based memory compression system (4300) of claim 27, wherein: The free memory management device (4330) includes a compressed memory management arrangement (405) for use with one or more processors (P1-P N ), a compressible main memory (414), a secondary memory and an operating system (420), wherein the compressible main memory (414) has a compressed storage space, the compressed storage space includes a processor that can directly access the one or more processors (P1-P N ) and cannot directly access the one or more processors (P1-P N ), the compressed storage space being in the form of memory released by memory compression, the compressed memory management settings (405) comprising: an auxiliary memory (440) for maintaining a layout of the compressed storage space of the compressible main memory (414), the layout including the size and location of each storage page and free storage areas in the compressed storage space; and a selector function (430) that enables the operating system (420), the secondary storage, and the auxiliary storage (440) to interact; Wherein, the memory management setting (405) is configured as: triggering compression of a memory page in the compressible main memory (414); intercepting a page-in request from the operating system (420) to the secondary storage, using a layout of the compressed storage space maintained by the secondary storage (440) to locate in the secondary storage (440) a page requested by the page-in request when available, and making the located requested page available in the active portion of the compressed storage space; and Intercepting a page call-out request from the operating system (420) to the secondary memory, using the layout of the compressed storage space maintained by the auxiliary memory (440) to obtain a free area for the page requested by the page call-out request, and accommodating the requested page in the obtained free area of the auxiliary memory (440).
29. The sector-based memory compression system (4300) of claim 27, further comprising a sector overflow device (4320; 4200), wherein: The sector overflow device (4320; 4200) comprises: Overflow Check Unit (4210); Fragment utilization unit (4220); Interval utilization unit (4230); and Re-compacting unit (4240), Wherein, the overflow checking unit (4210) is configured to: checking whether the size of the new version of the compressed sector is greater than the size of the old version and allowing the overwriting of the old version of the sector with the new version if the size of the new version of the sector is not greater than the size of the old version; Wherein, the fragment utilization unit (4220) is configured as follows: If the overflow check unit (4210) finds that the size of the new version of the sector is larger than the size of the old version, searching the list of free memory fragments for a memory fragment of appropriate size to accommodate the new version of the sector, and If such a storage fragment is successfully found, the new version of the sector is inserted into the found storage fragment, and the old version of the sector is invalidated by inserting the area where the old version resides into the list of free storage fragments; Wherein, the interval utilization unit (4230) is configured as follows: Accommodating a new version of the sector in the interval data (4365; Range) by updating the amount of free data in the interval data (4365; Range) accordingly, and if so, invalidating the old version of the sector by inserting the area where the old version resides into the free storage fragment list; and Wherein, the re-compacting unit (4240) is configured as follows: The sector data is reset so that different storage fragments are moved together to form a continuous free storage fragment space.
30. The sector-based memory compression system (4300) of claim 29, wherein: The overflow checking unit (4210) further comprises a sector underflow processing unit, wherein the sector underflow processing unit is configured to: checking whether the size of the new version of the compressed sector is smaller than the size of the old version, and if the size of the new version is not smaller than the size of the old version, allowing the old version to be overwritten by the new version of the sector, and If the size of the new version is smaller than the size of the old version, a new storage fragment is inserted into the free storage fragment list, the size of the new storage fragment is equal to the difference between the old version and the new version of the sector, and the new version is used to cover part of the old version of the sector accordingly.
31. The sector-based memory compression system (4300) of claim 29, wherein: The interval data (4365; Range) used by the interval utilizing unit (4230) is a storage space continuous with the sector.
32. The sector-based memory compression system (4300) of claim 29, wherein: The interval data (4365; Range) used by the interval utilizing unit (4230) is a storage space that is not continuous with the sector.
33. The sector-based memory compression system (4300) of claim 29, wherein: The range data (4365; Range) used by the range using unit (4230) is a non-storage space.
34. The sector-based memory compression system (4300) of claim 27, further comprising a device for deriving compression metadata of a specific size that maximizes a target effect for compressing a block of data, wherein The specific size is given or is part of the target effect, so as to minimize the metadata overhead and maximize the compression ratio at the same time, the device for deriving compressed metadata includes: means for analyzing the size of the compressed block; means for deriving a frequency and size distribution of said compressed chunks; means for identifying one or more candidate compressed block sizes to which the compressed block is to be rounded; means for evaluating whether the identified size maximizes the target effect when represented by metadata of the specific size; and Means for generating a compressed metadata format that is subject to successful evaluation by means for evaluating.
35. The sector-based memory compression system (4300) of claim 34, wherein: The block of data is any of the following: a storage block, a network block, a cache line, a storage page, or a sector.
Citation Information
Patent Citations
Memory compression policies
US20120036325A1
Providing memory bandwidth compression using multiple last-level cache (LLC) lines in a central processing unit (CPU)-based system
US20170286308A1
