Update free memory computation to include cached buffers.

Fix a potential rare corner case.
This commit is contained in:
Moinak Ghosh 2013-08-17 11:31:44 +05:30
parent 413a2a2fb1
commit d31c6433c2
2 changed files with 5 additions and 4 deletions

View file

@ -970,6 +970,7 @@ process_blocks:
for (j = 0; j < length && sub_i < cfg->sub_intervals;) {
b = *((uint64_t *)tgt);
tgt += sizeof (uint64_t);
j += sizeof (uint64_t);
if (b != a) {
*((uint64_t *)sim_ck) = b;
sim_ck += sizeof (uint64_t);

View file

@ -397,10 +397,10 @@ get_sys_limits(my_sysinfo *msys_info)
if (rv == -1) {
sys_info.freeram = 100 * 1024 * 1024; // 100M arbitrary
}
msys_info->totalram = sys_info.totalram;
msys_info->freeram = sys_info.freeram;
msys_info->totalswap = sys_info.totalswap;
msys_info->freeswap = sys_info.freeswap;
msys_info->totalram = sys_info.totalram * sys_info.mem_unit;
msys_info->freeram = sys_info.freeram * sys_info.mem_unit + sys_info.bufferram * sys_info.mem_unit;
msys_info->totalswap = sys_info.totalswap * sys_info.mem_unit;
msys_info->freeswap = sys_info.freeswap * sys_info.mem_unit;
msys_info->mem_unit = sys_info.mem_unit;
if ((val = getenv("PCOMPRESS_INDEX_MEM")) != NULL) {