From: Michael Vrable Date: Wed, 11 Aug 2010 19:43:19 +0000 (-0700) Subject: More aggressively use memory-mapped data for cloud log items. X-Git-Url: https://git.vrable.net/?a=commitdiff_plain;h=b8da8a2b1a41913b958c8dea58060aab26a6a18a;p=bluesky.git More aggressively use memory-mapped data for cloud log items. Replace a string with a memory-mapped version as soon as possible when the item is written out. The intent is that memory-mapped versions rely on the kernel's memory management, and don't need to be written to swap like a private copy would, and so should give better overall system memory management. --- diff --git a/bluesky/log.c b/bluesky/log.c index c45ffc8..99b5ae5 100644 --- a/bluesky/log.c +++ b/bluesky/log.c @@ -204,6 +204,14 @@ static gpointer log_thread(gpointer d) offset += sizeof(header) + sizeof(footer) + item->data->len; + /* Replace the log item's string data with a memory-mapped copy of the + * data, now that it has been written to the log file. (Even if it + * isn't yet on disk, it should at least be in the page cache and so + * available to memory map.) */ + bluesky_string_unref(item->data); + item->data = NULL; + bluesky_cloudlog_fetch(item); + log->committed = g_slist_prepend(log->committed, item); g_atomic_int_add(&item->data_lock_count, -1); g_mutex_unlock(item->lock);