- pagesize = sysconf(_SC_PAGESIZE);
- pages = sysconf(_SC_PHYS_PAGES);
- if (pages != -1 && pagesize != -1) {
- unsigned long long real_mem = pages * pagesize;
-
- if ((mlock_size + 128 * 1024 * 1024) > real_mem) {
- mlock_size = real_mem - 128 * 1024 * 1024;
- printf("fio: limiting mlocked memory to %lluMiB\n",
- mlock_size >> 20);
+ phys_mem = os_phys_mem();
+ if (phys_mem) {
+ if ((mlock_size + 128 * 1024 * 1024) > phys_mem) {
+ mlock_size = phys_mem - 128 * 1024 * 1024;
+ fprintf(f_out, "fio: limiting mlocked memory to %lluMiB\n", mlock_size >> 20);