[Openmp-commits] [PATCH] D35072: Stop defining `PAGE_SIZE`, and use `getpagesize()` on Unix

Dimitry Andric via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jul 6 10:32:39 PDT 2017


dim created this revision.

The kmp_os.h header is defining the `PAGE_SIZE` macro unconditionally,
even while it is only used directly after its definition, for the
Windows implementation of the `KMP_GET_PAGE_SIZE()` macro.

On at least FreeBSD, but likely all other BSDs too, this macro conflicts
with the one defined in system headers, so remove it, since nothing else
uses it.  Make all Unixes use `getpagesize()` instead, and return 0x4000
directly for the Windows case.

(Note that Windows also has a way to retrieve page size, via the
SYSTEM_INFO structure:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724958(v=vs.85).aspx
)


https://reviews.llvm.org/D35072

Files:
  runtime/src/kmp_os.h


Index: runtime/src/kmp_os.h
===================================================================
--- runtime/src/kmp_os.h
+++ runtime/src/kmp_os.h
@@ -248,14 +248,12 @@
 #define __forceinline __inline
 #endif
 
-#define PAGE_SIZE (0x4000)
-
-#if KMP_OS_LINUX
+#if KMP_OS_UNIX
 #define KMP_GET_PAGE_SIZE() getpagesize()
 #else
 // TODO: find the corresponding function to getpagesize() in Windows
 // and use it whenever possible.
-#define KMP_GET_PAGE_SIZE() PAGE_SIZE
+#define KMP_GET_PAGE_SIZE() 0x4000
 #endif
 
 #define PAGE_ALIGNED(_addr)                                                    \


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35072.105473.patch
Type: text/x-patch
Size: 596 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170706/31c59442/attachment.bin>


More information about the Openmp-commits mailing list