diff options
author | Tomas Vondra | 2025-07-01 10:58:35 +0000 |
---|---|---|
committer | Tomas Vondra | 2025-07-01 10:58:35 +0000 |
commit | bf1119d74a79b68d9c9086e5d32d44fb294a1427 (patch) | |
tree | 623b87e52c806e23f0c6fd5521dc61c668a30f4d | |
parent | 81f287dc923f565722f46b18d71969926bc3c64f (diff) |
Add CHECK_FOR_INTERRUPTS into pg_numa_query_pages
Querying the NUMA status can be quite time consuming, especially with
large shared buffers. 8cc139bec34a called numa_move_pages() once, for
all buffers, and we had to wait for the syscall to complete.
But with the chunking, introduced by 7fe2f67c7c to work around a kernel
bug, we can do CHECK_FOR_INTERRUPTS() after each chunk, allowing users
to abort the execution.
Reviewed-by: Christoph Berg <[email protected]>
Reviewed-by: Bertrand Drouvot <[email protected]>
Discussion: https://postgr.es/m/[email protected]
Backpatch-through: 18
-rw-r--r-- | src/port/pg_numa.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/port/pg_numa.c b/src/port/pg_numa.c index d5935207d0a..c65f22020ea 100644 --- a/src/port/pg_numa.c +++ b/src/port/pg_numa.c @@ -16,6 +16,7 @@ #include "c.h" #include <unistd.h> +#include "miscadmin.h" #include "port/pg_numa.h" /* @@ -76,6 +77,8 @@ pg_numa_query_pages(int pid, unsigned long count, void **pages, int *status) unsigned long count_chunk = Min(count - next, NUMA_QUERY_CHUNK_SIZE); + CHECK_FOR_INTERRUPTS(); + /* * Bail out if any of the chunks errors out (ret<0). We ignore * (ret>0) which is used to return number of nonmigrated pages, |