We could maybe improve our gains from #8974 by promoting serialization of keys that are modified. Some research and design is needed. TBD.
Comment From: ShooterIT
This is good point, but how to evaluate keys priority, by 'size' or 'hot'? do you have new ideas?
I wanted to serialize 'big' keys first, particularly which more than 4k, but we have no idea to know which keys are big, we don't record this information of keys. An easy way i can think, we can use extra data structure to record these keys if they are more than specific size, it is easy for string type.
Comment From: oranagra
i don't think we want to handle the bigger ones first, we wanna promote ones that have been modified by the parent process. i.e. we can open some pipe on which the parent will report keys that have been modified for the first time since the fork started. i don't have a specific design, but this is the direction i imagined. also, i'm not certain it'll be very beneficial.
Comment From: ShooterIT
i am confused, if parent change the keys, CoW already happened, is it meaningful to serialize these keys ASAP?
Comment From: oranagra
yes because after serialization we'll MADV_DONTNEED and it'll dismiss that memory. i.e. we won't save the memory copying effort, but we will reduce the CoW memory footprint.