I see this bug on aarch64 too. Thanks for opening this ticket.
The attached patch seems to work for me. It just replaces EXEC_PAGESIZE
with a call to getpagesize().
Here's what my watchdog logs say before:
Dec 23 17:12:09 ceph00 watchdog[8178]: memory: minimum pages = 800
free, 0 allocatable, max swap 0 (65536 byte pages)
And after:
Dec 24 18:46:50 ceph00 watchdog[315682]: memory: minimum pages = 800
free, 0 allocatable, max swap 0 (4096 byte pages)
diff -uNr orig/memory.c src/memory.c
--- orig/memory.c 2020-04-24 04:56:46.000000000 -0400
+++ src/memory.c 2022-12-24 13:41:36.871213261 -0500
@@ -70,7 +70,7 @@
static long kb_per_page(int pages)
{
- return pages * (long)(EXEC_PAGESIZE / 1024);
+ return pages * (long)(getpagesize() / 1024);
}
/*
@@ -181,7 +181,7 @@
int check_allocatable(void)
{
char *mem;
- size_t len = EXEC_PAGESIZE * (size_t)minalloc;
+ size_t len = getpagesize() * (size_t)minalloc;
if (minalloc <= 0)
return 0;
diff -uNr orig/watchdog.c src/watchdog.c
--- orig/watchdog.c 2020-04-24 04:56:46.000000000 -0400
+++ src/watchdog.c 2022-12-24 13:42:04.186439954 -0500
@@ -23,7 +23,6 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
-#include <sys/param.h> /* For EXEC_PAGESIZE */
#include <linux/oom.h>
#include <linux/watchdog.h>
#ifdef __linux__
@@ -251,7 +250,7 @@
log_message(LOG_INFO, " memory not checked");
else
log_message(LOG_INFO, " memory: minimum pages = %d free, %d allocatable, max swap %d (%d byte pages)",
- minpages, minalloc, maxswap, EXEC_PAGESIZE);
+ minpages, minalloc, maxswap, getpagesize());
if (target_list == NULL)
log_message(LOG_INFO, " ping: no machine to check");