Get PAGE_SIZE from system configuration

Change-Id: I87f383c443b873e13d36e80bfa034665bf493520
Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>


[ROCm/ROCR-Runtime commit: 3b2f064cbc]
This commit is contained in:
Harish Kasiviswanathan
2017-04-28 16:55:52 -04:00
parent 0d55f4a1f7
commit 49805f82b1
5 changed files with 31 additions and 9 deletions
+9
View File
@@ -31,6 +31,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <strings.h>
#include "fmm.h"
static const char kfd_device_name[] = "/dev/kfd";
@@ -69,6 +70,12 @@ static void clear_after_fork(void)
kfd_open_count = 0;
}
static inline void init_page_size(void)
{
PAGE_SIZE = sysconf(_SC_PAGESIZE);
PAGE_SHIFT = ffs(PAGE_SIZE) - 1;
}
HSAKMT_STATUS
HSAKMTAPI
hsaKmtOpenKFD(void)
@@ -99,6 +106,8 @@ hsaKmtOpenKFD(void)
goto open_failed;
}
init_page_size();
result = topology_sysfs_get_system_props(&sys_props);
if (result != HSAKMT_STATUS_SUCCESS)
goto topology_sysfs_failed;