Memory management supporting huge pages
Abstract
Methods, systems, and apparatus for receiving a request to access, from a main memory, data contained in a first portion of a first page of data, the first page of data having a first page size; initiating a page fault based on determining that the first page of data is not stored in the main memory; allocating a portion of the main memory equivalent to the first page size; transferring the first portion of the first page of data from the secondary memory to the allocated portion of the main memory without transferring the entire first page of data; and updating a first page table entry associated with the first portion of the first page of data to point to a location of the allocated portion of the main memory to which the first portion of the first page of data is transferred.
Claims
exact text as granted — not AI-modifiedWhat is claimed is:
1. A computer-implemented method comprising:
receiving a request to access, from a main memory, data contained in a first portion of a first page of data, the first page of data having a first page size and the first portion comprising a second page size that is less than the first page size;
initiating a page fault based on determining that the first page of data is not stored in the main memory and is stored in a secondary memory;
in response to initiating the page fault, allocating a portion of the main memory equivalent to the first page size;
transferring the first portion of the first page of data from the secondary memory to the allocated portion of the main memory without transferring the entire first page of data, wherein a remaining amount of the first page of data remains stored in the secondary memory and the first portion of the page of data that is transferred is made available for access from the main memory before the remaining amount of the page of data is transferred from the secondary memory to the main memory;
updating a first page table entry associated with the first portion of the first page of data to point to a location of the allocated portion of the main memory to which the first portion of the first page of data is transferred;
once the entire first page of data is stored in the main memory, reassembling the first page of data from the respective portions of the first page of data transferred from the secondary memory to the allocated portion of the main memory; and
updating a page table entry associated with the first page of data to point to a location of the reassembled first page of data in the main memory.
2. The method of claim 1 , further comprising:
transferring the remaining amount of the first page of data from the secondary memory to the main memory.
3. The method of claim 2 , wherein transferring the remaining amount of the first page of data comprises:
repeatedly transferring respective portions, corresponding to the second page size, of the first page of data from the secondary memory to the allocated portion of the main memory until the entire first page of data is stored in the main memory; and
updating a respective page table entry for each of the respective portions of the first page of data to point to respective locations of the respective portions of the first page of data in the main memory.
4. The method of claim 2 , further comprising:
before transferring the remaining portion of the first page of data from the secondary memory to the main memory, indicating that the first portion of the first page of data that was requested to be accessed has been transferred to the main memory.
5. The method of claim 1 , further comprising:
determining whether an access bit is set for each page table entry of a page table based on a scan of the page table with a page table scanner, the access bit indicating whether a page associated with the page table entry was accessed in a last scan period, wherein at least one of the pages having the first page size is divided into pages of the second page size with a page table entry for each of the pages of the second page size in the page table being scanned;
incrementing a count for each page in response to determining that the access bit is not set for the page table entry associated with the page; and
after determining whether the access bit is set for each page table entry, resetting the access bit.
6. The method of claim 5 , further comprising:
if the portion of the main memory equivalent to the first page size cannot be allocated, determining one of a least used pages having the first page size based on the count for each page and releasing the one of the least used pages into the secondary memory, and allocating a portion of the main memory equivalent to the first page size at the location of the released one of the least used pages; and
if the portion of the main memory equivalent to the first page size can be allocated, transferring the first portion of the first page of data from the secondary memory to the allocated portion of the main memory.
7. The method of claim 1 , further comprising:
changing a memory structure of the first page of data having the first page size into a plurality of pages of data having the second page size that is less than the first page size.
8. A system comprising:
one or more processors; and
a memory comprising a main memory and a secondary memory, the memory storing instructions that are operable, when executed, to cause the one or more processors to perform operations comprising:
receiving a request to access, from a main memory, data contained in a first portion of a first page of data, the first page of data having a first page size and the first portion comprising a second page size that is less than the first page size;
initiating a page fault based on determining that the first page of data is not stored in the main memory and is stored in a secondary memory;
in response to initiating the page fault, allocating a portion of the main memory equivalent to the first page size;
transferring the first portion of the first page of data from the secondary memory to the allocated portion of the main memory without transferring the entire first page of data, wherein a remaining amount of the first page of data remains stored in the secondary memory and the first portion of the page of data that is transferred is made available for access from the main memory before the remaining amount of the page of data is transferred from the secondary memory to the main memory;
updating a first page table entry associated with the first portion of the first page of data to point to a location of the allocated portion of the main memory to which the first portion of the first page of data is transferred;
once the entire first page of data is stored in the main memory, reassembling the first page of data from the respective portions of the first page of data transferred from the secondary memory to the allocated portion of the main memory; and
updating a page table entry associated with the first page of data to point to a location of the reassembled first page of data in the main memory.
9. The system of claim 8 , the operations further comprising:
transferring the remaining amount of the first page of data from the secondary memory to the main memory.
10. The system of claim 9 , wherein transferring the remaining amount of the first page of data comprises:
repeatedly transferring respective portions, corresponding to the second page size, of the first page of data from the secondary memory to the allocated portion of the main memory until the entire first page of data is stored in the main memory; and
updating a respective page table entry for each of the respective portions of the first page of data to point to respective locations of the respective portions of the first page of data in the main memory.
11. The system of claim 9 , the operations further comprising:
before transferring the remaining portion of the first page of data from the secondary memory to the main memory, indicating that the first portion of the first page of data that was requested to be accessed has been transferred to the main memory.
12. The system of claim 8 , the operations further comprising:
determining whether an access bit is set for each page table entry of a page table based on a scan of the page table with a page table scanner, the access bit indicating whether a page associated with the page table entry was accessed in a last scan period, wherein at least one of the pages having the first page size is divided into pages of the second page size with a page table entry for each of the pages of the second page size in the page table being scanned;
incrementing a count for each page in response to determining that the access bit is not set for the page table entry associated with the page; and
after determining whether the access bit is set for each page table entry, resetting the access bit.
13. The system of claim 12 , the operations further comprising:
if the portion of the main memory equivalent to the first page size cannot be allocated, determining one of a least used pages having the first page size based on the count for each page and releasing the one of the least used pages into the secondary memory, and allocating a portion of the main memory equivalent to the first page size at the location of the released one of the least used pages; and
if the portion of the main memory equivalent to the first page size can be allocated, transferring the first portion of the first page of data from the secondary memory to the allocated portion of the main memory.
14. The system of claim 8 , the operations further comprising:
changing a memory structure of the first page of data having the first page size into a plurality of pages of data having the second page size that is less than the first page size.
15. A non-transitory computer-readable storage device storing instructions executable by one or more processors which, upon such execution, cause the one or more processors to perform operations comprising:
receiving a request to access, from a main memory, data contained in a first portion of a first page of data, the first page of data having a first page size and the first portion comprising a second page size that is less than the first page size;
initiating a page fault based on determining that the first page of data is not stored in the main memory and is stored in a secondary memory;
in response to initiating the page fault, allocating a portion of the main memory equivalent to the first page size;
transferring the first portion of the first page of data from the secondary memory to the allocated portion of the main memory without transferring the entire first page of data, wherein a remaining amount of the first page of data remains stored in the secondary memory and the first portion of the page of data that is transferred is made available for access from the main memory before the remaining amount of the page of data is transferred from the secondary memory to the main memory;
updating a first page table entry associated with the first portion of the first page of data to point to a location of the allocated portion of the main memory to which the first portion of the first page of data is transferred;
once the entire first page of data is stored in the main memory, reassembling the first page of data from the respective portions of the first page of data transferred from the secondary memory to the allocated portion of the main memory; and
updating a page table entry associated with the first page of data to point to a location of the reassembled first page of data in the main memory.
16. The storage device of claim 15 , the operations further comprising:
transferring the remaining amount of the first page of data from the secondary memory to the main memory.
17. The storage device of claim 16 , wherein transferring the remaining amount of the first page of data comprises:
repeatedly transferring respective portions, corresponding to the second page size, of the first page of data from the secondary memory to the allocated portion of the main memory until the entire first page of data is stored in the main memory; and
updating a respective page table entry for each of the respective portions of the first page of data to point to respective locations of the respective portions of the first page of data in the main memory.
18. The storage device of claim 15 , the operations further comprising:
determining whether an access bit is set for each page table entry of a page table based on a scan of the page table with a page table scanner, the access bit indicating whether a page associated with the page table entry was accessed in a last scan period, wherein at least one of the pages having the first page size is divided into pages of the second page size with a page table entry for each of the pages of the second page size in the page table being scanned;
incrementing a count for each page in response to determining that the access bit is not set for the page table entry associated with the page; and
after determining whether the access bit is set for each page table entry, resetting the access bit.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.