From 2a9d9642eaa7775a716166f1b9fc564e60c06b84 Mon Sep 17 00:00:00 2001 From: Roland Olbricht Date: Fri, 4 Nov 2022 21:29:43 +0100 Subject: [PATCH] Inform the OS cache with madvise --- src/template_db/file_blocks.h | 1 + src/template_db/file_blocks_index.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/template_db/file_blocks.h b/src/template_db/file_blocks.h index 134abf1a6..4b8c74eeb 100644 --- a/src/template_db/file_blocks.h +++ b/src/template_db/file_blocks.h @@ -794,6 +794,7 @@ class Mmap addr = mmap(0, length, PROT_READ, MAP_PRIVATE, fd, offset); if (addr == (void*)(-1)) throw File_Error(errno, file_name, origin); + posix_madvise(addr, length, POSIX_MADV_WILLNEED); } ~Mmap() { diff --git a/src/template_db/file_blocks_index.h b/src/template_db/file_blocks_index.h index 4ef279203..3b5cd211d 100644 --- a/src/template_db/file_blocks_index.h +++ b/src/template_db/file_blocks_index.h @@ -206,7 +206,7 @@ struct Readonly_File_Blocks_Index : public File_Blocks_Index_Base void increase_block_count(uint32 delta) { params.block_count += delta; } virtual bool empty() const { return params.empty_; } File_Blocks_Index_Iterator< Index > begin() - { //std::cout<<"DEBUG File_Blocks_Idx "<<(void*)idx_file.begin()<<' '<<(void*)idx_file.end()<<' '<(idx_file.begin(), idx_file.end()); } File_Blocks_Index_Iterator< Index > end() { return File_Blocks_Index_Iterator< Index >(idx_file.end(), idx_file.end()); }