Legal claims defining the scope of protection, as filed with the USPTO.
1. A method for managing memory space in an electronic device, wherein the electronic device comprises a first memory space and a second memory space, the method comprising: selecting a candidate page from the first memory space of the electronic device for swapping the candidate page out of the first memory space into the second memory space; compressing the candidate page to obtain a first compressed page and a first hash value of the first compressed page; if the first compressed page is smaller than a predetermined size, performing a comparison using the first hash value of the first compressed page and one or more second hash values of one or more second compressed pages stored in the second memory space to find whether any of the one or more second compressed pages has the same content as the first compressed page, wherein a respective size of each of the one or more second compressed pages is smaller than the predetermined size; mapping a virtual address of the first compressed page to one of the one or more second compressed page with the same content as the first compressed page; if the first compressed page is larger than the predetermined size, performing a comparison using the first hash value of the first compressed page and one or more third hash values of one or more uncompressed pages stored in the second memory space to find whether any of the one or more uncompressed pages has the same content as the candidate page, wherein a respective size of each of one or more compressed pages obtained by compressing the one or more uncompressed pages is larger than the predetermined size; and mapping a virtual address of the candidate page to one of the one or more uncompressed pages with the same content as the candidate page.
2. The method as claimed in claim 1 , further comprising maintaining a specific data structure under which the comparison is performed.
3. The method as claimed in claim 1 , wherein the first memory space is a dynamic random-access memory.
4. The method as claimed in claim 3 , wherein the second memory space is a virtual memory space divided from the dynamic random-access memory.
5. The method as claimed in claim 3 , wherein the second memory space is a ZRAM.
6. A method for managing memory space in an electronic device, wherein the electronic device comprises a first memory space and a second memory space, the method comprising: selecting a candidate page from the first memory space of the electronic device for swapping the candidate page out of the first memory space into the second memory space; compressing the candidate page to obtain a first compressed page and a first hash value of the first compressed page; performing a comparison using the first hash value of the first compressed page and one or more hash values of one or more pages previously stored in the second memory space to find whether any of the pages has the same content as the first compressed page or the candidate page; if one page of the one or more pages is found to have the same content as the first compressed page or the candidate page, mapping a virtual address of the first compressed page or the candidate page to the found page; and identifying each of the candidate page and one or more previous candidate pages previously stored in the second memory space to belong to one or more groups respectively according to their respective sizes in compression forms, and in the comparison, the first hash value of the first compressed page and the one or more hash values of one or more pages within the same group as the candidate page is within the same group as the candidate page.
7. The method as claimed in claim 6 , wherein if a size of the first compressed page is smaller than a predetermined size, the plurality of pages stored in the second memory space are compressed pages, wherein a respective size of each of the one or more second compressed pages is smaller than the predetermined size.
8. The method as claimed in claim 6 , wherein if a size of the first compressed page is larger than a predetermined size, the plurality of pages stored in the second memory space are uncompressed pages, wherein a respective size of each of one or more compressed pages obtained by compressing the one or more uncompressed pages is larger than the predetermined size.
9. The electronic device as claimed in claim 6 , wherein the second memory space is a ZRAM.
10. An electronic device, comprising: a first memory space; a second memory space; and a controller, configured to select a candidate page from the first memory space of the electronic device for swapping the candidate page out of the first memory space into the second memory space, and compress the candidate page to obtain a first compressed page and a first hash value of the first compressed page, wherein if the first compressed page is smaller than a predetermined size, the controller is further configured to perform a comparison using the first hash value of the first compressed page and one or more second hash values of one or more second compressed pages stored in the second memory space to find whether any of the one or more second compressed pages has the same content as the first compressed page, wherein a respective size of each of the one or more second compressed pages is smaller than the predetermined size, and map a virtual address of the first compressed page to one of the one or more second compressed page with the same content as the first compressed page, and if the first compressed page is larger than the predetermined size, the controller is further configured to perform a comparison using the first hash value of the first compressed page and one or more third hash values of one or more uncompressed pages stored in the second memory space to find whether any of the one or more uncompressed pages has the same content as the candidate page, wherein a respective size of each of one or more compressed pages obtained by compressing the one or more uncompressed pages is larger than the predetermined size, and map a virtual address of the candidate page to one of the one or more uncompressed pages with the same content as the candidate page.
11. The electronic device as claimed in claim 10 , further comprising maintaining a specific data structure under which the comparison is performed.
12. The electronic device as claimed in claim 10 , wherein the first memory space is a dynamic random-access memory.
13. The electronic device as claimed in claim 12 , wherein the second memory space is a virtual memory space divided from the dynamic random-access memory.
14. An electronic device, comprising: a first memory space; a second memory space; and a controller, configured to select a candidate page from the first memory space of the electronic device for swapping the candidate page out of the first memory space into the second memory space, compress the candidate page to obtain a first compressed page and a first hash value of the first compressed page, performing a comparison using the first hash value of the first compressed page and one or more hash values of one or more pages previously stored in the second memory space to find whether any of the pages has the same content as the first compressed page or the candidate page, and if one page of the one or more pages is found to have the same content as the first compressed page or the candidate page, mapping a virtual address of the first compressed page or the candidate page to the found page, wherein the controller is further configured to identify each of the candidate page and one or more previous candidate pages previously stored in the second memory space to belong to one or more groups respectively according to their respective sizes in compression forms, and in the comparison, the first hash value of the first compressed page and the one or more hash values of one or more pages within the same group as the candidate page is within the same group as the candidate page.
15. The electronic device as claimed in claim 14 , wherein if a size of the first compressed page is smaller than a predetermined size, the plurality of pages stored in the second memory space are compressed pages, wherein a respective size of each of the one or more second compressed pages is smaller than the predetermined size.
16. The method as claimed in claim 14 , wherein if a size of the first compressed page is larger than a predetermined size, the plurality of pages stored in the second memory space are uncompressed pages, wherein a respective size of each of one or more compressed pages obtained by compressing the one or more uncompressed pages is larger than the predetermined size.
Unknown
May 22, 2018
Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.