diff options
author | markj <markj@FreeBSD.org> | 2016-07-16 02:53:52 +0000 |
---|---|---|
committer | markj <markj@FreeBSD.org> | 2016-07-16 02:53:52 +0000 |
commit | 1a3bbf89f0920fd3630290ab0ff451b67bd4a3a8 (patch) | |
tree | 2769231cb0fd6c4806d57a6a0767b41c57b9a7e6 | |
parent | 76bb79f4d00ef668c8800d7f11eacf5d8d39a37b (diff) | |
download | FreeBSD-src-1a3bbf89f0920fd3630290ab0ff451b67bd4a3a8.zip FreeBSD-src-1a3bbf89f0920fd3630290ab0ff451b67bd4a3a8.tar.gz |
MFC r301090:
mkimg: Indicate that input file pages are unlikely to be reused.
-rw-r--r-- | usr.bin/mkimg/image.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/usr.bin/mkimg/image.c b/usr.bin/mkimg/image.c index a3bec63..2527f28 100644 --- a/usr.bin/mkimg/image.c +++ b/usr.bin/mkimg/image.c @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include <sys/stat.h> #include <sys/types.h> #include <assert.h> +#include <err.h> #include <errno.h> #include <limits.h> #include <paths.h> @@ -315,6 +316,8 @@ image_file_unmap(void *buffer, size_t sz) unit = (secsz > image_swap_pgsz) ? secsz : image_swap_pgsz; sz = (sz + unit - 1) & ~(unit - 1); + if (madvise(buffer, sz, MADV_DONTNEED) != 0) + warn("madvise"); munmap(buffer, sz); return (0); } |