From: Ondřej Surý Date: Thu, 27 May 2021 09:04:37 +0000 (+0200) Subject: Indicate to the kernel that we won't be needing the zone dumps X-Git-Tag: v9.17.14~13^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e83b6569dabe12024f30184dd54d5c9737a39f6f;p=thirdparty%2Fbind9.git 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. --- diff --git a/lib/dns/masterdump.c b/lib/dns/masterdump.c index 0c8a400196e..c5f00bd1c33 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);