Commit 0c7d89fb authored by Marko Mäkelä's avatar Marko Mäkelä

squash! 7c5068ff

Revert the change to buf_pool_t::page_cleaner_wakeup() and
unconditionally wake up the page cleaner if we are running
out of buffer pool.
parent 7c5068ff
...@@ -112,17 +112,11 @@ static void buf_flush_validate_skip() ...@@ -112,17 +112,11 @@ static void buf_flush_validate_skip()
} }
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
void buf_pool_t::page_cleaner_wakeup(wakeup_reason reason) void buf_pool_t::page_cleaner_wakeup(bool for_LRU)
{ {
if (!page_cleaner_idle()) if (!page_cleaner_idle())
{ {
/* Many ISA provide N and Z flags, which we desire to use for if (for_LRU)
efficient checking of the wakeup reason. */
static_assert(WAKE_NOW_LRU < 0, "efficiency");
static_assert(WAKE_IDLE == 0, "efficiency");
static_assert(WAKE_IDLE_LRU > 0, "efficiency");
if (reason < WAKE_IDLE)
/* Ensure that the page cleaner is not in a timed wait. */ /* Ensure that the page cleaner is not in a timed wait. */
pthread_cond_signal(&do_flush_list); pthread_cond_signal(&do_flush_list);
return; return;
...@@ -156,7 +150,7 @@ void buf_pool_t::page_cleaner_wakeup(wakeup_reason reason) ...@@ -156,7 +150,7 @@ void buf_pool_t::page_cleaner_wakeup(wakeup_reason reason)
- by allowing last_activity_count to updated when page-cleaner is made - by allowing last_activity_count to updated when page-cleaner is made
active and has work to do. This ensures that the last_activity signal active and has work to do. This ensures that the last_activity signal
is consumed by the page-cleaner before the next one is generated. */ is consumed by the page-cleaner before the next one is generated. */
if (reason != WAKE_IDLE || if (for_LRU ||
(pct_lwm != 0.0 && (pct_lwm <= dirty_pct || (pct_lwm != 0.0 && (pct_lwm <= dirty_pct ||
last_activity_count == srv_get_activity_count())) || last_activity_count == srv_get_activity_count())) ||
srv_max_buf_pool_modified_pct <= dirty_pct) srv_max_buf_pool_modified_pct <= dirty_pct)
......
...@@ -426,9 +426,7 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex) ...@@ -426,9 +426,7 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex)
if (UNIV_UNLIKELY(available < scan_depth)) { if (UNIV_UNLIKELY(available < scan_depth)) {
mysql_mutex_lock(&buf_pool.flush_list_mutex); mysql_mutex_lock(&buf_pool.flush_list_mutex);
buf_pool.page_cleaner_wakeup(available < scan_depth / 2 buf_pool.page_cleaner_wakeup(true);
? buf_pool.WAKE_NOW_LRU
: buf_pool.WAKE_IDLE_LRU);
mysql_mutex_unlock(&buf_pool.flush_list_mutex); mysql_mutex_unlock(&buf_pool.flush_list_mutex);
} }
...@@ -461,7 +459,7 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex) ...@@ -461,7 +459,7 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex)
mysql_mutex_lock(&buf_pool.flush_list_mutex); mysql_mutex_lock(&buf_pool.flush_list_mutex);
const auto n_flush = buf_pool.n_flush(); const auto n_flush = buf_pool.n_flush();
if (!buf_pool.try_LRU_scan) { if (!buf_pool.try_LRU_scan) {
buf_pool.page_cleaner_wakeup(buf_pool.WAKE_NOW_LRU); buf_pool.page_cleaner_wakeup(true);
} }
mysql_mutex_unlock(&buf_pool.flush_list_mutex); mysql_mutex_unlock(&buf_pool.flush_list_mutex);
mysql_mutex_lock(&buf_pool.mutex); mysql_mutex_lock(&buf_pool.mutex);
......
...@@ -1777,17 +1777,9 @@ class buf_pool_t ...@@ -1777,17 +1777,9 @@ class buf_pool_t
return page_cleaner_status > PAGE_CLEANER_IDLE; return page_cleaner_status > PAGE_CLEANER_IDLE;
} }
enum wakeup_reason {
/** Immediately wake up for LRU eviction */
WAKE_NOW_LRU= -1,
/** Wake up normally from indefinite sleep (@see page_cleaner_idle()) */
WAKE_IDLE= 0,
/** Wake up due to LRU eviction from indefinite sleep */
WAKE_IDLE_LRU
};
/** Wake up the page cleaner if needed. /** Wake up the page cleaner if needed.
@param reason how the page cleaner should be woken up */ @param for_LRU whether to wake up for LRU eviction */
void page_cleaner_wakeup(wakeup_reason reason= WAKE_IDLE); void page_cleaner_wakeup(bool for_LRU= false);
/** Register whether an explicit wakeup of the page cleaner is needed */ /** Register whether an explicit wakeup of the page cleaner is needed */
void page_cleaner_set_idle(bool deep_sleep) void page_cleaner_set_idle(bool deep_sleep)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment