Patent ID: 11928359
Assignee: HUAWEI TECHNOLOGIES CO., LTD.
Field: Computer technology (Electrical engineering)
Classification: CPC G | IPC G

Claim 0:
1. A memory swapping method, comprising:
selecting n to-be-swapped-out pages, wherein n is an integer greater than 0;
compressing the n to-be-swapped-out pages into n compressed blocks, grouping the n compressed blocks into at least one group based on a group identifier, and buffering the at least one group in a compressed data buffer area, wherein compressed blocks comprised in each group have a same group identifier;
organizing at least one compressed block in one group into m to-be-written units, wherein m is an integer less than or equal to n and greater than 0, and a size of each of the m to-be-written units is an integer quantity of pages; and
writing the m to-be-written units into a swap area of a non-volatile storage device in a maximum of m batches, wherein at least one to-be-written unit in the m to-be-written units is stored in a segment of continuous space in the swap area,
wherein before the organizing at least one compressed block in one group into m to-be-written units, the method further comprises;
selecting a part of the at least one group based on a second indication, wherein the second indication comprises the group identifier, and the second indication is sent by an operating system or an application at an application layer, and
wherein the second indication further comprises a quantity of compressed blocks or a to-be-swapped-out data volume, and the quantity of compressed blocks or the to-be-swapped-out data volume indicates a quantity of to-be-swapped-out compressed blocks in a group indicated by the group identifier or a volume of to-be-swapped-out data in the group indicated by the group identifier.