主权项 |
1. A method to provide a hardware-based accelerator adapted to manage copy-on-write in a memory of a computer, the method comprising:
identifying a read request adapted to read a block in the memory at an original memory address, wherein the original memory address comprises a page index, a page offset, and a block offset, wherein the page index comprises an index portion and a tag portion; utilizing the hardware-based accelerator to determine whether the block is located in the memory at the original memory address based on a record in a lazy copy table, the record corresponding to a source page located at a source page index and a destination page located at a destination page index, wherein the record comprises a tag, a new page index, a copy-on-write status comprising a plurality of status identifiers, and a level identifier for the copy-on-write status ranging from a highest level of the copy-on-write status that corresponds to two or more blocks in the source page to a first level of the copy-on-write status that corresponds to a corresponding block in the source page, wherein each of the plurality of status identifiers comprises a status bit; storing the tag in a first entry of the lazy copy table, the source page index in a second entry of the lazy copy table, at least one of the plurality of status identifiers in a third entry of the lazy copy table, and the level identifier in a fourth entry of the lazy copy table; determining whether the copy-on-write status indicates that a block in the destination page has been modified from the corresponding block in the source page by recursively evaluating multiple instances of the copy-on-write status based on the level identifier in response to a determination that a quantity of the plurality of status identifiers in the copy-on-write status is less than a quantity of blocks in a page size of the memory, wherein recursively evaluating multiple instances of the copy-on-write status further comprises: converting the page offset from a binary representation to a bitmap; determining whether a result of a bitwise AND operation between the bitmap and the cop-on-write status equals zero; responsive to determining that the result of the bitwise AND operation between the bitmap and the copy-on-write status does not equal zero, determining that the copy-on-write status indicates that the block in the destination page has been modified from the source page; and responsive to determining that the result of the bitwise AND operation between the bitmap and the copy-on-write status equals zero, determining that the copy-on-write status indicates that the block in the destination page has not been modified from the source page; in response to determination by the hardware-based accelerator that the block is located in the memory at the original memory address and the copy-on-write status indicates that the block in the destination page has been modified from the corresponding block in the source page, utilizing the hardware-based accelerator to pass the original memory address to a controller of the computer, wherein the controller is adapted to perform the read request utilizing the original memory address; and in response to determination by the hardware-based accelerator that the block is not located in the memory at the original memory address and the copy-on-write status indicates that the block in the destination page has not been modified from the corresponding block in the source page, utilizing the hardware-based accelerator to generate a new memory address and to pass the new memory address to the controller of the computer, wherein the controller is adapted to perform the read request utilizing the new memory address. |