summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/pttstruct.h4
-rw-r--r--sample/pttbbs.conf6
2 files changed, 8 insertions, 2 deletions
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 7c5a12a6..1167fb33 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -586,8 +586,8 @@ typedef struct {
#endif
} SHM_t;
-#ifdef USE_HUGETLB // 4MB aligned
-# define SHMSIZE (sizeof(SHM_t)/(1048576*4)+1)*1048576*4
+#ifdef SHMALIGNEDSIZE
+# define SHMSIZE (sizeof(SHM_t)/(SHMALIGNEDSIZE)+1)*SHMALIGNEDSIZE
#else
# define SHMSIZE (sizeof(SHM_t))
#endif
diff --git a/sample/pttbbs.conf b/sample/pttbbs.conf
index 7715ce5a..37101764 100644
--- a/sample/pttbbs.conf
+++ b/sample/pttbbs.conf
@@ -150,6 +150,12 @@
/* 使用 HUGETLB shared memory . 目前只在 Linux 上有效 */
//#define USE_HUGETLB
+/* 在某些平台之下, shared-memory規定需要為一定的 aligned size,
+ 如在 linux x86_64 下使用 HUGETLB 時需為 4MB aligned,
+ 而在 linux ia64 下使用 HUGETLB時需為 256MB aligned.
+ 單位為 bytes */
+//#define SHMALIGNEDSIZE (1048576*4) // 4MB for x86_64
+
/* 讓過於熱門或被鬧的版冷靜, SHM 會變大一些些 */
#define USE_COOLDOWN