Much like the comment says, the virtual memory layer in the operating system 
lazily allocates pages. If they're zero they'll get lazily allocated so there 
isn't any reason for us to use up a lot of extra system memory storing 0s.

Ali

Sent from my ARM powered mobile device

> On Aug 12, 2015, at 12:40 PM, Ishan <[email protected]> wrote:
>
> In physical.cc, specifically the function unserializeStore()
> (this function restores the
> contents of memory from a checkpoint), I had a
> question about a specific line of code:
>
> for (uint32_t x = 0; x < bytes_read / sizeof(long); x++) {
>            // Only copy bytes that are non-zero, so we don't give
>            // the VM system hell
>            if (*(temp_page + x) != 0) {
>                pmem_current = (long*)(pmem + curr_size + x * sizeof(long));
>                *pmem_current = *(temp_page + x);
>            }
>        }
>
> My question is: why do they only copy bytes that are non-zero?
>
> _______________________________________________
> gem5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/gem5-dev

-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered 
in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, 
Registered in England & Wales, Company No:  2548782

_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to