A method of managing data during execution of an application in a system that includes a host memory, a near memory, and a near device associated with the near memory, wherein the application uses a working set of data that is distributed between a far memory and the near memory, the method comprising:
- counting a number of times that the near device accesses a unit of the working set of data from the far memory;
- determining whether the number of times exceeds a dynamically changing access counter threshold, wherein the dynamically changing access counter threshold is, in cases of no oversubscription of the near memory, calculated dynamically based on a static threshold that is set for the system and a current percentage occupancy of the near memory;
- and
- responsive to determining that the number of times exceeds the dynamically changing access counter threshold, migrating the unit of data from the far memory to the near memory.