From e83b6569dabe12024f30184dd54d5c9737a39f6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= Date: Thu, 27 May 2021 11:04:37 +0200 Subject: [PATCH] Indicate to the kernel that we won't be needing the zone dumps Add a call to posix_fadvise() to indicate to the kernel, that `named` won't be needing the dumped zone files any time soon with: * POSIX_FADV_DONTNEED - The specified data will not be accessed in the near future. Notes: POSIX_FADV_DONTNEED attempts to free cached pages associated with the specified region. This is useful, for example, while streaming large files. A program may periodically request the kernel to free cached data that has already been used, so that more useful cached pages are not discarded instead. --- lib/dns/masterdump.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 0c8a400196..c5f00bd1c3 100644 --- a/lib/dns/masterdump.c +++ b/lib/dns/masterdump.c @@ -1898,6 +1898,11 @@ opentmp(isc_mem_t *mctx, dns_masterformat_t format, const char *file, isc_result_totext(result)); goto cleanup; } + +#if defined(POSIX_FADV_DONTNEED) + posix_fadvise(fileno(f), 0, 0, POSIX_FADV_DONTNEED); +#endif + *tempp = tempname; *fp = f; return (ISC_R_SUCCESS);