1
0
mirror of https://github.com/Zygo/bees.git synced 2025-06-17 01:56:16 +02:00

hash: use POSIX_FADV_WILLNEED and POSIX_FADV_DONTNEED

The hash table is one of the few cases in bees where a non-trivial amount
of page cache memory will be used in a predictable way, so we can advise
the kernel about our IO demands in advance.

Use WILLNEED to prefetch hash table pages at startup.

Use DONTNEED to trigger writeback on hash table pages at shutdown.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2021-06-22 22:13:22 -04:00
parent 97d70ef4c5
commit a353d8cc6e
3 changed files with 49 additions and 8 deletions

View File

@ -462,6 +462,9 @@ private:
RateLimiter m_flush_rate_limit;
BeesStringFile m_stats_file;
// Prefetch readahead hint
bool m_prefetch_running = false;
// Mutex/condvar for the writeback thread
mutex m_dirty_mutex;
condition_variable m_dirty_condvar;
@ -887,6 +890,7 @@ extern const char *BEES_VERSION;
string pretty(double d);
void bees_sync(int fd);
void bees_readahead(int fd, off_t offset, size_t size);
void bees_unreadahead(int fd, off_t offset, size_t size);
string format_time(time_t t);
#endif