Commit 33f97fa3 authored by Vitaliy Mysak's avatar Vitaliy Mysak Committed by Tomasz Zawadzki
Browse files

lib/ocf_env: fix incorrect value for free memory estimate



OCF relies on our env to get information about free memory.
It then uses that information to return a descriptive
error if not enough memory is available.
But no other calculation done based on that value.

Our implementation was not correct because it returned
the size of available physical memory in the system,
while we use HUGEPAGE memory for most of OCF operations.

There doesn't seem to be a reliant API for getting
the size of available HUGEPAGE memory, so instead
return UINT64_MAX, as it is done in ocf/env/posix/ocf_env.h.
This way, OCF will not know ahead of time if there
is enough memory available, but it will still fail
properly on operations that require too much memory.

Change-Id: Iec2e3cfa8453253513d5861d7e6acf0e08dad1e9
Signed-off-by: default avatarVitaliy Mysak <vitaliy.mysak@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1976


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarDarek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 51d69a7f
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -171,8 +171,7 @@ static inline void env_vfree(const void *ptr)

static inline uint64_t env_get_free_memory(void)
{
	/* TODO: do we need implementation for this function? */
	return sysconf(_SC_PAGESIZE) * sysconf(_SC_AVPHYS_PAGES);
	return -1;
}

/* *** ALLOCATOR *** */