Methods for data compression and data reconstruction, computing apparatuses, and related products

By compressing RAM pages into multiple output blocks and managing them in different memory spaces, the method addresses inefficiencies in swapping large pages, improving memory management efficiency and reducing latency.

WO2026245838A1PCT designated stage Publication Date: 2026-11-26HUAWEI TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/RU2025/000151
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-05-19
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Existing operating systems inefficiently manage memory by swapping large RAM pages between RAM and disk, leading to increased I/O overhead and latency, as ZRAM only compresses pages of minimal size (4KB) and fails to handle larger-sized pages effectively.

Method used

Compress RAM pages into multiple output blocks of varying sizes, storing them in different memory spaces based on size, allowing efficient allocation and deallocation, and reconstructing pages as needed to reduce I/O overhead and latency.

Benefits of technology

Enhances memory management efficiency by minimizing I/O operations and reducing latency for large pages, optimizing resource utilization and system performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure RU2025000151_26112026_PF_FP_ABST
    Figure RU2025000151_26112026_PF_FP_ABST
Patent Text Reader

Abstract

The present disclosure provides methods for data compression and data reconstruction, computing apparatus, and related products. The method includes: compressing the content of the RAM page, as an input page, into the one or more output blocks, where a size of the input page is equal to power of 2 in a range from a minimum RAM page size to a maximum RAM page size, a size of each of the one or more output blocks is less than or equal to the minimum RAM page size, and a sum size of the one or more output blocks is less than the size of the input page; storing one or more output blocks having a size equal to the minimum RAM page size into a first volatile memory space; and storing an output block having a size less than the minimum RAM page size into a second volatile memory space.
Need to check novelty before this filing date? Find Prior Art

Description

METHODS FOR DATA COMPRESSION AND DATA RECONSTRUCTION, COMPUTING APPARATUSES, AND RELATED PRODUCTSTECHNICAL FIELD

[0001] The present disclosure relates generally to the field of computing technologies, and more particularly to methods for data compression, methods for data reconstruction, computing apparatuses, and related products.BACKGROUND

[0002] A computing device uses an operating system (OS) to manage computer memory within the device. The computer memory may include both volatile memory and non-volatile memory. The volatile memory, such as random access memory (RAM), provides fast access to data but has limited capacity. The non-volatile memory, such as hard disk drives (HDD), offers slower access speeds compared to the volatile memory but are suitable for storing large amounts of data.

[0003] The OS uses memory management (MM) to optimize the use of RAM. The MM uses a concept of pages which are fixed-length contiguous blocks of RAM to manage RAM. The OS supports multiple page sizes, such as 4KB, 16KB, 64KB, 2MB, etc. To handle situations where RAM is insufficient to accommodate all pages, the OS MM implements a mechanism, where pages are swapped between RAM and disk. When the OS runs out of available RAM, less frequently used pages are swapped out to disk, freeing up space in RAM. When these pages are needed again, they are swapped back into RAM from disk. This mechanism helps alleviate memory pressure, but efficiency is low.

[0004] To improve this efficiency, a zipped RAM (ZRAM) function is proposed. ZRAM compresses pages and stores them in RAM to avoid swapping out, effectively decreasing writing operations to disk and reducing latency. However, ZRAM is implemented only for a page with a minimal OS kernel size, that is, 4KB, but may not avoid swapping for larger-sized pages.SUMMARY

[0005] The present disclosure provides methods and apparatuses for data compression and data reconstruction, and related products, to compress and store pages of multiple sizes in RAM, where the multiple sizes are larger than or equal to the minimum RAM page size.

[0006] According to a first aspect, a method for data compression is provided. The method may be performed by a computing device or a module (such as a processor, a chip, or a circuit) in the computing device. The method may include: compressing the content of the RAM page, as an input page, into the one or more output blocks, where a size of the input page is equal to power of 2 in a range from a minimum RAM page size to a maximum RAM page size, a size of each of the one or more output blocks is less than or equal to the minimum RAM page size, and a sum size of the one or more output blocks is less than the size of the input page; storing one or more output blocks having asize equal to the minimum RAM page size into a first volatile memory space; and storing an output block having a size less than the minimum RAM page size into a second volatile memory space.

[0007] In the operation system of the computing device, pages of minimum RAM page size may be compressed, but huge pages may only be swapped between the RAM and the disk. When swapped out to the disk, the huge pages are either split to pages of minimum RAM page size or written as a whole page to the disk, which may reduce the efficiency and increase the latency. Furthermore, swapping between the RAM and the disk for the huge pages may increase the input / output (I / O) overhead between the RAM and the disk.

[0008] In the method according to the present disclosure, the content of the RAM page, as the input page, is compressed into the one or more output blocks, one or more output blocks having the size equal to the minimum RAM page size is stored into the first volatile memory space, and an output block having the size less than the minimum RAM page size is stored into the second volatile memory space. Since the two types of the output blocks have different sizes, the output blocks may be stored into the different spaces according to the sizes of the output blocks for efficient memory management. Storing the one or more output blocks having the size equal to the minimum RAM page size into the first volatile memory space may be more conducive for adding, retrieving, discarding and other operations on this type of output blocks. Storing the output block having the size less than the minimum RAM page size into the second volatile memory space may be more conducive for memory compaction, retrieving and other operations on this type of output blocks. Furthermore, the compression of the RAM page of multiple sizes may lead to less I / O overhead and less latency for huge pages and increase the efficiency for memory management.

[0009] In a possible implementation according to the first aspect, the method further includes modifying an address of the input page in a page table to an address of the output block having the size less than the minimum RAM page size.

[0010] In the method according to the present disclosure, the input page may be discarded after compression and the address of the input page may be modified to the address of the output block having the size less than the minimum RAM page size. Storing the address of the output block having the size less than the minimum RAM page size in the page table may help retrieve the output blocks generated by the compression during decompressing, retrieving, and discarding operations.

[0011] In a possible implementation according to the first aspect, the output block having the size less than the minimum RAM page size includes a metadata, where the metadata stores one or more addresses of the one or more output blocks having the size equal to the minimum RAM page size; and one of: compressed data of the input page, uncompressed data of the input page, and no data of the input page.

[0012] In the method according to the present disclosure, the metadata may help retrieve the one or more output blocks having the size equal to the minimum RAM page size during decompressing,retrieving, and discarding operations. The content in the output block having the size less than the minimum RAM page size may include various situations of the compression results.

[0013] In a possible implementation according to the first aspect, the first volatile memory space is divided into block slots, a size of each of the block slots is equal to the minimum RAM page size, and the storing one or more output blocks having the size equal to the minimum RAM page size into the first volatile memory space includes: obtaining one or more empty block slots in the first volatile memory space based on a first linked data structure, where a plurality of empty block slots are kept in the first linked data structure in the first volatile memory space; and storing the one or more output blocks having the size equal to the minimum RAM page size into the one or more empty block slots.

[0014] In the method according to the present disclosure, keeping empty block slots in the first volatile memory space may help for fast allocation to store the one or more output blocks having the size equal to the minimum RAM page size into the first volatile memory space, or for fast deallocation to delete the one or more output blocks having the size equal to the minimum RAM page size.

[0015] In a possible implementation according to the first aspect, the second volatile memory space includes memory fragments, a size of each of the memory fragments is variable, and the storing an output block having the size less than the minimum RAM page size into the second volatile memory space includes: obtaining an unoccupied memory fragment in the second volatile memory space based on a second linked data structure, where a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space, a size of the obtained unoccupied memory fragment is greater than or equal to a size of the output block having the size less than the minimum RAM page size; and storing the output block having the size less than the minimum RAM page size into the obtained unoccupied memory fragment.

[0016] In the method according to the present disclosure, keeping unoccupied memory fragments in the second volatile memory space help for fast allocation to store the output block having the size less than the minimum RAM page size into the second volatile memory space, or for fast deallocation to delete the output block having the size less than the minimum RAM page size.

[0017] In a possible implementation according to the first aspect, the method further includes when the size of the obtained unoccupied memory fragment is greater than the size of the output block having the size less than the minimum RAM page size, obtaining a new unoccupied memory fragment, where the new unoccupied memory fragment is an unoccupied part of the obtained unoccupied memory fragment after storing the output block having the size less than the minimum RAM page size therein; and adding the new unoccupied memory fragment to the second linked data structure.

[0018] In the method according to the present disclosure, adding the new unoccupied memory fragment to the second linked data structure may collect the unoccupied memory fragments together and compact the small unoccupied memory fragments into a larger unoccupied memory fragment for future use.

[0019] In a possible implementation according to the first aspect, the minimum RAM page size is predetermined by an operating system, and the minimum RAM page size is 4KB .

[0020] In the method according to the present disclosure, predefining the minimum RAM page size as 4KB may be conducive to the efficiency and resource management of the operating system.

[0021] In a possible implementation according to the first aspect, the maximum RAM page size is predetermined by an operating system, and the maximum RAM page size is 2MB.

[0022] In the method according to the present disclosure, predefining the maximum RAM page size as 2MB may enhance the performance of the operating system and improve the efficiency of memory management.

[0023] According to a second aspect, a method for data reconstruction is provided. The method may be performed by a computing device or a module (such as a processor, a chip, or a circuit) in the computing device. The method may include: reconstructing the RAM page by redirecting to a stored block having a size less than a minimum RAM page size and by redirecting to, based on one or more addresses stored in the stored block having the size less than the minimum RAM page size, one or more stored blocks having a size equal to the minimum RAM page size; and replacing an address of the stored block having the size less than the minimum RAM page size in a page table with an address of the reconstructed RAM page.

[0024] In the method according to the present disclosure, the RAM page may be reconstructed by redirecting the stored blocks generated by the compression when the content of the RAM page is used again by the processor. After reconstruction, the address of the stored block having the size less than the minimum RAM page size in a page table may be replaced with the address of the reconstructed RAM page to retrieve the reconstructed RAM page.

[0025] In a possible implementation according to the second aspect, the stored block having the size less than the minimum RAM page size includes: a metadata, where the metadata stores the one or more addresses; and one of: compressed data of the RAM page, uncompressed data of the RAM page, and no data of the RAM page.

[0026] In a possible implementation according to the second aspect, the one or more stored blocks having the size equal to the minimum RAM page size are stored in one or more block slots in a first volatile memory space, the first volatile memory space is divided into block slots, and a size of each of the block slots is equal to the minimum RAM page size; and the stored block having the size less than the minimum RAM page size is stored in a memory fragment in a second volatile memory space, the second volatile memory space includes memory fragments, and a size of each of the memory fragments is variable.

[0027] In the method according to the present disclosure, the stored blocks may be stored into two types of volatile memory space for fast allocation and deallocation.

[0028] In a possible implementation according to the second aspect, the method further includes: deleting the stored block having the size less than the minimum RAM page size and the one or morestored blocks having the size equal to the minimum RAM page size; returning the one or more block slots occupied by the one or more stored blocks having the size equal to the minimum RAM page size to a first linked data structure, where a plurality of empty block slots are kept in the first linked data structure in the first volatile memory space; returning the memory fragment occupied by the stored block having the size less than the minimum RAM page size to a second linked data structure, where a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space; and erasing an address of the stored block having the size less than the minimum RAM page size in a page table.

[0029] In the method according to the present disclosure, when the stored blocks are deleted, the empty block slots occupied by the one or more stored blocks having the size equal to the minimum RAM page size may be returned to the first linked data structure for future use and the memory fragment occupied by the stored block having the size less than the minimum RAM page size may be returned to the second linked data structure for future use. The address of the stored block having the size less than the minimum RAM page size in the page table may be deleted to avoid dirty data.

[0030] In a possible implementation according to the second aspect, the method further includes: determining empty memory fragments; and compacting the empty memory fragments.

[0031] In the method according to the present disclosure, the empty memory fragments may be compacted into a larger memory fragments for future use.

[0032] In a possible implementation according to the second aspect, the compacting the empty memory fragments includes: when there are two or more empty memory fragments that are adjacent, coalescing the two or more empty memory fragments into a new empty memory fragment, and adding the new empty memory fragment to the second linked data structure; or when there are no two or more empty memory fragments that are adjacent, detecting a live stored block that is adjacent to two empty memory fragments on both sides of the live stored block, moving the detected live stored block to one of the two empty memory fragments, coalescing a memory fragment previously occupied by the detected live stored block and another one of the two empty memory fragments into another new empty memory fragment, and adding the another new empty memory fragment to the second linked data structure.

[0033] In the method according to the present disclosure, the empty memory fragments may be compacted into a larger memory fragments for future use to improve memory utilization.

[0034] In a possible implementation according to the second aspect, the method further includes: modifying an address of the live stored block.

[0035] In the method according to the present disclosure, modifying the address of the live stored block may help the operating system locate the live stored block.

[0036] According to a third aspect, a computing apparatus is described. The computing apparatus includes units for performing the method according to the first aspect or any possible implementationin the first aspect, or the method according to the second aspect or any possible implementation in the second aspect.

[0037] According to a fourth aspect, a chip is described. The chip includes an I / O interface and a processor, where the processor is configured to call and run a computer program stored in a memory, to enable a device installing with the chip to perform the method according to the first aspect or any possible implementation in the first aspect, or the method according to the second aspect or any possible implementation in the second aspect.

[0038] According to a fifth aspect, a computing apparatus is described. The computing apparatus includes a processor; and a computer-readable storage medium coupled to the processor and storing instructions for execution by the processor, where the instructions, when executed by the processor, configure the computing apparatus to perform the method according to the first aspect or any possible implementation in the first aspect, or the method according to the second aspect or any possible implementation in the second aspect.

[0039] According to a sixth aspect, a computer-readable medium is described. The computer -readable medium may carry a program code which, when executed by a computer device, causes the computer device to perform the method according to the first aspect or any possible implementation in the first aspect, or the method according to the second aspect or any possible implementation in the second aspect.

[0040] According to a seventh aspect, a computer program product is described. The computer program product includes program code for performing the method according to the first aspect or any possible implementation in the first aspect, or the method according to the second aspect or any possible implementation in the second aspect.BRIEF DESCRIPTION OF THE DRAWINGS

[0041] For a better understanding of the present disclosure, as well as other aspects and further features thereof, reference is made to the following description which is to be used in conjunction with the accompanying drawings, where:

[0042] FIG. 1 illustrates a schematic diagram of an example computing device according to one or more implementations of the present disclosure;

[0043] FIG. 2 illustrates a schematic diagram of an example internal fragmentation according to one or more implementations of the present disclosure;

[0044] FIG. 3 illustrates a schematic diagram of an example external fragmentation according to one or more implementations of the present disclosure;

[0045] FIG. 4 illustrates a schematic diagram of an example mapping between virtual addresses and physical addresses according to one or more implementations of the present disclosure;

[0046] FIG. 5 illustrates a schematic flow chart of an example data compression method according to one or more implementations of the present disclosure;

[0047] FIG. 6 illustrates a schematic diagram of an example compression process according to one or more implementations of the present disclosure;

[0048] FIG. 7 illustrates a schematic diagram of an example implementation to trace the one or more output blocks of the sizes equal to and less than 4KB according to one or more implementations of the present disclosure;

[0049] FIG. 8 illustrates a schematic diagram of an example implementation to trace the output block of the size less than 4KB according to one or more implementations of the present disclosure;

[0050] FIG. 9 illustrates a schematic diagram of an example implementation of the output block of the size less than 4KB according to one or more implementations of the present disclosure;

[0051] FIG. 10 illustrate a schematic diagram of an example implementation of the second volatile memory space according to one or more implementations of the present disclosure;

[0052] FIG. 11 illustrates a schematic diagram of an example relationship between the page table and the third data structure according to one or more implementations of the present disclosure;

[0053] FIG. 12 illustrates a schematic diagram of an example implementation of the third data structure according to one or more implementations of the present disclosure;

[0054] FIG. 13 illustrates a flow chart of an example data reconstruction method according to one or more implementations of the present disclosure;

[0055] FIG. 14 illustrates a schematic diagram of an example implementation of compacting empty memory fragments when there are no two or more empty memory fragments that are adjacent according to one or more implementations of the present disclosure;

[0056] FIG. 15 illustrates a block diagram of a computing apparatus for data compression and data reconstruction according to one or more implementations of the present disclosure.DETAILED DESCRIPTION

[0057] The following describes implementations of the present disclosure with reference to accompanying drawings in implementations of the present disclosure. In the following description, specific aspects of implementations of the present disclosure or specific aspects in which implementations of the present disclosure may be used are shown by the accompanying drawings.

[0058] The examples and conditional language recited herein are intended to aid the reader in understanding the principles of the present disclosure and not to limit its scope to such specifically recited examples and conditions. It will be appreciated that a person skilled in the art may devise various arrangements which, although not explicitly described or shown herein, nonetheless embody the principles of the present disclosure and are included within its scope.

[0059] Furthermore, as an aid to understanding, the following description may describe relatively simplified implementations of the present disclosure. As a person skilled in the art may understand, various implementations of the present disclosure may be of a greater complexity.

[0060] In some cases, what are believed to be helpful examples of modifications to the present disclosure may also be set forth. This is done merely as an aid to understanding, and, again, not to define the scope or set forth the bounds of the present disclosure. These modifications are not an exhaustive list, and a person skilled in the art may make other modifications while nonetheless remaining within the scope of the present disclosure. Further, where no examples of modifications have been set forth, it may not be interpreted that no modifications are possible and / or that what is described is the sole manner of implementing that element of the present disclosure.

[0061] Moreover, all statements herein reciting principles, aspects, and implementations of the present disclosure, as well as specific examples thereof, are intended to encompass both structural and functional equivalents thereof, whether they are currently known or developed in the future. Thus, for example, it will be appreciated by a person skilled in the art that any block diagrams herein represent conceptual views of illustrative circuitry embodying the principles of the present disclosure. Similarly, it will be appreciated that any flowcharts, flow diagrams, state transition diagrams, pseudo-code, and the like represent various processes which may be substantially represented in computer -readable media and so executed by a computer or processor, whether or not such computer or processor is explicitly shown.

[0062] The functions of the various elements shown in the figures, including any functional block labeled as a “processor”, may be provided through the use of dedicated hardware as well as hardware capable of executing software in association with appropriate software. When provided by a processor, the functions may be provided by a single dedicated processor, by a single shared processor, or by a plurality of individual processors, some of which may be shared. In some implementations of the present disclosure, the processor may be a general-purpose processor, such as a central processing unit (CPU) or a processor dedicated to a specific purpose, such as a digital signal processor (DSP). Moreover, explicit use of the term a “processor” may not be construed to refer exclusively to hardware capable of executing software, and may implicitly include, without limitation, application specific integrated circuit (ASIC), field programmable gate array (FPGA), read-only memory (ROM) for storing software, random access memory (RAM), and non-volatile storage. Other hardware, conventional and / or custom, may also be included.

[0063] Software modules, or simply modules which are implied to be software, may be represented herein as any combination of flowchart elements or other elements indicating performance of process steps and / or textual description. Such modules may be executed by hardware that is expressly or implicitly shown. Moreover, it may be understood that module may include for example, but without being limitative, computer program logic, computer program instructions, software, stack, firmware, hardware circuitry, or a combination thereof which provides the required capabilities.

[0064] With these fundamentals in place, we will now consider some non-limiting examples to illustrate various implementations of aspects of the present disclosure. First, a computing device where implementations of the present disclosure are applicable is described below.

[0065] FIG. 1 illustrates a diagram of an example computing device 100 in accordance with implementations of the present disclosure. In some implementations, the computing device 100 may be implemented by any of a conventional personal computer, a computer dedicated to operating and / or monitoring systems relating to a data center, a controller and / or an electronic device (such as, but not limited to, a mobile device, a tablet device, a server, a controller unit, a control device, a monitoring device etc.), and / or any combination thereof appropriate to the relevant task at hand.

[0066] In some implementations, the computing device 100 may also be a sub-system of one of the above-listed systems. In some implementations, the computing device 100 may be an “off the shelf’ generic computer system. In some implementations, the computing device 100 may also be distributed amongst multiple systems.

[0067] In some implementations of the present disclosure, the computing device 100 may be implemented as part of a cloud computing device. Broadly, a cloud computing device is a type of computing that relies on a network of remote servers hosted on the Internet, for example, to store, manage, and process data, rather than a local server or personal computer. This type of computing allows users to access data and applications from remote locations, and provides a scalable, flexible, and cost-effective solution for data storage and computing. Cloud computing devices can be divided into three categories: infrastructure as a service (laaS), platform as a service (PaaS), and software as a service (SaaS). In an laaS environment, users can rent virtual servers, storage, and other computing resources from a third-party provider, for example. In a PaaS environment, users have access to a platform for developing, running, and managing applications without having to manage the underlying infrastructure. In a SaaS environment, users can access pre -built software applications that are hosted by a third-party provider, for example. In summary, cloud computing devices offer a range of benefits, including cost savings, scalability, increased agility, and the ability to quickly deploy and manage applications.

[0068] The computing device 100 may also be specifically dedicated to the implementations of the present disclosure. As a person skilled in the art of the present disclosure may appreciate, multiple variations as to how the computing device 100 is implemented may be envisioned without departing from the scope of the present disclosure.

[0069] In some implementations, the computing device 100 includes various hardware components including one or more single or multi-core processors collectively represented by a processor 110, a solid-state drive 120, a random access memory 130, and an input / output (I / O) interface 140. Communication between the various components of the computing device 100 may be enabled by one or more internal and / or external buses 150 (e.g. a peripheral component interconnect (PCI) bus, universal serial bus, IEEE 1394 “Firewire” bus, small computer system interface (SCSI) bus, serial advanced technology attachment (Serial-ATA) bus, aeronautical radio, incorporated (ARINC) bus), to which the various hardware components are electronically coupled.

[0070] The processor 110 be such as a CPU, a microprocessor, a DSP, an ASIC, an FPGA, a dedicated logic circuitry, a dedicated artificial intelligence processor unit, a graphics processing unit (GPU), a tensor processing unit (TPU), a neural processing unit (NPU), a hardware accelerator, or combinations thereof.

[0071] The input / output interface 140 may allow enabling networking capabilities such as wire or wireless access. As an example, the input / output interface 140 may include a networking interface such as, but not limited to, a network port, a network socket, a network interface controller, and the like. Multiple examples of how the networking interface may be implemented will become apparent to a person skilled in the art of the present disclosure. For example, but without being limitative, the networking interface may implement specific physical layer and data link layer standard such as Ethernet, Fibre Channel, Wi-Fi, or Token Ring. The specific physical layer and the data link layer may provide a base for a full network protocol stack, allowing communication among small groups of computers on the same local area network (LAN) and large-scale network communications through routable protocols, such as Internet protocol (IP).

[0072] According to implementations of the present disclosure, the solid-state drive 120 stores program instructions suitable for being loaded into the random access memory 130 and executed by the processor 110 for executing the methods described in the present disclosure. For example, the program instructions may be part of a library or an application.

[0073] There is a specific program, that is, an operating system (OS), in the random access memory 130. The operating system is a system software that manages and handles all the hardware and software resources of the computing device 100, which is an interface between the computing device 100 and users.

[0074] The operating systems may be categorized according to different criteria, such as design objectives, computing modes, supported device types, functional characteristics, or virtualization characteristics. According to design objectives, operating systems may be divided into general-purpose operating system (such as Windows , macOS , or Linux ), real-time operating system (such asembedded operating system (such embedded Linux^^), and special-purpose operating system (such as Nintendo Switch"^ OS). According to computing modes, operating systems may be divided into centralized operating system (such asdistributed operating system (such as, and cluster operating system (such as Linux Cluster, or Windows Server Cluster). According to supported device types, operating systems may be divided into desktop operating system (such as Windows"'"^,macOS , or Linux ), mobile operating system (such as Androidautomotive operating system (such as QNX^ or Linux Automotive), and server operating system (such asUbuntij Server, Red Hat^^ Enterprise Linux, or Windows Server). According to functional characteristics, operating systems may be divided into batch operating system (such as payroll system, or bank statement), multi-programming / multi-tasking / time-sharing operating system (such asWindows , macOS , or Linux ), multi-processmg operating system, and multi-user operating system. According to virtualization characteristics, operating systems may be divided into virtualizedoperating system (such as VMware , Hyper- V , or Xen ), and non-virtuahzed operating system (such as embedded operating system, or real-time operating system).

[0075] In addition, other operations systems such as a secure operating system, internet of things (loT) operating system, watch operating system, wear operating system, iPad operating system, or future operating system may also be applicable to implementations of the present disclosure.

[0076] The following, taking the general-purpose operating system as an example, hereinafter referred to as OS for simplicity, describes an example OS to which implementations of the present disclosure are applicable. The OS may implement memory management function, which manages computer memory and provides mechanisms for optimizing computer memory usage. The computer memory may include primary memory and secondary memory. The primary memory may also be referred to as main memory, internal memory, or volatile memory, such as, but not limited to, random access memory (RAM), read-only memory (ROM), or cache memory. The secondary memory may also be referred to as external memory, non-volatile memory, or storage, such as, but not limited to, hard disk drives (HDD), solid-state drives (SSD), or optical disks. The optical disks may include compact disc read-only memory (CD-ROM), digital video discs or digital versatile discs (DVDs), Blu-ray Disc^ , etc. The random access memory 130 may be the primary memory and the solid-state drive 120 may be the secondary memory.

[0077] The primary memory is a computing device 100’s temporary storage component which is directly accessible by the processor 110. Data, such as instructions or computer programs, are stored in the primary memory for immediate processing on demand. The processor 110 has a high-speed access to the primary memory compared to the secondary memory, which leads to quick data retrieval and storage. However, the primary memory is volatile since the data stored in the primary memory may be lost upon a power loss, and the capacity of the primary memory is limited compared to the secondary memory. Furthermore, the cost of the primary memory is expensive compared to the secondary memory, and thus the capacity of the primary memory may not be extended arbitrarily.

[0078] The secondary memory serves as a long-term storage for data and may not be directly accessible by the processor 110. The secondary memory is non-volatile since the data stored in the secondary memory may persist even when the computing device 100 is powered off. The secondary memory offers a large capacity storage for files, computer programs, and other data. Furthermore, the cost of the secondary memory is cheaper per gigabyte than the primary memory. However, theprocessor 110 has a slow-speed access to the secondary memory compare to the primary memory and may require input or output operations to access to the secondary memory.

[0079] Taking a multi-programming system as an example, the OS may reside in a part of the primary memory, and the rest of the primary memory may be used by multiple processes. The memory management implemented by the OS is a function to manage operations between the primary memory and the secondary memory such as disk, during executions of the multiple processes. The memory management is responsible for the task of subdividing the primary memory among different processes. Therefore, the memory management involves the management and optimization of the primary memory. The primary memory herein and hereafter is referred to as the memory for simplicity. The memory management may include functions such as memory fragmentation management, memory allocation, and virtual memory management.

[0080] Fragmentation is a concept that when the process is loaded into the memory during execution and removed from memory after execution, a small free hole in the memory may be generated. The holes may not be assigned to new processes since the holes may not be combined or may not fulfill memory requirements of the processes, which are called fragments. Fragmentation may reduce system performance and memory utilization. Fragmentation may include internal fragmentation and external fragmentation. Internal fragmentation may occur when a memory block is allocated to a process and the size of the memory block is larger than the requested size of the process. FIG. 2 illustrates a schematic diagram of an example internal fragmentation. As shown in FIG. 2, the memory is divided into several fixed-sized memory blocks with size of 30KB, 50B, 80KB, and 100KB. Each memory block may be occupied by only one process. The memory block of 30KB has been occupied by a process of 20KB, and the block of memory of 10KB is internal fragmentation. External fragmentation may occur when the memory has small blocks of free space scattered throughout it. FIG. 3 illustrates a schematic diagram of an example external fragmentation. As shown in FIG. 3, several processes with size of 30KB, 50KB, 60KB, and 90KB are accommodated in the memory, and two memory blocks with size of 10KB may not accommodate new processes. The two memory blocks are external fragmentation.

[0081] The memory fragmentation management is a function to solve the problem of memory fragments and optimize the efficiency of memory utilization. To manage the memory fragments efficiently, the OS adopts multiple strategies, such as memory compaction. The memory compaction implements the memory fragmentation management by moving allocated memory blocks to merge free memory blocks and create larger contiguous free areas in the memory. The memory compaction may be performed dynamically during the system running, which helps reduce external fragmentation and improve the utilization of the memory, but may increase system overhead.

[0082] The memory allocation is a function to allocate the required memory space for respective processes. The memory allocation may include contiguous memory allocation and non-contiguous memory allocation. The contiguous memory allocation is a memory management manner, where eachprocess is allocated a single, continuous block of the memory. That is, all the data for a process are stored in adjacent memory locations. The contiguous memory allocation may include fixed (or static) partition allocation and variable (or dynamic) partition allocation. In the fixed partition allocation, the memory is divided into fixed number of partitions. Every partition may accommodate only one process, and is associated with limit registers. However, internal fragmentation may be found in the fixed partition allocation. In the variable partition allocation, initial memory may be single continuous block. Whenever the request by the process arrives, partitions of appropriate size will be made in the memory. However, external fragmentation may be found in the variable partition allocation.

[0083] The non-contiguous memory allocation is another memory management manner, where a process is divided into smaller parts, and the small parts are stored in different, non-adjacent memory blocks. That is, the entire process may not be stored in a continuous block of the memory. The noncontiguous memory allocation uses pointers to link the memory blocks allocated to the process and the pointers are used to keep track of the memory blocks and locate the memory blocks during the execution of the process. The non-contiguous memory allocation may include paging and segmentation.

[0084] In paging, each process includes fixed-size components called pages. The size of the page may be defined by the hardware of the computer. The memory may be partitioned into memory blocks that have the same size as the page, and each of these memory blocks may be considered separately for allocation to the page. In paging, external fragmentation may not arise in the OS since the memory block is exactly the same size as the page. However, internal fragmentation may arise in paging, since the last page of the process is allocated a page-size memory block even if the size of the last page may be less than the page in size.

[0085] In segmentation, a program may be divided into segments in a process according to the logic of the program. A segment is a logical entity in the program, such as a set of functions, or data structures. Each segment occupies contiguous memory space and segments may be non-contiguous with different sizes, thus external fragmentation may arise in segmentation.

[0086] In paging and segmentation, the virtual memory management is implemented to increase the utilization of the memory and provide flexibility for application programs. The virtual memory, also known as the logical memory, refers to an abstract memory address space provided by the OS to the application programs, which does not directly correspond to physical memory and may be mapped to the physical memory or disk space through an address translation mechanism. The abstract memory address space may be referred to as virtual address space, including multiple virtual addresses. The virtual address, also known as the logical address, is the address generated by the processor 110 in the virtual memory. The physical memory is the primary memory in the computing device 100, such as RAM. The location of the memory block in the physical memory is referred to as the physical address and may be accessed directly by the processor 110. The address translation is a mechanism to translate the virtual addresses into the physical addresses, and is implemented by the memorymanagement unit (MMU) which is a hardware module of the CPU. Paging and segmentation are techniques to implement the virtual memory management.

[0087] The following, using paging as an example, describes an example technique to implement the virtual memory management to which implementations of the present disclosure are applicable. In paging, the physical memory is divided into fixed-size blocks called page frames, which are the same size as the pages used by the process. The process’s logical memory is also divided into fixed-size blocks called pages, which are the same size as the page frames. It is noted that the pages are logical contents of the process, which refers to the data that the process requires during running. The pages may be stored in the page frames or the disk space. The size of the pages is power of 2 and may be defined by the hardware and the OS, including 4KB, 8KB, 16KB, 64KB 2MB, or 4MB. In the implementations of the present disclosure, 4KB may be referred to as the minimum page size. The pages with the size larger than 4KB may be referred to as huge pages. When a process requests the memory, the OS allocates one or more page frames to the process and maps the process’s pages to the physical page frames. When a process or program runs, its pages are loaded into any available page frames in the physical memory. Each process or program has a respective page table to keep track of the physical addresses corresponding to the virtual addresses, implementing translating the virtual addresses into the physical addresses through the MMU, and ensuring that the virtual memories of different processes are isolated from each other.

[0088] FIG. 4 illustrates a schematic diagram of an example mapping between virtual addresses and physical addresses. The virtual memory in a process or program is divided into multiple pages and the virtual addresses of the pages, also referred to as the page number in the FIG. 4, are recorded in the page table. Each page number corresponds to a page frame number, that is, the physical address. Each corresponding relationship between the virtual addresses and the physical addresses is referred to as a page table entry, that is, each row in the page table is a page table entry. As shown in FIG. 4, when the process or program requests to access the virtual address of page 2, the OS queries the page table to find the page table entry whose page number is 2 and obtain the corresponding page frame number of 5. After that, the OS finds the memory block with the physical address 5 in the physical memory. The memory block with the physical address 5 stores the actual data which the process or program requires during running. When the process or program requests to access the virtual address of page 4, the OS may not find the corresponding page frame number of page 4, that is, the actual data required by the process or program may not be stored in the physical memory. In this case, the OS may trigger a page fault.

[0089] The page fault is a part of the virtual memory management, which allows the OS to physically fit large amounts of data efficiently in the memory. To solve the page fault, the OS needs to load the required data into the physical memory. If the physical memory has free memory space to accommodate new pages, the OS may check the swap area or file system in the disk to ensure that the required page has stored in the disk. After confirming the required page stored in the disk, the OSallocates a page frame for required page in the physical memory and loads the page from the disk to the page frame. Later, the OS records the physical address of the page frame in the page table entry of the page which caused the page fault. After the above processing, the process or program continues to run and accesses the required data. If the physical memory has no free memory space to accommodate new pages, the OS may implement page swapping to solve the page fault.

[0090] The page swapping is a mechanism to manage memory efficiently when the physical memory is full. The page swapping may replace one of the pages existing in the physical memory with the page which caused the page fault. The page swapping includes replacement algorithms such as first in first out (FIFO), optimal page replacement, least recently used (LRU), and most recently used (MRU). Each algorithm has different mechanisms to select which page to be replaced. After selection, the OS loads the required page from the disk to the page frame where the selected page is stored and modifies the page table entry of the selected page to mark it as “not present” in the physical memory. Later, the OS records the physical address of the page frame into the page table entry of the page which caused the page fault.

[0091] The paging eliminates external fragmentation since the paging divides the memory into fixed-size blocks, that is, page frames and the processes may be loaded into the blocks. The paging improves the memory utilization and provides the implementation of the virtual memory, allowing the processes to use more memory than physically available by swapping pages between RAM and the disk. However, the paging may result in internal fragmentation if the size of the process is less than the page size. Furthermore, the paging may increase overhead to maintain the page table and RO overhead during page faults.

[0092] In order to reduce the I / O overhead during page faults in paging, a technique called zipped RAM (ZRAM) is implemented by the OS, which allows to compress pages and store pages in the physical memory such as RAM to avoid swapping out of the pages to the disk. When the physical memory is insufficient, ZRAM identifies the least used pages, compresses these pages and stores these pages in a block device in the RAM. When the OS needs to access these pages again, ZRAM may decompress these pages and load these pages into page frames. The implementation manner is similar to the page swapping mechanism, but ZRAM takes place in the RAM, avoiding I / O overhead during page faults. The block device in RAM is not a physical device in the secondary memory, but is a memory space in the primary memory, whose logical structure is similar to the physical block device in the secondary memory. The block device in RAM may efficiently organize and manage memory resources and simplify the access of the OS to the ZRAM.

[0093] ZRAM may improve the response speed and reduce the latency when handling page faults, since compression and decompression operations are faster and more efficient than swapping pages between the physical memory and the disk. However, ZRAM may only compress the pages of minimum RAM page size, that is, 4KB, but may not compress huge pages of sizes larger than 4KB. The huge pages may only be swapped between the RAM and the disk. When swapped out to the disk,the huge pages are either split to pages of minimum RAM page size or written as a whole page to the disk, which may reduce the efficiency and increase the latency.

[0094] Some storage systems and file systems such as enhanced read-only file system (EROFS) support storing data in the block device of the secondary memory by compressing input data of variable sizes to fixed-size output blocks. For example, if output blocks of EROFS has a fixed size of 4KB, the input data, to be compressed, may be 4KB, 12KB, 64KB, 2MB, etc. However, this technique has never been applied in the RAM.

[0095] Due to the above problem, implementations of the present disclosure propose a method for data compression and a method for data reconstruction in the RAM. The method may compress huge pages of multiple sizes into one or more output blocks and store the one or more output blocks in the RAM. When the huge pages are needed by the process again, the method may decompress and reconstruct the huge pages from one or more stored blocks. In this case, the huge pages may not need to be swapped between the RAM and the disk frequently, avoiding RO overhead and reducing latency during page faults.

[0096] FIG. 5 is a flow chart illustrating an example data compression method 500 according to one or more implementations of the present disclosure. The data compression method 500 may include actions in blocks 510, 520, and 530. The data compression method 500 may be performed by the processor 110 described above.

[0097] In block 510, the processor 110 compresses content of a RAM page, as an input page, into one or more output blocks. The size of the input page is equal to power of 2 in a range from a minimum RAM page size to a maximum RAM page size, and the size of each of the one or more output blocks is less than or equal to the minimum RAM page size. The sum size of the one or more output blocks is less than the size of the input page.

[0098] The RAM page, also referred to as the input page in the implementations of the present disclosure, may be compressed into the one or more output blocks. The size of the input page is equal to power of 2, such as 4KB, 16KB, 64KB, or 2MB. The size of the input page is larger than or equal to the minimum RAM page size, and less than or equal to the maximum RAM page size. The minimum RAM page size and the maximum RAM page size both are predefined according to the hardware and the OS in the computing device 110.

[0099] In implementations of the present disclosure, the minimum RAM page size is predetermined by the OS, and the minimum RAM page size is 4KB. It is noted that the minimum RAM page size represents the size of the smallest manageable and processible page for the OS of the computing device 100. The minimum RAM page size may vary with the manufacturing level of the computing device 100, and when the manufacturing level of the computing device 100 increases, the minimum RAM page size increases accordingly.

[0100] In the following description, 4KB is used to represent the minimum RAM page, but a person skilled in the art may replace 4KB with another minimum RAM page.

[0101] In implementations of the present disclosure, the maximum RAM page size is predetermined by the OS, and the maximum RAM page size is 2MB. It is noted that the maximum RAM page size represents the size of the largest manageable and processible page for the OS of the computing device 100. The maximum RAM page size may also vary with the manufacturing level of the computing device 100, and when the manufacturing level of the computing device 100 increases, the maximum RAM page size increases accordingly.

[0102] The processor 110 may compress the input page into the one or more output blocks. After compression, the size of each of the one or more output blocks is less than or equal to the minimum RAM page size. The sum size of the one or more output blocks is less than the size of the input page.

[0103] The output blocks may be categorized into two types according to the sizes of the output blocks. When the size of the output block is less than the minimum RAM page size, this output block is called as a tail block, and when the size of the output block is equal to the minimum RAM page size, this output block is called as a full block. The tail block and the full block may have other names, which is not limited herein. In general, when the RAM page is compressed, one tail block may be obtained and this tail block is used to manage other full blocks if there are other full blocks for the RAM page. The following describes various compression results. The compression may result in any combination of the output blocks.

[0104] For example, the processor 110 may produce one output block of the size less than 4KB and output block(s) of the size equal to 4KB when the RAM page is of the size greater than 4KB. In this case, the one output block of the size less than 4KB, i.e., the tail block, is used to manage output block(s) of the size equal to 4KB, i.e., the full block(s).

[0105] Alternatively, the processor 110 may produce only one output block of the size less than 4KB when the input page is highly compressible and the compressed content is not sufficient to fill the output block of 4KB when the input page is of the size greater than 4KB. In this case, only one tail block is generated.

[0106] Alternatively, the processor 110 may produce only one output block of the size less than 4KB when the input page is of the size equal to 4KB. In this case, only one tail block is generated.

[0107] Alternatively, the processor 110 may produce only output blocks of the size equal to 4KB when the compressed content exactly fills all the output blocks of the size equal to 4KB, that is, there is no output block of the size less than 4KB . When there is no output block of the size less than 4KB , one output block of the size less than 4KB is generated for managing the output blocks of the size equal to 4KB and this output block of the size less than 4KB includes no data of the input page, or the output blocks of the size equal to 4KB are directly processed without the output block of the size less than 4KB. In this case, one tail block may be generated or the processing may go on without the tail block.

[0108] It is noted that when the input page is not compressible, that is, the input page may not be compressed, the method may not produce any result. The input page may be processed by the OS MM, that is, the input page may be swapped between the RAM and the disk.

[0109] As described above, the output blocks may be categorized into two types according to the sizes of the output blocks. When the output block has the size equal to the minimum RAM page size, i.e., the full block, this output block may occupy the fixed space, but when the output block has the size less than the minimum RAM page size, i.e., the tail block, this output block may occupy the variable space. Therefore, the output blocks may be stored into the different spaces according to the sizes of the output blocks.

[0110] In block 520, the processor 110 stores one or more output blocks having a size equal to the minimum RAM page size into a first volatile memory space.

[0111] The first volatile memory space may be a memory area in the RAM, which is allocated and managed by the ZRAM to store the one or more output blocks of the size equal to 4KB. In practice, the output block of the size equal to 4KB, means that the size of the content of this output block is not strictly equal to 4KB. Therefore, the size of the content of each of the one or more output blocks of the size equal to 4KB may be larger than or equal to a difference. The difference may be equal to (minimum RAM page size - BCM), where BCM is short for block compressibility margin and is a fixed value predefined by the OS.

[0112] In block 530, the processor 110 stores an output block having a size less than the minimum RAM page size into a second volatile memory space.

[0113] The second volatile memory space may be another memory area in the RAM, which is also allocated and managed by the ZRAM to store the output block of the size less than 4KB. As mentioned above, there may be only one output block of the size less than 4KB when compressing one RAM page. The size of the content of the output block of the size less than 4KB is less than the difference mentioned above. The size of the output block of the size less than 4KB may be aligned to tail size align (TSA) value which may be predefined by the ZRAM. For example, TSA may be equal to cache line size, that is, 64B. The size of the output block of the size less than 4KB may be stored in the page table entry or in a separate data structure. Since the size of the output block of the size less than 4KB is aligned to TSA, less bits may be needed to store the value of the size of the output block of the size less than 4KB.

[0114] It is noted that the implementations of the present disclosure do not indicate any relationship between BCM and TSA. The value of BCM may be aligned or equal to TSA for efficiency of implementation, or the value of BCM may not be equal to TSA, which is not limited herein.

[0115] FIG. 6 illustrates a diagram of the above example compression process according to one or more implementations of the present disclosure. The input page 610 may be a page of the minimum RAM page size, that is, 4KB, or a huge page of the size larger than 4KB and less than or equal to the maximum RAM page size. The compressor 620 in FIG. 6 may be a compression algorithm in theZRAM, such as, but not limited to, Lempel-Ziv-Markov chain algorithm (LZ4), lightning-fast lossless compression of objects (LZO), or shortest-cycle arithmetic (SCA). After compression, the output block 630, output block 640, and output block 650 are generated. The output block 630 and output block 640 are the output blocks of the size equal to 4KB and are stored in the first volatile memory space 660. The output block 650 is the output block of the size less than 4KB and is stored in the second volatile memory space 670.

[0116] According to one or more implementations of the present disclosure, the content of the RAM page, as the input page, is compressed into the one or more output blocks, one or more output blocks having the size equal to the minimum RAM page size is stored into the first volatile memory space, and an output block having the size less than the minimum RAM page size is stored into the second volatile memory space. Since the two types of the output blocks have different sizes, the output blocks may be stored into the different spaces according to the sizes of the output blocks for efficient memory management. Storing the one or more output blocks having the size equal to the minimum RAM page size into the first volatile memory space may be more conducive for adding, retrieving, discarding and other operations on this type of output blocks. Storing the output block having the size less than the minimum RAM page size into the second volatile memory space may be more conducive for memory compaction, retrieving and other operations on this type of output blocks.

[0117] In solutions of the implementations of the present disclosure, the processor 110 may have the ability to compress and store RAM pages of multiple sizes in the ZRAM, where the sizes may be larger than or equal to the minimum RAM page size. Furthermore, the effective RAM size may increase at least by 10% as compared with current state of the art.

[0118] When storing the one or more output blocks, the address of the input page may be modified, which is conducive to subsequent operations such as decompression and restoring.

[0119] In block 540, the processor 110 modifies an address of the input page in a page table.

[0120] In order to decompress and restore the one or more output blocks to the original input page content, or delete the original input page content and discard the one or more output blocks, the processor 110 needs to keep accounting of the addresses of the one or more output blocks to trace the one or more output blocks.

[0121] In some implementations, the processor 110 may use the page table to trace the one or more output blocks of the sizes equal to and less than 4KB. In this case, the processor 110 may modify the physical address of the input page in the page table to a starting address of a list or array of page table entries and the page table entries in the list or array may be called proxy entries. The proxy entries may point to either the one or more output blocks of the size equal to 4KB or the output block of the size less than 4KB. That is, each proxy entry in the list may store either the physical address of the one or more output blocks of the size equal to 4KB or the physical address of the output block of the size less than 4KB.

[0122] FIG. 7 illustrates an example implementation to trace the one or more output blocks of the sizes equal to and less than 4KB. In FIG. 7, the original page entry (OPE) is the page table entry which stores the physical address of the input page, and the proxy entries (PEs) are the page table entries which store the physical addresses of the one or more output blocks of the size equal to or less than 4KB. The processor 110 modifies the physical address in the OPE to the starting address of the proxy entry list or array. That is, the OPE points to the starting PE in the PE list or array and each PE points to the output block of the size equal to or less than 4KB.

[0123] In solutions of the implementations of the present disclosure, the address of the input page in the page table is modified to the one or more addresses of the one or more output blocks of the sizes equal to and less than 4KB. In this case, the OS MM needs only page table to start decompression or delete the original input page, which may has less latency during retrieving.

[0124] In other implementations, the processor 110 may use the page table to trace the output block of the size less than 4KB. In this case, the processor 110 may modify the physical address of the input page in the page table to the physical address of the output block of the size less than 4KB.

[0125] In this case, the output block of the size less than 4KB is used to manage the output block of the size equal to 4KB when there is one or more output blocks of the size equal to 4KB for the RAM page. For example, the output block of the size less than 4KB may include a metadata to trace the one or more output blocks of the size equal to 4KB generated by compressing the same input page. BCM may be used to accommodate the metadata, thus the size of the metadata is less than BCM. The metadata may store one or more addresses of the one or more output blocks of the size equal to 4KB, and may store the number of the one or more addresses of the one or more output blocks of the size equal to 4KB.

[0126] The one or more addresses and the number of the one or more addresses are optional part in the output block of the size less than 4KB, which may be not stored in the output block of the size less than 4KB, since the one or more output blocks of the size equal to 4KB may be absent sometimes, such as there is no output block of the size equal to 4KB for the RAM page.

[0127] It is noted that when the metadata is intruded into the output block of the size less than 4KB, the size of this output block may become 4KB sometimes. In this case, a person skilled in the art may distinguish this output block of the size equal to 4KB by introducing the metadata and the output block of the size equal to 4KB original from the input page according to the context.

[0128] FIG. 8 illustrates an example implementation to trace the output block of the size less than 4KB. In FIG. 8, the OPE is the page table entry which stores the physical address of the input page, and the physical address of the input page in the OPE is modified to the physical address of the output block of the size less than 4KB, that is, the OPE points to the output block of the size less than 4KB. The metadata may be a memory space in the output block of the size less than 4KB, and stores the physical address of the one or more output blocks of the size equal to 4KB, that is, the metadata points to the one or more output blocks of the size equal to 4KB.

[0129] In solutions of the implementations of the present disclosure, the address of the input page in the page table is modified to the address of the output block having the size less than the minimum RAM page size. In this case, there may be no impact on the size of the page table and no management needed for the page table entries.

[0130] Furthermore, the output block of the size less than 4KB may also include different content according to one or more implementations of the present disclosure. In a case where the compressed data of the input page does not fit into the one or more output blocks of the size equal to 4KB after compression, or the size of the entire compressed data is less than 4KB, the output block of the size less than 4KB may include the compressed data of the input page. In a case where most of the compressed data are filled into the one or more output blocks of the size equal to 4KB and the remaining of the data of the input page is too small to be compressed, the output block of the size less than 4KB may include the remaining uncompressed data of the input page. In a case where the compressed data are exactly filled into the one or more output blocks of the size equal to 4KB, the output block of the size less than 4KB may include no data of the input page. Thus, the metadata may also include a flag which determines whether the data in the output block of the size equal to 4KB, if present, is compressed or uncompressed, and may also include the size of the compressed or uncompressed data. The flag and the size of the compressed or uncompressed data are mandatory part in the output block of the size less than 4KB.

[0131] FIG. 9 illustrates an example implementation of the output block of the size less than 4KB. In FIG. 9, the output block of the size less than 4KB includes the compressed or uncompressed data and the metadata. The output block of the size less than 4KB may also only include the metadata without the compressed or uncompressed data. It is noted that the metadata may be located in any place of the output block of the size less than 4KB, and a person skilled in the art may locate the metadata in other place of the output block of the size less than 4KB.

[0132] In solutions of the implementations of the present disclosure, the output block having the size less than the minimum RAM page size includes: the metadata, where the metadata stores one or more addresses of the one or more output blocks having the size equal to the minimum RAM page size; and one of: compressed data of the input page, uncompressed data of the input page, and no data of the input page. In this case, the output block having the size less than the minimum RAM page size is used to manage the other output block(s) having the size equal to the minimum RAM page size when the same input page is compressed.

[0133] In implementations of the present disclosure, the first volatile memory space is divided into block slots, a size of each of the block slots is equal to the minimum RAM page size, and the action in block 520 includes: obtaining one or more empty block slots in the first volatile memory space based on a first linked data structure, where a plurality of empty block slots are kept in the first linked data structure in the first volatile memory space; and storing the one or more output blocks having the size equal to the minimum RAM page size into the one or more empty block slots.

[0134] In solutions of the implementations of the present disclosure, the plurality of empty block slots are kept in the first linked data structure in the first volatile memory space for fast allocation to store the one or more output blocks of the size equal to the minimum RAM page size in the first volatile memory space, or for fast deallocation to delete the stored one or more output blocks of the size equal to the minimum RAM page size.

[0135] In implementations of the present disclosure, the second volatile memory space includes memory fragments, a size of each of the memory fragments is variable, and the action in block 530 includes: obtaining an unoccupied memory fragment in the second volatile memory space based on a second linked data structure, where a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space, a size of the obtained unoccupied memory fragment is greater than or equal to a size of the output block having the size less than the minimum RAM page size; and storing the output block having the size less than the minimum RAM page size into the obtained unoccupied memory fragment.

[0136] FIG. 10 and FIG. 11 illustrate an example implementation of the second volatile memory space. As shown in FIG. 10 and FIG. 11, the second volatile memory space may include a metadata array, a second linked data structure, and a third data structure. As shown in FIG. 10, the third data structure may store the output blocks of the size less than 4KB properly in the second volatile memory space. The metadata array may track the output blocks of the size less than 4KB in the third data structure while storing, retrieving and compacting the output blocks of the size less than 4KB in the third data structure. The metadata array may grow and shrink when the output blocks of the size less than 4KB are added into the third data structure and discarded from the third data structure. As shown in FIG. 11 , the second linked data structure may keep track of unoccupied memory fragments which may appear in the third data structure due to arbitrary order of storing and retrieving operations.

[0137] The live output blocks of the size less than 4KB in FIG. 10 refers to the output block of the size less than 4KB which may be in use and may not be discarded. When the processor 110 decompresses the output blocks or deletes the output blocks, the output blocks may not be live and may be referred to as dead output blocks.

[0138] FIG. 11 illustrates the relationship between the page table and the third data structure. As shown in FIG. 11 , the metadata array acts as an extra layer of indirection between the page table and the output blocks of the size less than 4KB in the third data structure to allow for on-the-fly compaction of output blocks of the size less than 4KB in the third data structure. The index in the metadata array of the output block of the size less than 4KB may be stored in the OPE in the page table. For example, when the OPE may retrieve the output block 2 of the size less than 4KB in the third data structure, the OPE may store the physical address of the index 2 in the metadata array, where the memory space of the index 2 may include the physical address of the output block 2 of the size less than 4KB in the third data structure, that is, the index 2 has the pointer from metadata array to the actual location of the output block 2 of the size less than 4KB. In the present disclosure, theaddress of the output block of the size less than 4KB in the page table may be referred to as the address of the index in the metadata array, where the index in the metadata array may include the address of the output block of the size less than 4KB in the third data structure.

[0139] It is noted that other possible implementations for on-the-fly compaction may have back pointers from the output blocks of the size less than 4KB into the page table, and is not considered in the implementations of the present disclosure.

[0140] As mentioned above, by introducing the metadata, the size of the output block having the size less than 4KB may become to be equal to 4KB. The second volatile memory apace needs to distinguish this case to improve efficiency. Therefore, in a possible implementation, the third data structure is divided into two parts. FIG. 12 illustrates an example implementation of the third data structure. A part of the third data structure includes the output blocks of the size equal to 4KB, which may be referred to as the first stack and may grow to the opposite direction of the first stack. Another part of the third data structure includes the output blocks of the size less than 4KB, which may be referred to as the second stack and may grow to the opposite direction of the second stack.

[0141] When the output blocks of the size equal to 4KB are received by or written to the second volatile memory space, there may be three options to place the output blocks of the size equal to 4KB. First, when there may be at least one unoccupied memory fragment of the size equal to 4KB in the second linked data structure, the received output blocks of the size equal to 4KB may be placed in the unoccupied memory fragment and the second linked data structure may be updated, that is, the unoccupied memory fragment may be deleted from the second linked data structure. Second, when there is no unoccupied memory fragment of the size equal to 4KB in the second linked data structure and there is unoccupied space larger than or equal to 4KB on top of the first stack, the received output blocks of the size equal to 4KB may be placed on the first stack top and the stack pointer is incremented. Third, when there is no unoccupied memory fragment of the size equal to 4KB in the second linked data structure or no unoccupied space larger than or equal to 4KB on top of the first stack, compaction of the output blocks of the size less than 4KB may be done to obtain a memory fragment of the size larger than or equal to 4KB and to place the received output blocks of the size equal to 4KB in the third data structure.

[0142] When the output blocks of the size less than 4KB are received by or written to the second volatile memory space, there may be three options to place the output blocks of the size less than 4KB. First, when there may be at least one unoccupied memory fragment of the size larger than or equal to the size of the output blocks of the size less than 4KB in the second linked data structure, the received output blocks of the size less than 4KB may be placed in the unoccupied memory fragment and the second linked data structure may be updated, that is, the unoccupied memory fragment may be deleted from the second linked data structure. Second, when there is no unoccupied memory fragment of the size larger than or equal to the size of the output blocks of the size less than 4KB in the second linked data structure and there is unoccupied space larger than or equal to the size of the output blocks of thesize less than 4KB on top of the first stack, the received output blocks of the size less than 4KB may be placed on the first stack top and the stack pointer is incremented. Third, when there is no unoccupied memory fragment of the size larger than or equal to the size of the output blocks of the size less than 4KB in the second linked data structure or no unoccupied space larger than or equal to the size of the output blocks of the size less than 4KB on top of the first stack, compaction of the output blocks of the size less than 4KB may be done to obtain a memory fragment of the size larger than or equal to the size of the output blocks of the size less than 4KB and to place the received output blocks of the size less than 4KB in the third data structure.

[0143] Since the size of the output blocks of the size less than 4KB is aligned to TSA, the compaction may be done much faster than that in OS allocator. It is understood that tight loop of memory copy is applicable during compaction and the memory copy may be done by the most efficient instructions.

[0144] In implementations of the present disclosure, the action in block 530 further includes: when the size of the obtained unoccupied memory fragment is greater than the size of the output block having the size less than the minimum RAM page size, obtaining a new unoccupied memory fragment, where the new unoccupied memory fragment is an unoccupied part of the obtained unoccupied memory fragment after storing the output block having the size less than the minimum RAM page size therein; and adding the new unoccupied memory fragment to the second linked data structure.

[0145] In solutions of the implementations of the present disclosure, adding the unoccupied memory fragment into the second linked data structure may make effective use of the memory space, and may provide more unoccupied memory spaces to accommodate more output blocks having the size less than the minimum RAM page size after memory compaction.

[0146] The above describes the compressing of the input page. The decompressing of the input page or reconstructing of the input page may be described below.

[0147] FIG. 13 is another flow chart illustrating an example data reconstruction method 1300 according to one or more implementations of the present disclosure. The data reconstruction method 1300 may include actions in blocks 1310 and 1320. The data reconstruction method 1300 may be performed by the processor 110 described above.

[0148] In block 1310, the processor 110 reconstructs the RAM page by redirecting to a stored block having a size less than a minimum RAM page size and by redirecting to, based on one or more addresses stored in the stored block having the size less than the minimum RAM page size, one or more stored blocks having a size equal to the minimum RAM page size.

[0149] Due to the one or more addresses of the one or more stored blocks of the size equal to 4KB are stored in the stored block of the size less than 4KB, the reconstruction of the RAM page as a result of the read operation first may redirect to the stored block of the size less than 4KB, and then redirect to the one or more stored blocks of the size equal to 4KB according to a metadata in the stored block of the size less than 4KB.

[0150] In block 1320, the processor 110 replaces an address of the stored block having the size less than the minimum RAM page size in a page table with an address of the reconstructed RAM page.

[0151] The stored block having the size less than the minimum RAM page size may refer to the output block having the size less than the minimum RAM page size in the data compression method described above, and the stored block having the size equal to the minimum RAM page size may refer to the output block having the size equal to the minimum RAM page size in the data compression method described above. The related description is not repeated herein.

[0152] After reconstruction, the reconstructed RAM page is created by decompressing the stored blocks and the address of the reconstructed RAM page replaces the address of the stored block of the size less than 4KB in the page table.

[0153] In implementations of the present disclosure, the stored block having the size less than the minimum RAM page size includes a metadata, where the metadata stores the one or more addresses; and may include compressed data of the RAM page, uncompressed data of the RAM page, or no data of the RAM page.

[0154] In implementations of the present disclosure, the one or more stored blocks having the size equal to the minimum RAM page size are stored in one or more block slots in a first volatile memory space. The first volatile memory space is divided into block slots, and a size of each of the block slots is equal to the minimum RAM page size. The stored block having the size less than the minimum RAM page size is stored in a memory fragment in a second volatile memory space. The second volatile memory space includes memory fragments, and a size of each of the memory fragments is variable.

[0155] The first volatile memory space and the second volatile memory space may refer to the related description in the data compression method described above.

[0156] In implementations of the present disclosure, the processor 110 deletes the stored block having the size less than the minimum RAM page size and the one or more stored blocks having the size equal to the minimum RAM page size. The processor 110 returns the one or more block slots occupied by the one or more stored blocks having the size equal to the minimum RAM page size to a first linked data structure, where a plurality of empty block slots are kept in the first linked data structure in the first volatile memory space. The processor 110 returns the memory fragment occupied by the stored block having the size less than the minimum RAM page size to a second linked data structure, where a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space. The processor 110 erases an address of the stored block having the size less than the minimum RAM page size in a page table.

[0157] In implementations of the present disclosure, the processor 110 further determines empty memory fragments and compacts the empty memory fragments.

[0158] In implementations of the present disclosure, the compacting the empty memory fragments includes that when there are two or more empty memory fragments that are adjacent, the processor110 coalesces the two or more empty memory fragments into a new empty memory fragment, and adds the new empty memory fragment to the second linked data structure; or when there are no two or more empty memory fragments that are adjacent, the processor 110 detects a live stored block that is adjacent to two empty memory fragments on both sides of the live stored block, moves the detected live stored block to one of the two empty memory fragments, coalesces a memory fragment previously occupied by the detected live stored block and another one of the two empty memory fragments into another new empty memory fragment, and adds the another new empty memory fragment to the second linked data structure.

[0159] FIG. 14 illustrates an example implementation of compacting empty memory fragments when there are no two or more empty memory fragments that are adjacent. As shown in FIG. 14, before compaction, the two empty memory fragments are in both sides of the stored block 5 of the size less than 4KB and the stored block 5 of the size less than 4KB is the live stored block. The stored block 5 of the size less than 4KB is moved to the left empty memory fragment, and may be called the new stored block 5 of the size less than 4KB. The memory fragment previously occupied by the stored block 5 of the size less than 4KB may be called the old stored block 5 of the size less than 4KB. The old stored block 5 of the size less than 4KB and the right empty memory fragment are coalesced into another new empty memory fragment. The another new empty memory fragment is added to the second linked data structure. It is noted that the compaction of the empty memory fragments in FIG.14 is illustrative, and a person skilled in the art may implement the compaction of the empty memory fragments in other situations, but the situations meet the cases mentioned above, which is not limited herein.

[0160] In implementations of the present disclosure, the processor 110 further modifies an address of the live stored block in the metadata array after compacting the empty memory fragments.

[0161] As shown in FIG. 14, after moving the stored block 5 of the size less than 4KB, the processor 110 may modify the address of the stored block 5 of the size less than 4KB in the metadata array.

[0162] The following describes computing apparatuses provided in implementations of the present disclosure.

[0163] FIG. 15 illustrates a block diagram of a computing apparatus for data compression and data reconstruction according to implementations of the present disclosure. As illustrated in FIG. 15, the computing apparatus 1500 for data compression and data reconstruction may include a compressing module 1510 and a processing module 1520.

[0164] The computing apparatus 1500 may be applied to the computing device 100 to realize any of the above method implementations. The computing apparatus 1500 may be configured as the computing device 100 or configured as corresponding hardware and / or software in the computing device 100. For example, the apparatus 1500 may be configured as the processor 110.

[0165] In some implementations, the compressing module 1510 is configured to compress the content of the RAM page, as an input page, into the one or more output blocks, where a size of theinput page is equal to power of 2 in a range from a minimum RAM page size to a maximum RAM page size, a size of each of the one or more output blocks is less than or equal to the minimum RAM page size, and a sum size of the one or more output blocks is less than the size of the input page. The processing module 1520 is configured to store one or more output blocks having a size equal to the minimum RAM page size into a first volatile memory space; and store an output block having a size less than the minimum RAM page size into a second volatile memory space.

[0166] In some implementations, the processing module 1520 is further configured to modify an address of the input page in a page table to an address of the output block having the size less than the minimum RAM page size.

[0167] In some implementations, the output block having the size less than the minimum RAM page size includes a metadata, where the metadata stores one or more addresses of the one or more output blocks having the size equal to the minimum RAM page size; and one of: compressed data of the input page, uncompressed data of the input page, and no data of the input page.

[0168] In some implementations, the second volatile memory space includes memory fragments, a size of each of the memory fragments is variable, and the processing module 1520 is further configured: obtain an unoccupied memory fragment in the second volatile memory space based on a second linked data structure, where a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space, a size of the obtained unoccupied memory fragment is greater than or equal to a size of the output block having the size less than the minimum RAM page size; and store the output block having the size less than the minimum RAM page size into the obtained unoccupied memory fragment.

[0169] In some implementations, the processing module 1520 is further configured: when the size of the obtained unoccupied memory fragment is greater than the size of the output block having the size less than the minimum RAM page size, obtain a new unoccupied memory fragment, where the new unoccupied memory fragment is an unoccupied part of the obtained unoccupied memory fragment after storing the output block having the size less than the minimum RAM page size therein; and add the new unoccupied memory fragment to the second linked data structure.

[0170] In some implementations, the minimum RAM page size is predetermined by an operating system in the computing apparatus 1500, and the minimum RAM page size is 4KB.

[0171] In some implementations, the maximum RAM page size is predetermined by an operating system in the computing apparatus 1500, and the maximum RAM page size is 2MB.

[0172] In some implementations, the compressing module 1510 is configured to reconstruct the RAM page by redirecting to a stored block having a size less than a minimum RAM page size and by redirecting to, based on one or more addresses stored in the stored block having the size less than the minimum RAM page size, one or more stored blocks having a size equal to the minimum RAM page size. The processing module 1520 is configured to replace an address of the stored block having thesize less than the minimum RAM page size in a page table with an address of the reconstructed RAM page.

[0173] In some implementations, the stored block having the size less than the minimum RAM page size includes a metadata, where the metadata stores the one or more addresses; and one of: compressed data of the RAM page, uncompressed data of the RAM page, and no data of the RAM page.

[0174] In some implementations, the one or more stored blocks having the size equal to the minimum RAM page size are stored in one or more block slots in a first volatile memory space, the first volatile memory space is divided into block slots, and a size of each of the block slots is equal to the minimum RAM page size; and the stored block having the size less than the minimum RAM page size is stored in a memory fragment in a second volatile memory space, the second volatile memory space includes memory fragments, and a size of each of the memory fragments is variable.

[0175] In some implementations, the processing module 1520 is further configured to delete the stored block having the size less than the minimum RAM page size and the one or more stored blocks having the size equal to the minimum RAM page size; return the one or more block slots occupied by the one or more stored blocks having the size equal to the minimum RAM page size to a first linked data structure, where a plurality of empty block slots are kept in the first linked data structure in the first volatile memory space; return the memory fragment occupied by the stored block having the size less than the minimum RAM page size to a second linked data structure, where a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space; and erase an address of the stored block having the size less than the minimum RAM page size in a page table.

[0176] In some implementations, the processing module 1520 is further configured to determine empty memory fragments; and compact the empty memory fragments.

[0177] In some implementations, the processing module 1520 is further configured to: when there are two or more empty memory fragments that are adjacent, coalesce the two or more empty memory fragments into a new empty memory fragment, and add the new empty memory fragment to the second linked data structure; or when there are no two or more empty memory fragments that are adjacent, detect a live stored block that is adjacent to two empty memory fragments on both sides of the live stored block, move the detected live stored block to one of the two empty memory fragments, coalesce a memory fragment previously occupied by the detected live stored block and another one of the two empty memory fragments into another new empty memory fragment, and add the another new empty memory fragment to the second linked data structure.

[0178] In some implementations, the processing module 1520 is further configured to modify an address of the live stored block.

[0179] In some implementations, the minimum RAM page size is predetermined by an operating system in the computing apparatus 1500, and the minimum RAM page size is 4KB.

[0180] Some implementations of the present disclosure provide a computing device including processing circuitry for executing any of the above methods. It should be understood that the device may execute the steps in the above method implementations, which will not be repeated herein.

[0181] Some implementations of the present disclosure further provide a computing device. The computing device may be referred to as the above computing device 100, where the processor 110 may realize any of the above method implementations, which will not be repeated herein.

[0182] For instance, it is understood that a disclosure in connection with a described method may also hold true for a corresponding apparatus, device, or system configured to perform the method and vice versa. For example, if one or a plurality of specific method steps are described, a corresponding apparatus, device, or system may include one or a plurality of units, e.g. functional units, to perform the described one or plurality of method steps (e.g. one unit performing the one or plurality of steps, or a plurality of units each performing one or more of the plurality of steps), even if such one or more units are not explicitly described or illustrated in the drawings. On the other hand, for example, if a specific apparatus, device, or system is described based on one or a plurality of units, e.g. functional units, a corresponding method may include one step to perform the functionality of the one or plurality of units (e.g. one step performing the functionality of the one or plurality of units, or a plurality of steps each performing the functionality of one or more of the plurality of units), even if such one or plurality of steps are not explicitly described or illustrated in the drawings. Further, it is understood that the features of the various implementations and / or aspects described herein may be combined with each other, unless specifically noted otherwise.

[0183] Some implementations of the present disclosure further provide a chip, and the chip includes a processor. The memory configured to store computer programs is arranged independently from the chip. The processor is configured to execute the computer program stored in the memory to perform the operations and / or processing to be performed by the transmitter or receiver as described in any of the embodiments of the present disclosure. Furthermore, the chip may further include a computing interface. The communication interface may be an input / output interface or an interface circuit, etc. Furthermore, the chip may further include the memory.

[0184] Some implementations of the present disclosure provide a computer-readable storage medium (e.g. a non-transitory computer-readable storage medium). The computer-readable storage medium has stored thereon program instructions that, when run on a computing device, cause the computing device to execute one or more steps of the above methods.

[0185] For example, the computer-readable storage medium includes, but is not limited to, a magnetic storage device (e.g., a hard disk, a floppy disk or a magnetic tape), an optical disk (e.g., a compact disk (CD), or a DVD), a smart card, and a flash memory device (e.g., an erasable programmable read-only memory (EPROM), a card, a stick or a key driver). Various computer-readable storage media described in the implementations of the present disclosure may represent one or more devices and / or other machine -readable storage media, which are used for storing information.The term “computer-readable storage medium” may include, but is not limited to, wireless channels and various other media capable of storing, containing and / or carrying instructions and / or data.

[0186] Some implementations of the present disclosure further provide a computer program product. The computer program product includes program instructions carried on a non-transitory computer-readable storage medium. When executed on a computing device, the computer program instructions cause the computing device to perform one or more steps of the above methods.

[0187] Beneficial effects of the computer-readable storage medium and the computer program product are the same as the beneficial effects of the methods as described in some of the above implementations, and details will not be repeated here.

[0188] In the present disclosure, the terms “a” or “an” are defined to mean “at least one”, that is, these terms do not exclude a plural number of items, unless stated otherwise.

[0189] In the present disclosure, the terms “apparatus” and “device” are used exchangeable.

[0190] In the present disclosure, unless stated otherwise, the terms “connected” and “coupled”, and derivatives and variants thereof, refer herein to any structural or functional connection or coupling, either direct or indirect, between two or more elements. For example, connection or coupling between the elements can be acoustical, mechanical, optical, electrical, thermal, logical, or any combinations thereof.

[0191] In the present disclosure, the expression “based on” is intended to mean “based at least partly on”, that is, this expression can mean “based solely on” or “based partially on”, and so should not be interpreted in a limited manner. More particularly, the expression “based on” could also be understood as meaning “depending on”, “representative of’, “indicative of’, “associated with” or similar expressions.

[0192] In the present disclosure, the terms “system” and “network” may be used interchangeably in different embodiments of this disclosure. “At least one” means one or more, and “a plurality of’ means two or more. The term “and / or” describes an association relationship of associated objects, and indicates that three relationships may exist. For example, A and / or B may indicate the following three cases: Only A exists, both A and B exist, and only B exists, where A and B may be singular or plural. The character “ / ” indicates an “or” relationship between associated objects. “At least one of the following items (pieces)” or a similar expression thereof indicates any combination of these items, including a single item (piece) or any combination of a plurality of items (pieces). For example, “at least one of A, B, or C” includes: only A; only B; only C; A and B; A and C; B and C; or A, B, and C, and “at least one of A, B, and C” may also be understood as including: only A; only B; only C; A and B; A and C; B and C; or A, B, and C. In addition, unless otherwise specified, ordinal numbers such as “first” and “second” in embodiments of this disclosure are used to distinguish between a plurality of objects, and are not used to limit a sequence, a time sequence, priorities, or importance of the plurality of objects.

[0193] A person skilled in the art should understand that embodiments of this disclosure may be provided as a method, an apparatus (or system), a computer -readable storage medium (e.g., a non-transitory computer-readable storage medium), or a computer program product. Therefore, this disclosure may use a form of a hardware-only embodiment, a software-only embodiment, or an embodiment with a combination of software and hardware. Moreover, this disclosure may use a form of a computer program product that is implemented on one or more computer -usable storage media (including but not limited to a disk memory, an optical memory, and the like) that include computer -usable program code.

[0194] This disclosure is described with reference to the flowcharts and / or block diagrams of the method, the device (system), and the computer program product according to this disclosure. It should be understood that computer program instructions may be used to implement each process and / or each block in the flowcharts and / or the block diagrams and a combination of a process and / or a block in the flowcharts and / or the block diagrams. The computer program instructions may be provided for a general-purpose computer, a dedicated computer, an embedded processor, or a processor of another programmable data processing device and enable a machine to execute the instructions. When executed by any computer or the processor of a programmable data processing device, the instructions cause the apparatus to implement specific functions as described in one or more procedures in the flowcharts and / or one or more blocks in the block diagrams. The computer program instructions may alternatively be stored in a computer-readable memory that can indicate a computer or another programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory generate an artifact that includes an instruction apparatus. The instruction apparatus implements a specific function in one or more procedures in the flowcharts and / or one or more blocks in the block diagrams.

[0195] The computer program instructions may alternatively be loaded onto a computer or another programmable data processing device, so that a series of operations and steps are performed on the computer or the another programmable device, so that computer -implemented processing is generated. Therefore, the instructions executed on the computer or on another programmable device provide steps for implementing specific functions as described in one or more procedures in the flowcharts and / or one or more blocks in the block diagrams.

[0196] Modifications and improvements to the above -described implementations of the present disclosure may become apparent to a person skilled in the art. The foregoing description is intended to be exemplary rather than limiting. The scope of the present disclosure is therefore intended to be limited solely by the scope of the appended claims.

Claims

CLAIMS1. A method for compressing content of a random access memory, RAM, page into one or more output blocks, comprising:compressing the content of the RAM page, as an input page, into the one or more output blocks, wherein a size of the input page is equal to power of 2 in a range from a minimum RAM page size to a maximum RAM page size, a size of each of the one or more output blocks is less than or equal to the minimum RAM page size, and a sum size of the one or more output blocks is less than the size of the input page;storing one or more output blocks having a size equal to the minimum RAM page size into a first volatile memory space; andstoring an output block having a size less than the minimum RAM page size into a second volatile memory space.

2. The method of claim 1, further comprising:modifying an address of the input page in a page table to an address of the output block having the size less than the minimum RAM page size.

3. The method of claim 1 or 2, wherein the output block having the size less than the minimum RAM page size comprises:a metadata, wherein the metadata stores one or more addresses of the one or more output blocks having the size equal to the minimum RAM page size; andone of: compressed data of the input page, uncompressed data of the input page, and no data of the input page.

4. The method of any one of claims 1 to 3, wherein the first volatile memory space is divided into block slots, a size of each of the block slots is equal to the minimum RAM page size, and the storing one or more output blocks having the size equal to the minimum RAM page size into the first volatile memory space, comprises:obtaining one or more empty block slots in the first volatile memory space based on a first linked data structure, wherein a plurality of empty block slots are kept in the first linked data structure in the first volatile memory space; andstoring the one or more output blocks having the size equal to the minimum RAM page size into the one or more empty block slots.

5. The method of any one of claims 1 to 4, wherein the second volatile memory space comprises memory fragments, a size of each of the memory fragments is variable, and the storing an outputblock having the size less than the minimum RAM page size into the second volatile memory space, comprises:obtaining an unoccupied memory fragment in the second volatile memory space based on a second linked data structure, wherein a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space, a size of the obtained unoccupied memory fragment is greater than or equal to a size of the output block having the size less than the minimum RAM page size; andstoring the output block having the size less than the minimum RAM page size into the obtained unoccupied memory fragment.

6. The method of claim 5, further comprising:when the size of the obtained unoccupied memory fragment is greater than the size of the output block having the size less than the minimum RAM page size, obtaining a new unoccupied memory fragment, wherein the new unoccupied memory fragment is an unoccupied part of the obtained unoccupied memory fragment after storing the output block having the size less than the minimum RAM page size therein; andadding the new unoccupied memory fragment to the second linked data structure.

7. The method of any one of claims 1 to 6, wherein the minimum RAM page size is predetermined by an operating system, and the minimum RAM page size is 4KB.

8. The method of any one of claims 1 to 7, wherein the maximum RAM page size is predetermined by an operating system, and the maximum RAM page size is 2MB.

9. A method for reconstructing a random access memory, RAM, page from one or more stored blocks, comprising:reconstructing the RAM page by redirecting to a stored block having a size less than a minimum RAM page size and by redirecting to, based on one or more addresses stored in the stored block having the size less than the minimum RAM page size, one or more stored blocks having a size equal to the minimum RAM page size; andreplacing an address of the stored block having the size less than the minimum RAM page size in a page table with an address of the reconstructed RAM page.

10. The method of claim 9, wherein the stored block having the size less than the minimum RAM page size comprises:a metadata, wherein the metadata stores the one or more addresses; andone of: compressed data of the RAM page, uncompressed data of the RAM page, and no data of the RAM page.

11. The method of claim 9 or 10, wherein the one or more stored blocks having the size equal to the minimum RAM page size are stored in one or more block slots in a first volatile memory space, the first volatile memory space is divided into block slots, and a size of each of the block slots is equal to the minimum RAM page size; andthe stored block having the size less than the minimum RAM page size is stored in a memory fragment in a second volatile memory space, the second volatile memory space comprises memory fragments, and a size of each of the memory fragments is variable.

12. The method of claim 11, further comprising:deleting the stored block having the size less than the minimum RAM page size and the one or more stored blocks having the size equal to the minimum RAM page size;returning the one or more block slots occupied by the one or more stored blocks having the size equal to the minimum RAM page size to a first linked data structure, wherein a plurality of empty block slots are kept in the first linked data structure in the first volatile memory space;returning the memory fragment occupied by the stored block having the size less than the minimum RAM page size to a second linked data structure, wherein a plurality of unoccupied memory fragments are kept in the second linked data structure in the second volatile memory space; anderasing an address of the stored block having the size less than the minimum RAM page size in a page table.

13. The method of claim 12, further comprising:determining empty memory fragments; andcompacting the empty memory fragments.

14. The method of claim 13, wherein the compacting the empty memory fragments, comprises: when there are two or more empty memory fragments that are adjacent, coalescing the two or more empty memory fragments into a new empty memory fragment, and adding the new empty memory fragment to the second linked data structure; orwhen there are no two or more empty memory fragments that are adjacent, detecting a live stored block that is adjacent to two empty memory fragments on both sides of the live stored block, moving the detected live stored block to one of the two empty memory fragments, coalescing a memory fragment previously occupied by the detected live stored block and another one of the two emptymemory fragments into another new empty memory fragment, and adding the another new empty memory fragment to the second linked data structure.

15. The method of claim 14, further comprising:modifying an address of the live stored block.

16. The method of any one of claims 9 or 15, wherein the minimum RAM page size is predetermined by an operating system, and the minimum RAM page size is 4KB.

17. A computing apparatus, comprising units for performing the method according to any one of claims 1 to 8, or units for performing the method according to any one of claims 9 to 16.

18. A chip, comprising an input / output (I / O) interface and a processor, wherein the processor is configured to call and run a computer program stored in a memory, to enable a device installed with the chip to perform the method according to any one of claims 1 to 8 or claims 9 to 16.

19. A computing apparatus, comprising:a processor; anda computer-readable storage medium coupled to the processor and storing instructions for execution by the processor, wherein the instructions, when executed by the processor, configure the computing apparatus to perform the method according to any one of claims 1 to 8 or any one of claims 9 to 16.

20. A computer-readable medium carrying a program code which, when executed by a computing apparatus, causes the computing apparatus to perform the method according to any one of claims 1 to 8 or any one of claims 9 to 16.

21. A computer program product comprising a program code for performing the method according to any one of claims 1 to 8 or any one of claims 9 to 16 when executed on a computing apparatus or a processor.