Costs to re-fill discarded data
Posted Nov 6, 2012 2:48 UTC (Tue) by gdt
Parent article: Many more words on volatile ranges
One thing which would be useful is marking the volatile memory allocation with a cost. For example, a DNS forwarder cache can gain greatly from volatile memory, as we don't have to guesstimate how much of the machine's memory we should leave to other processes, but simply use the lot knowing that a machine which is used for purposes other than only DNS forwarding will see memory pressure. However, re-filling the forwarder isn't free, it takes packet transmission and reception, so we should only start discarding the forwarder cache after other lower-hanging fruit.
Moreover, you want to be able to change the cost. Take a streaming video application: you want to pull in as much video in advance of viewing as you can, and you don't want to discard viewed memory as the user may rewind. There are three costs there: viewed video has the lowest cost (the user probably won't rewind), impendingly-viewed video has a high cost (discarding the data will lead to user-visible artifacts), unviewed video which won't be seen for a minute or more has a low cost. The interesting thing here is that the costs change all the while.
to post comments)