]> git.pld-linux.org Git - packages/mysql.git/blob - mysql-split_buf_pool_mutex_fixed_optimistic_safe.patch
- expire-logs-days sample
[packages/mysql.git] / mysql-split_buf_pool_mutex_fixed_optimistic_safe.patch
1 diff -r 2e0c46e78b50 innobase/buf/buf0buf.c
2 --- a/innobase/buf/buf0buf.c    Mon Dec 22 00:33:53 2008 -0800
3 +++ b/innobase/buf/buf0buf.c    Mon Dec 22 00:33:59 2008 -0800
4 @@ -548,6 +548,19 @@
5         mutex_create(&(buf_pool->mutex));
6         mutex_set_level(&(buf_pool->mutex), SYNC_BUF_POOL);
7  
8 +       mutex_create(&(buf_pool->flush_list_mutex));
9 +       mutex_create(&(buf_pool->LRU_mutex));
10 +       mutex_create(&(buf_pool->free_mutex));
11 +       rw_lock_create(&(buf_pool->hash_latch));
12 +       mutex_set_level(&(buf_pool->flush_list_mutex), SYNC_NO_ORDER_CHECK);
13 +       mutex_set_level(&(buf_pool->LRU_mutex), SYNC_NO_ORDER_CHECK);
14 +       mutex_set_level(&(buf_pool->free_mutex), SYNC_NO_ORDER_CHECK);
15 +       rw_lock_set_level(&(buf_pool->hash_latch), SYNC_NO_ORDER_CHECK);
16 +
17 +       mutex_enter(&(buf_pool->LRU_mutex));
18 +       mutex_enter(&(buf_pool->flush_list_mutex));
19 +       mutex_enter(&(buf_pool->free_mutex));
20 +       rw_lock_x_lock(&(buf_pool->hash_latch));
21         mutex_enter(&(buf_pool->mutex));
22  
23         if (srv_use_awe) {
24 @@ -723,6 +736,10 @@
25                 block->in_free_list = TRUE;
26         }
27  
28 +       mutex_exit(&(buf_pool->LRU_mutex));
29 +       mutex_exit(&(buf_pool->flush_list_mutex));
30 +       mutex_exit(&(buf_pool->free_mutex));
31 +       rw_lock_x_unlock(&(buf_pool->hash_latch));
32         mutex_exit(&(buf_pool->mutex));
33  
34         if (srv_use_adaptive_hash_indexes) {
35 @@ -859,12 +876,12 @@
36         if (buf_pool->freed_page_clock >= block->freed_page_clock 
37                                 + 1 + (buf_pool->curr_size / 4)) {
38  
39 -               mutex_enter(&buf_pool->mutex);
40 +               mutex_enter(&(buf_pool->LRU_mutex));
41                 /* There has been freeing activity in the LRU list:
42                 best to move to the head of the LRU list */
43  
44                 buf_LRU_make_block_young(block);
45 -               mutex_exit(&buf_pool->mutex);
46 +               mutex_exit(&(buf_pool->LRU_mutex));
47         }
48  }
49  
50 @@ -880,7 +897,7 @@
51  {
52         buf_block_t*    block;
53         
54 -       mutex_enter(&(buf_pool->mutex));
55 +       mutex_enter(&(buf_pool->LRU_mutex));
56  
57         block = buf_block_align(frame);
58  
59 @@ -888,7 +905,7 @@
60  
61         buf_LRU_make_block_young(block);
62  
63 -       mutex_exit(&(buf_pool->mutex));
64 +       mutex_exit(&(buf_pool->LRU_mutex));
65  }
66  
67  /************************************************************************
68 @@ -899,7 +916,7 @@
69  /*===========*/
70         buf_block_t*    block)  /* in, own: block to be freed */
71  {
72 -       mutex_enter(&(buf_pool->mutex));
73 +       mutex_enter(&(buf_pool->free_mutex));
74  
75         mutex_enter(&block->mutex);
76  
77 @@ -909,7 +926,7 @@
78  
79         mutex_exit(&block->mutex);
80  
81 -       mutex_exit(&(buf_pool->mutex));
82 +       mutex_exit(&(buf_pool->free_mutex));
83  }
84  
85  /*************************************************************************
86 @@ -950,11 +967,11 @@
87  {
88         buf_block_t*    block;
89  
90 -       mutex_enter_fast(&(buf_pool->mutex));
91 +       rw_lock_s_lock(&(buf_pool->hash_latch));
92  
93         block = buf_page_hash_get(space, offset);
94  
95 -       mutex_exit(&(buf_pool->mutex));
96 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
97  
98         return(block);
99  }
100 @@ -971,7 +988,7 @@
101  {
102         buf_block_t*    block;
103  
104 -       mutex_enter_fast(&(buf_pool->mutex));
105 +       rw_lock_s_lock(&(buf_pool->hash_latch));
106  
107         block = buf_page_hash_get(space, offset);
108  
109 @@ -979,7 +996,7 @@
110                 block->check_index_page_at_flush = FALSE;
111         }
112         
113 -       mutex_exit(&(buf_pool->mutex));
114 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
115  }
116  
117  /************************************************************************
118 @@ -998,7 +1015,7 @@
119         buf_block_t*    block;
120         ibool           is_hashed;
121  
122 -       mutex_enter_fast(&(buf_pool->mutex));
123 +       rw_lock_s_lock(&(buf_pool->hash_latch));
124  
125         block = buf_page_hash_get(space, offset);
126  
127 @@ -1008,7 +1025,7 @@
128                 is_hashed = block->is_hashed;
129         }
130  
131 -       mutex_exit(&(buf_pool->mutex));
132 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
133  
134         return(is_hashed);
135  }
136 @@ -1050,7 +1067,7 @@
137  {
138         buf_block_t*    block;
139  
140 -       mutex_enter_fast(&(buf_pool->mutex));
141 +       rw_lock_s_lock(&(buf_pool->hash_latch));
142  
143         block = buf_page_hash_get(space, offset);
144  
145 @@ -1058,7 +1075,7 @@
146                 block->file_page_was_freed = TRUE;
147         }
148  
149 -       mutex_exit(&(buf_pool->mutex));
150 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
151  
152         return(block);
153  }
154 @@ -1079,7 +1096,7 @@
155  {
156         buf_block_t*    block;
157  
158 -       mutex_enter_fast(&(buf_pool->mutex));
159 +       rw_lock_s_lock(&(buf_pool->hash_latch));
160  
161         block = buf_page_hash_get(space, offset);
162  
163 @@ -1087,7 +1104,7 @@
164                 block->file_page_was_freed = FALSE;
165         }
166  
167 -       mutex_exit(&(buf_pool->mutex));
168 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
169  
170         return(block);
171  }
172 @@ -1166,26 +1183,33 @@
173         buf_pool->n_page_gets++;
174  loop:
175         block = NULL;
176 -       mutex_enter_fast(&(buf_pool->mutex));
177 +       // mutex_enter_fast(&(buf_pool->mutex));
178         
179         if (guess) {
180                 block = buf_block_align(guess);
181  
182 +               mutex_enter(&block->mutex);
183                 if ((offset != block->offset) || (space != block->space)
184                                 || (block->state != BUF_BLOCK_FILE_PAGE)) {
185  
186 +                       mutex_exit(&block->mutex);
187                         block = NULL;
188                 }
189         }
190  
191         if (block == NULL) {
192 +               rw_lock_s_lock(&(buf_pool->hash_latch));
193                 block = buf_page_hash_get(space, offset);
194 +               if(block) {
195 +                       mutex_enter(&block->mutex);
196 +               }
197 +               rw_lock_s_unlock(&(buf_pool->hash_latch));
198         }
199  
200         if (block == NULL) {
201                 /* Page not in buf_pool: needs to be read from file */
202  
203 -               mutex_exit(&(buf_pool->mutex));
204 +               // mutex_exit(&(buf_pool->mutex));
205  
206                 if (mode == BUF_GET_IF_IN_POOL) {
207  
208 @@ -1204,7 +1228,7 @@
209                 goto loop;
210         }
211  
212 -       mutex_enter(&block->mutex);
213 +       // mutex_enter(&block->mutex);
214  
215         ut_a(block->state == BUF_BLOCK_FILE_PAGE);
216  
217 @@ -1216,7 +1240,7 @@
218  
219                 if (mode == BUF_GET_IF_IN_POOL) {
220                         /* The page is only being read to buffer */
221 -                       mutex_exit(&buf_pool->mutex);
222 +                       // mutex_exit(&buf_pool->mutex);
223                         mutex_exit(&block->mutex);
224  
225                         return(NULL);
226 @@ -1233,7 +1257,9 @@
227                 LRU list and we must put it to awe_LRU_free_mapped list once
228                 mapped to a frame */
229                 
230 +               mutex_enter_fast(&(buf_pool->mutex));
231                 buf_awe_map_page_to_frame(block, TRUE);
232 +               mutex_exit(&buf_pool->mutex);
233         }
234         
235  #ifdef UNIV_SYNC_DEBUG
236 @@ -1241,7 +1267,7 @@
237  #else
238         buf_block_buf_fix_inc(block);
239  #endif
240 -       mutex_exit(&buf_pool->mutex);
241 +       // mutex_exit(&buf_pool->mutex);
242  
243         /* Check if this is the first access to the page */
244  
245 @@ -1791,7 +1817,8 @@
246  
247         ut_a(block);
248  
249 -       mutex_enter(&(buf_pool->mutex));
250 +       mutex_enter(&(buf_pool->LRU_mutex));
251 +       rw_lock_x_lock(&(buf_pool->hash_latch));
252         mutex_enter(&block->mutex);
253  
254         if (fil_tablespace_deleted_or_being_deleted_in_mem(space,
255 @@ -1806,7 +1833,8 @@
256                 being deleted, or the page is already in buf_pool, return */
257  
258                 mutex_exit(&block->mutex);
259 -               mutex_exit(&(buf_pool->mutex));
260 +               mutex_exit(&(buf_pool->LRU_mutex));
261 +               rw_lock_x_unlock(&(buf_pool->hash_latch));
262  
263                 buf_block_free(block);
264  
265 @@ -1821,10 +1849,14 @@
266         ut_ad(block);
267         
268         buf_page_init(space, offset, block);
269 +       rw_lock_x_unlock(&(buf_pool->hash_latch));
270  
271         /* The block must be put to the LRU list, to the old blocks */
272  
273         buf_LRU_add_block(block, TRUE);         /* TRUE == to old blocks */
274 +       mutex_exit(&(buf_pool->LRU_mutex));
275 +
276 +       mutex_enter(&(buf_pool->mutex)); /* for consistency about aio */
277         
278         block->io_fix = BUF_IO_READ;
279  
280 @@ -1873,7 +1905,8 @@
281  
282         free_block = buf_LRU_get_free_block();
283         
284 -       mutex_enter(&(buf_pool->mutex));
285 +       mutex_enter(&(buf_pool->LRU_mutex));
286 +       rw_lock_x_lock(&(buf_pool->hash_latch));
287  
288         block = buf_page_hash_get(space, offset);
289  
290 @@ -1884,7 +1917,8 @@
291                 block->file_page_was_freed = FALSE;
292  
293                 /* Page can be found in buf_pool */
294 -               mutex_exit(&(buf_pool->mutex));
295 +               mutex_exit(&(buf_pool->LRU_mutex));
296 +               rw_lock_x_unlock(&(buf_pool->hash_latch));
297  
298                 buf_block_free(free_block);
299  
300 @@ -1907,6 +1941,7 @@
301         mutex_enter(&block->mutex);
302  
303         buf_page_init(space, offset, block);
304 +       rw_lock_x_unlock(&(buf_pool->hash_latch));
305  
306         /* The block must be put to the LRU list */
307         buf_LRU_add_block(block, FALSE);
308 @@ -1918,7 +1953,7 @@
309  #endif
310         buf_pool->n_pages_created++;
311  
312 -       mutex_exit(&(buf_pool->mutex));
313 +       mutex_exit(&(buf_pool->LRU_mutex));
314  
315         mtr_memo_push(mtr, block, MTR_MEMO_BUF_FIX);
316  
317 @@ -1932,7 +1967,7 @@
318         ibuf_merge_or_delete_for_page(NULL, space, offset, TRUE);
319  
320         /* Flush pages from the end of the LRU list if necessary */
321 -       buf_flush_free_margin();
322 +       buf_flush_free_margin(FALSE);
323  
324         frame = block->frame;
325  
326 @@ -1968,6 +2003,7 @@
327  {
328         ulint           io_type;
329         ulint           read_page_no;
330 +       ulint           flush_type;
331         
332         buf_io_counter_t*       io_counter;
333         ulint           fold;
334 @@ -2050,9 +2086,6 @@
335                 }
336         }
337         
338 -       mutex_enter(&(buf_pool->mutex));
339 -       mutex_enter(&block->mutex);
340 -
341  #ifdef UNIV_IBUF_DEBUG
342         ut_a(ibuf_count_get(block->space, block->offset) == 0);
343  #endif
344 @@ -2061,9 +2094,12 @@
345         removes the newest lock debug record, without checking the thread
346         id. */
347  
348 -       block->io_fix = 0;
349 -       
350         if (io_type == BUF_IO_READ) {
351 +               mutex_enter(&block->mutex);
352 +               mutex_enter(&(buf_pool->mutex));
353 +
354 +               block->io_fix = 0;
355 +
356                 /* NOTE that the call to ibuf may have moved the ownership of
357                 the x-latch to this OS thread: do not let this confuse you in
358                 debugging! */           
359 @@ -2094,6 +2130,8 @@
360                 }
361                 }
362  
363 +               mutex_exit(&(buf_pool->mutex));
364 +               mutex_exit(&block->mutex);
365  #ifdef UNIV_DEBUG
366                 if (buf_debug_prints) {
367                         fputs("Has read ", stderr);
368 @@ -2102,10 +2140,25 @@
369         } else {
370                 ut_ad(io_type == BUF_IO_WRITE);
371  
372 +               flush_type = block->flush_type;
373 +               if (flush_type == BUF_FLUSH_LRU) { /* optimistic! */
374 +                       mutex_enter(&(buf_pool->LRU_mutex));
375 +               }
376 +               mutex_enter(&(buf_pool->flush_list_mutex));
377 +               mutex_enter(&block->mutex);
378 +               mutex_enter(&(buf_pool->mutex));
379 +
380 +               block->io_fix = 0;
381 +
382                 /* Write means a flush operation: call the completion
383                 routine in the flush system */
384  
385                 buf_flush_write_complete(block);
386 +
387 +               mutex_exit(&(buf_pool->flush_list_mutex));
388 +               if (flush_type == BUF_FLUSH_LRU) { /* optimistic! */
389 +                       mutex_exit(&(buf_pool->LRU_mutex));
390 +               }
391  
392                 rw_lock_s_unlock_gen(&(block->lock), BUF_IO_WRITE);
393                 /* io_counter here */
394 @@ -2131,6 +2184,9 @@
395  
396                 buf_pool->n_pages_written++;
397  
398 +               mutex_exit(&(buf_pool->mutex));
399 +               mutex_exit(&block->mutex);
400 +
401  #ifdef UNIV_DEBUG
402                 if (buf_debug_prints) {
403                         fputs("Has written ", stderr);
404 @@ -2138,9 +2194,6 @@
405  #endif /* UNIV_DEBUG */
406         }
407         
408 -       mutex_exit(&block->mutex);
409 -       mutex_exit(&(buf_pool->mutex));
410 -
411  #ifdef UNIV_DEBUG
412         if (buf_debug_prints) {
413                 fprintf(stderr, "page space %lu page no %lu\n",
414 @@ -2168,11 +2221,11 @@
415                 freed = buf_LRU_search_and_free_block(100);
416         }
417         
418 -       mutex_enter(&(buf_pool->mutex));
419 +       mutex_enter(&(buf_pool->LRU_mutex));
420  
421         ut_ad(UT_LIST_GET_LEN(buf_pool->LRU) == 0);
422  
423 -       mutex_exit(&(buf_pool->mutex));
424 +       mutex_exit(&(buf_pool->LRU_mutex));
425  }
426  
427  /*************************************************************************
428 @@ -2191,10 +2244,22 @@
429         ulint           n_flush         = 0;
430         ulint           n_free          = 0;
431         ulint           n_page          = 0;
432 +       ulint           n_single_flush_tmp      = 0;
433 +       ulint           n_lru_flush_tmp         = 0;
434 +       ulint           n_list_flush_tmp        = 0;
435         
436         ut_ad(buf_pool);
437  
438 +       mutex_enter(&(buf_pool->LRU_mutex));
439 +       mutex_enter(&(buf_pool->flush_list_mutex));
440 +       mutex_enter(&(buf_pool->free_mutex));
441 +       rw_lock_x_lock(&(buf_pool->hash_latch));
442 +
443         mutex_enter(&(buf_pool->mutex));
444 +       n_single_flush_tmp = buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE];
445 +       n_list_flush_tmp = buf_pool->n_flush[BUF_FLUSH_LIST];
446 +       n_lru_flush_tmp = buf_pool->n_flush[BUF_FLUSH_LRU];
447 +       mutex_exit(&(buf_pool->mutex));
448  
449         for (i = 0; i < buf_pool->curr_size; i++) {
450  
451 @@ -2262,11 +2327,14 @@
452         }
453         ut_a(UT_LIST_GET_LEN(buf_pool->flush_list) == n_flush);
454  
455 -       ut_a(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE] == n_single_flush);
456 -       ut_a(buf_pool->n_flush[BUF_FLUSH_LIST] == n_list_flush);
457 -       ut_a(buf_pool->n_flush[BUF_FLUSH_LRU] == n_lru_flush);
458 +       ut_a(n_single_flush_tmp == n_single_flush);
459 +       ut_a(n_list_flush_tmp == n_list_flush);
460 +       ut_a(n_lru_flush_tmp == n_lru_flush);
461         
462 -       mutex_exit(&(buf_pool->mutex));
463 +       mutex_exit(&(buf_pool->LRU_mutex));
464 +       mutex_exit(&(buf_pool->flush_list_mutex));
465 +       mutex_exit(&(buf_pool->free_mutex));
466 +       rw_lock_x_unlock(&(buf_pool->hash_latch));
467  
468         ut_a(buf_LRU_validate());
469         ut_a(buf_flush_validate());
470 @@ -2298,7 +2366,9 @@
471         index_ids = mem_alloc(sizeof(dulint) * size);
472         counts = mem_alloc(sizeof(ulint) * size);
473  
474 -       mutex_enter(&(buf_pool->mutex));
475 +       mutex_enter(&(buf_pool->LRU_mutex));
476 +       mutex_enter(&(buf_pool->flush_list_mutex));
477 +       mutex_enter(&(buf_pool->free_mutex));
478         
479         fprintf(stderr,
480                 "buf_pool size %lu\n"
481 @@ -2351,7 +2421,9 @@
482                 }
483         }
484  
485 -       mutex_exit(&(buf_pool->mutex));
486 +       mutex_exit(&(buf_pool->LRU_mutex));
487 +       mutex_exit(&(buf_pool->flush_list_mutex));
488 +       mutex_exit(&(buf_pool->free_mutex));
489  
490         for (i = 0; i < n_found; i++) {
491                 index = dict_index_get_if_in_cache(index_ids[i]);
492 @@ -2386,8 +2458,6 @@
493          ulint i;
494          ulint fixed_pages_number = 0;
495  
496 -        mutex_enter(&(buf_pool->mutex));
497 -
498          for (i = 0; i < buf_pool->curr_size; i++) {
499  
500                 block = buf_pool_get_nth_block(buf_pool, i);
501 @@ -2403,7 +2473,6 @@
502                 }
503          }
504  
505 -        mutex_exit(&(buf_pool->mutex));
506          return fixed_pages_number;
507  }
508  #endif /* UNIV_DEBUG */
509 @@ -2431,7 +2500,9 @@
510  {
511         ulint   ratio;
512  
513 -       mutex_enter(&(buf_pool->mutex));
514 +       mutex_enter(&(buf_pool->LRU_mutex));
515 +       mutex_enter(&(buf_pool->flush_list_mutex));
516 +       mutex_enter(&(buf_pool->free_mutex));
517  
518         ratio = (100 * UT_LIST_GET_LEN(buf_pool->flush_list))
519                      / (1 + UT_LIST_GET_LEN(buf_pool->LRU)
520 @@ -2439,7 +2510,9 @@
521  
522                        /* 1 + is there to avoid division by zero */   
523  
524 -       mutex_exit(&(buf_pool->mutex));
525 +       mutex_exit(&(buf_pool->LRU_mutex));
526 +       mutex_exit(&(buf_pool->flush_list_mutex));
527 +       mutex_exit(&(buf_pool->free_mutex));
528  
529         return(ratio);
530  }
531 @@ -2459,6 +2532,9 @@
532         ut_ad(buf_pool);
533         size = buf_pool->curr_size;
534  
535 +       mutex_enter(&(buf_pool->LRU_mutex));
536 +       mutex_enter(&(buf_pool->flush_list_mutex));
537 +       mutex_enter(&(buf_pool->free_mutex));
538         mutex_enter(&(buf_pool->mutex));
539         
540         if (srv_use_awe) {
541 @@ -2532,6 +2608,9 @@
542         buf_pool->n_pages_written_old = buf_pool->n_pages_written;
543         buf_pool->n_pages_awe_remapped_old = buf_pool->n_pages_awe_remapped;
544  
545 +       mutex_exit(&(buf_pool->LRU_mutex));
546 +       mutex_exit(&(buf_pool->flush_list_mutex));
547 +       mutex_exit(&(buf_pool->free_mutex));
548         mutex_exit(&(buf_pool->mutex));
549  }
550  
551 @@ -2562,8 +2641,6 @@
552         
553         ut_ad(buf_pool);
554  
555 -       mutex_enter(&(buf_pool->mutex));
556 -
557         for (i = 0; i < buf_pool->curr_size; i++) {
558  
559                 block = buf_pool_get_nth_block(buf_pool, i);
560 @@ -2584,8 +2661,6 @@
561  
562                 mutex_exit(&block->mutex);
563         }
564 -
565 -       mutex_exit(&(buf_pool->mutex));
566  
567         return(TRUE);
568  }      
569 @@ -2625,11 +2700,11 @@
570  {
571         ulint   len;
572  
573 -       mutex_enter(&(buf_pool->mutex));
574 +       mutex_enter(&(buf_pool->free_mutex));
575  
576         len = UT_LIST_GET_LEN(buf_pool->free);
577  
578 -       mutex_exit(&(buf_pool->mutex));
579 +       mutex_exit(&(buf_pool->free_mutex));
580  
581         return(len);
582  }
583 diff -r 2e0c46e78b50 innobase/buf/buf0flu.c
584 --- a/innobase/buf/buf0flu.c    Mon Dec 22 00:33:53 2008 -0800
585 +++ b/innobase/buf/buf0flu.c    Mon Dec 22 00:33:59 2008 -0800
586 @@ -117,12 +117,14 @@
587         ut_ad(mutex_own(&block->mutex));
588  #endif /* UNIV_SYNC_DEBUG */
589         if (block->state != BUF_BLOCK_FILE_PAGE) {
590 +               /* I permited not to own LRU_mutex..  */
591 +/*
592                 ut_print_timestamp(stderr);
593                 fprintf(stderr,
594  "  InnoDB: Error: buffer block state %lu in the LRU list!\n",
595                         (ulong)block->state);
596                 ut_print_buf(stderr, (byte*)block, sizeof(buf_block_t));
597 -
598 +*/
599                 return(FALSE);
600         }
601  
602 @@ -536,18 +538,20 @@
603         ut_ad(flush_type == BUF_FLUSH_LRU || flush_type == BUF_FLUSH_LIST
604                                 || flush_type == BUF_FLUSH_SINGLE_PAGE);
605  
606 -       mutex_enter(&(buf_pool->mutex));
607 +       rw_lock_s_lock(&(buf_pool->hash_latch));
608  
609         block = buf_page_hash_get(space, offset);
610  
611         ut_a(!block || block->state == BUF_BLOCK_FILE_PAGE);
612  
613         if (!block) {
614 -               mutex_exit(&(buf_pool->mutex));
615 +               rw_lock_s_unlock(&(buf_pool->hash_latch));
616                 return(0);
617         }
618  
619         mutex_enter(&block->mutex);
620 +       mutex_enter(&(buf_pool->mutex));
621 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
622  
623         if (flush_type == BUF_FLUSH_LIST
624             && buf_flush_ready_for_flush(block, flush_type)) {
625 @@ -744,7 +748,7 @@
626                 high = fil_space_get_size(space);
627         }
628  
629 -       mutex_enter(&(buf_pool->mutex));
630 +       rw_lock_s_lock(&(buf_pool->hash_latch));
631  
632         for (i = low; i < high; i++) {
633  
634 @@ -778,7 +782,7 @@
635  
636                                 mutex_exit(&block->mutex);
637  
638 -                               mutex_exit(&(buf_pool->mutex));
639 +                               rw_lock_s_unlock(&(buf_pool->hash_latch));
640  
641                                 /* Note: as we release the buf_pool mutex
642                                 above, in buf_flush_try_page we cannot be sure
643 @@ -789,14 +793,14 @@
644                                 count += buf_flush_try_page(space, i,
645                                                             flush_type);
646  
647 -                               mutex_enter(&(buf_pool->mutex));
648 +                               rw_lock_s_lock(&(buf_pool->hash_latch));
649                         } else {
650                                 mutex_exit(&block->mutex);
651                         }
652                 }
653         }
654                                 
655 -       mutex_exit(&(buf_pool->mutex));
656 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
657  
658         return(count);
659  }
660 @@ -849,7 +853,14 @@
661         }
662  
663         (buf_pool->init_flush)[flush_type] = TRUE;
664 +
665 +       mutex_exit(&(buf_pool->mutex));
666         
667 +       if (flush_type == BUF_FLUSH_LRU) {
668 +               mutex_enter(&(buf_pool->LRU_mutex));
669 +       }
670 +       mutex_enter(&(buf_pool->flush_list_mutex));
671 +
672         for (;;) {
673                 /* If we have flushed enough, leave the loop */
674                 if (page_count >= min_n) {
675 @@ -895,7 +906,10 @@
676                                 offset = block->offset;
677             
678                                 mutex_exit(&block->mutex);
679 -                               mutex_exit(&(buf_pool->mutex));
680 +                               if (flush_type == BUF_FLUSH_LRU) {
681 +                                       mutex_exit(&(buf_pool->LRU_mutex));
682 +                               }
683 +                               mutex_exit(&(buf_pool->flush_list_mutex));
684  
685                                 old_page_count = page_count;
686                                 
687 @@ -908,7 +922,10 @@
688                                 flush_type, offset,
689                                 page_count - old_page_count); */
690  
691 -                               mutex_enter(&(buf_pool->mutex));
692 +                               if (flush_type == BUF_FLUSH_LRU) {
693 +                                       mutex_enter(&(buf_pool->LRU_mutex));
694 +                               }
695 +                               mutex_enter(&(buf_pool->flush_list_mutex));
696  
697                         } else if (flush_type == BUF_FLUSH_LRU) {
698  
699 @@ -930,6 +947,13 @@
700                         break;
701                 }
702         }
703 +
704 +       if (flush_type == BUF_FLUSH_LRU) {
705 +               mutex_exit(&(buf_pool->LRU_mutex));
706 +       }
707 +       mutex_exit(&(buf_pool->flush_list_mutex));
708 +
709 +       mutex_enter(&(buf_pool->mutex));
710  
711         (buf_pool->init_flush)[flush_type] = FALSE;
712  
713 @@ -989,10 +1013,14 @@
714         buf_block_t*    block;
715         ulint           n_replaceable;
716         ulint           distance        = 0;
717 -       
718 -       mutex_enter(&(buf_pool->mutex));
719 +
720 +       /* optimistic search... */
721 +       //mutex_enter(&(buf_pool->LRU_mutex));
722 +       //mutex_enter(&(buf_pool->free_mutex));
723  
724         n_replaceable = UT_LIST_GET_LEN(buf_pool->free);
725 +
726 +       //mutex_exit(&(buf_pool->free_mutex));
727  
728         block = UT_LIST_GET_LAST(buf_pool->LRU);
729  
730 @@ -1014,7 +1042,7 @@
731                 block = UT_LIST_GET_PREV(LRU, block);
732         }
733         
734 -       mutex_exit(&(buf_pool->mutex));
735 +       //mutex_exit(&(buf_pool->LRU_mutex));
736  
737         if (n_replaceable >= BUF_FLUSH_FREE_BLOCK_MARGIN) {
738  
739 @@ -1033,8 +1061,9 @@
740  immediately, without waiting. */ 
741  
742  void
743 -buf_flush_free_margin(void)
744 +buf_flush_free_margin(
745  /*=======================*/
746 +       ibool   wait)
747  {
748         ulint   n_to_flush;
749         ulint   n_flushed;
750 @@ -1044,7 +1073,7 @@
751         if (n_to_flush > 0) {
752                 n_flushed = buf_flush_batch(BUF_FLUSH_LRU, n_to_flush,
753                                                         ut_dulint_zero);
754 -               if (n_flushed == ULINT_UNDEFINED) {
755 +               if (wait && n_flushed == ULINT_UNDEFINED) {
756                         /* There was an LRU type flush batch already running;
757                         let us wait for it to end */
758                    
759 @@ -1094,11 +1123,11 @@
760  {
761         ibool   ret;
762         
763 -       mutex_enter(&(buf_pool->mutex));
764 +       mutex_enter(&(buf_pool->flush_list_mutex));
765  
766         ret = buf_flush_validate_low();
767         
768 -       mutex_exit(&(buf_pool->mutex));
769 +       mutex_exit(&(buf_pool->flush_list_mutex));
770  
771         return(ret);
772  }
773 diff -r 2e0c46e78b50 innobase/buf/buf0lru.c
774 --- a/innobase/buf/buf0lru.c    Mon Dec 22 00:33:53 2008 -0800
775 +++ b/innobase/buf/buf0lru.c    Mon Dec 22 00:33:59 2008 -0800
776 @@ -79,7 +79,10 @@
777         ibool           all_freed;
778  
779  scan_again:
780 -       mutex_enter(&(buf_pool->mutex));
781 +       mutex_enter(&(buf_pool->LRU_mutex));
782 +       mutex_enter(&(buf_pool->flush_list_mutex));
783 +       mutex_enter(&(buf_pool->free_mutex));
784 +       rw_lock_x_lock(&(buf_pool->hash_latch));
785         
786         all_freed = TRUE;
787         
788 @@ -117,7 +120,10 @@
789                         
790                                 mutex_exit(&block->mutex);
791  
792 -                               mutex_exit(&(buf_pool->mutex));
793 +                               mutex_exit(&(buf_pool->LRU_mutex));
794 +                               mutex_exit(&(buf_pool->flush_list_mutex));
795 +                               mutex_exit(&(buf_pool->free_mutex));
796 +                               rw_lock_x_unlock(&(buf_pool->hash_latch));
797  
798                                 /* Note that the following call will acquire
799                                 an S-latch on the page */
800 @@ -147,7 +153,10 @@
801                 block = UT_LIST_GET_PREV(LRU, block);
802         }
803  
804 -       mutex_exit(&(buf_pool->mutex));
805 +       mutex_exit(&(buf_pool->LRU_mutex));
806 +       mutex_exit(&(buf_pool->flush_list_mutex));
807 +       mutex_exit(&(buf_pool->free_mutex));
808 +       rw_lock_x_unlock(&(buf_pool->hash_latch));
809         
810         if (!all_freed) {
811                 os_thread_sleep(20000);
812 @@ -170,14 +179,14 @@
813         ulint           len;
814         ulint           limit;
815  
816 -       mutex_enter(&(buf_pool->mutex));
817 +       mutex_enter(&(buf_pool->LRU_mutex));
818  
819         len = UT_LIST_GET_LEN(buf_pool->LRU);
820  
821         if (len < BUF_LRU_OLD_MIN_LEN) {
822                 /* The LRU list is too short to do read-ahead */
823  
824 -               mutex_exit(&(buf_pool->mutex));
825 +               mutex_exit(&(buf_pool->LRU_mutex));
826  
827                 return(0);
828         }
829 @@ -186,7 +195,7 @@
830  
831         limit = block->LRU_position - len / BUF_LRU_INITIAL_RATIO;
832  
833 -       mutex_exit(&(buf_pool->mutex));
834 +       mutex_exit(&(buf_pool->LRU_mutex));
835  
836         return(limit);
837  }
838 @@ -210,13 +219,15 @@
839         ulint           distance = 0;
840         ibool           freed;
841  
842 -       mutex_enter(&(buf_pool->mutex));
843 +       /* optimistic search... */
844 +       //mutex_enter(&(buf_pool->LRU_mutex));
845         
846 +retry:
847         freed = FALSE;
848         block = UT_LIST_GET_LAST(buf_pool->LRU);
849  
850         while (block != NULL) {
851 -               ut_a(block->in_LRU_list);
852 +               //ut_a(block->in_LRU_list); /* optimistic */
853  
854                 mutex_enter(&block->mutex);
855  
856 @@ -231,9 +242,17 @@
857                         }
858  #endif /* UNIV_DEBUG */
859  
860 +                       mutex_exit(&block->mutex);
861 +
862 +                       mutex_enter(&(buf_pool->LRU_mutex));/* optimistic */
863 +
864 +                       rw_lock_x_lock(&(buf_pool->hash_latch));
865 +                       mutex_enter(&block->mutex);
866 +                       if(block->in_LRU_list && buf_flush_ready_for_replace(block)) {
867                         buf_LRU_block_remove_hashed_page(block);
868 +                       rw_lock_x_unlock(&(buf_pool->hash_latch));
869  
870 -                       mutex_exit(&(buf_pool->mutex));
871 +                       mutex_exit(&(buf_pool->LRU_mutex));
872                         mutex_exit(&block->mutex);
873  
874                         /* Remove possible adaptive hash index built on the
875 @@ -246,14 +265,25 @@
876  
877                         ut_a(block->buf_fix_count == 0);
878  
879 -                       mutex_enter(&(buf_pool->mutex));
880 +                       mutex_enter(&(buf_pool->free_mutex));
881                         mutex_enter(&block->mutex);
882  
883                         buf_LRU_block_free_hashed_page(block);
884                         freed = TRUE;
885 +                       mutex_exit(&(buf_pool->free_mutex));
886                         mutex_exit(&block->mutex);
887  
888                         break;
889 +                       } else { /* someone may interrupt...??? */
890 +                       mutex_exit(&(buf_pool->LRU_mutex));/* optimistic */
891 +
892 +                       rw_lock_x_unlock(&(buf_pool->hash_latch));
893 +
894 +                       if (!(block->in_LRU_list)) {
895 +                               mutex_exit(&block->mutex);
896 +                               goto retry;
897 +                       }
898 +                       }
899                 }
900  
901                 mutex_exit(&block->mutex);
902 @@ -264,13 +294,21 @@
903                 if (!freed && n_iterations <= 10
904                     && distance > 100 + (n_iterations * buf_pool->curr_size)
905                                         / 10) {
906 +
907 +                       mutex_enter(&(buf_pool->mutex));
908                         buf_pool->LRU_flush_ended = 0;
909 +                       mutex_exit(&(buf_pool->mutex));
910  
911 -                       mutex_exit(&(buf_pool->mutex));
912 +                       //mutex_exit(&(buf_pool->LRU_mutex));
913                         
914                         return(FALSE);
915                 }
916         }
917 +       if (!freed) {
918 +               //mutex_exit(&(buf_pool->LRU_mutex));
919 +       }
920 +
921 +       mutex_enter(&(buf_pool->mutex));
922         if (buf_pool->LRU_flush_ended > 0) {
923                 buf_pool->LRU_flush_ended--;
924         }
925 @@ -322,7 +360,8 @@
926  {
927         ibool   ret     = FALSE;
928  
929 -       mutex_enter(&(buf_pool->mutex));
930 +       mutex_enter(&(buf_pool->LRU_mutex));
931 +       mutex_enter(&(buf_pool->free_mutex));
932  
933         if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
934            + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 4) {
935 @@ -330,7 +369,8 @@
936                 ret = TRUE;
937         }
938  
939 -       mutex_exit(&(buf_pool->mutex));
940 +       mutex_exit(&(buf_pool->LRU_mutex));
941 +       mutex_exit(&(buf_pool->free_mutex));
942  
943         return(ret);
944  }
945 @@ -353,7 +393,7 @@
946         ibool           mon_value_was   = FALSE;
947         ibool           started_monitor = FALSE;
948  loop:
949 -       mutex_enter(&(buf_pool->mutex));
950 +       mutex_enter(&(buf_pool->free_mutex)); /* LRU info:optimistic */
951  
952         if (!recv_recovery_on && UT_LIST_GET_LEN(buf_pool->free)
953            + UT_LIST_GET_LEN(buf_pool->LRU) < buf_pool->max_size / 20) {
954 @@ -409,7 +449,7 @@
955         /* If there is a block in the free list, take it */
956         if (UT_LIST_GET_LEN(buf_pool->free) > 0) {
957                 
958 -               block = UT_LIST_GET_FIRST(buf_pool->free);
959 +               block = UT_LIST_GET_LAST(buf_pool->free);
960                 ut_a(block->in_free_list);
961                 UT_LIST_REMOVE(free, buf_pool->free, block);
962                 block->in_free_list = FALSE;
963 @@ -437,7 +477,7 @@
964  
965                 mutex_exit(&block->mutex);
966  
967 -               mutex_exit(&(buf_pool->mutex));
968 +               mutex_exit(&(buf_pool->free_mutex));
969  
970                 if (started_monitor) {
971                         srv_print_innodb_monitor = mon_value_was;
972 @@ -449,7 +489,7 @@
973         /* If no block was in the free list, search from the end of the LRU
974         list and try to free a block there */
975  
976 -       mutex_exit(&(buf_pool->mutex));
977 +       mutex_exit(&(buf_pool->free_mutex));
978  
979         freed = buf_LRU_search_and_free_block(n_iterations);
980  
981 @@ -486,7 +526,7 @@
982  
983         /* No free block was found: try to flush the LRU list */
984  
985 -       buf_flush_free_margin();
986 +       buf_flush_free_margin(TRUE);
987          ++srv_buf_pool_wait_free;
988  
989         os_aio_simulated_wake_handler_threads();
990 @@ -958,7 +998,7 @@
991         ulint           LRU_pos;
992         
993         ut_ad(buf_pool);
994 -       mutex_enter(&(buf_pool->mutex));
995 +       mutex_enter(&(buf_pool->LRU_mutex));
996  
997         if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
998  
999 @@ -1001,7 +1041,10 @@
1000  
1001         if (buf_pool->LRU_old) {
1002                 ut_a(buf_pool->LRU_old_len == old_len);
1003 -       } 
1004 +       }
1005 +
1006 +       mutex_exit(&(buf_pool->LRU_mutex));
1007 +       mutex_enter(&(buf_pool->free_mutex));
1008  
1009         UT_LIST_VALIDATE(free, buf_block_t, buf_pool->free);
1010  
1011 @@ -1013,7 +1056,7 @@
1012                 block = UT_LIST_GET_NEXT(free, block);
1013         }
1014  
1015 -       mutex_exit(&(buf_pool->mutex));
1016 +       mutex_exit(&(buf_pool->free_mutex));
1017         return(TRUE);
1018  }
1019  
1020 @@ -1029,7 +1072,7 @@
1021         ulint           len;
1022         
1023         ut_ad(buf_pool);
1024 -       mutex_enter(&(buf_pool->mutex));
1025 +       mutex_enter(&(buf_pool->LRU_mutex));
1026  
1027         fprintf(stderr, "Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock);
1028  
1029 @@ -1073,5 +1116,5 @@
1030                 }
1031         }
1032  
1033 -       mutex_exit(&(buf_pool->mutex));
1034 +       mutex_exit(&(buf_pool->LRU_mutex));
1035  }
1036 diff -r 2e0c46e78b50 innobase/buf/buf0rea.c
1037 --- a/innobase/buf/buf0rea.c    Mon Dec 22 00:33:53 2008 -0800
1038 +++ b/innobase/buf/buf0rea.c    Mon Dec 22 00:33:59 2008 -0800
1039 @@ -236,10 +236,12 @@
1040  
1041                 return(0);
1042         }       
1043 +       mutex_exit(&(buf_pool->mutex));
1044  
1045         /* Count how many blocks in the area have been recently accessed,
1046         that is, reside near the start of the LRU list. */
1047  
1048 +       rw_lock_s_lock(&(buf_pool->hash_latch));
1049         for (i = low; i < high; i++) {
1050                 block = buf_page_hash_get(space, i);
1051  
1052 @@ -250,8 +252,9 @@
1053                         recent_blocks++;
1054                 }
1055         }
1056 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
1057  
1058 -       mutex_exit(&(buf_pool->mutex));
1059 +       // mutex_exit(&(buf_pool->mutex));
1060         
1061         if (recent_blocks < BUF_READ_AHEAD_RANDOM_THRESHOLD) {
1062                 /* Do nothing */
1063 @@ -347,7 +350,7 @@
1064         }
1065  
1066         /* Flush pages from the end of the LRU list if necessary */
1067 -       buf_flush_free_margin();
1068 +       buf_flush_free_margin(FALSE);
1069  
1070         return(count + count2);
1071  }
1072 @@ -450,6 +453,7 @@
1073  
1074                 return(0);
1075         }       
1076 +       mutex_exit(&(buf_pool->mutex));
1077  
1078         /* Check that almost all pages in the area have been accessed; if
1079         offset == low, the accesses must be in a descending order, otherwise,
1080 @@ -463,6 +467,7 @@
1081  
1082         fail_count = 0;
1083  
1084 +       rw_lock_s_lock(&(buf_pool->hash_latch));
1085         for (i = low; i < high; i++) {
1086                 block = buf_page_hash_get(space, i);
1087                 
1088 @@ -479,12 +484,13 @@
1089                         pred_block = block;
1090                 }
1091         }
1092 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
1093  
1094         if (fail_count > BUF_READ_AHEAD_LINEAR_AREA -
1095                          BUF_READ_AHEAD_LINEAR_THRESHOLD) {
1096                 /* Too many failures: return */
1097  
1098 -               mutex_exit(&(buf_pool->mutex));
1099 +               //mutex_exit(&(buf_pool->mutex));
1100  
1101                 return(0);
1102         }
1103 @@ -492,10 +498,11 @@
1104         /* If we got this far, we know that enough pages in the area have
1105         been accessed in the right order: linear read-ahead can be sensible */
1106  
1107 +       rw_lock_s_lock(&(buf_pool->hash_latch));
1108         block = buf_page_hash_get(space, offset);
1109  
1110         if (block == NULL) {
1111 -               mutex_exit(&(buf_pool->mutex));
1112 +               rw_lock_s_unlock(&(buf_pool->hash_latch));
1113  
1114                 return(0);
1115         }
1116 @@ -511,7 +518,7 @@
1117         pred_offset = fil_page_get_prev(frame);
1118         succ_offset = fil_page_get_next(frame);
1119  
1120 -       mutex_exit(&(buf_pool->mutex));
1121 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
1122         
1123         if ((offset == low) && (succ_offset == offset + 1)) {
1124  
1125 @@ -587,7 +594,7 @@
1126         os_aio_simulated_wake_handler_threads();
1127  
1128         /* Flush pages from the end of the LRU list if necessary */
1129 -       buf_flush_free_margin();
1130 +       buf_flush_free_margin(FALSE);
1131  
1132  #ifdef UNIV_DEBUG
1133         if (buf_debug_prints && (count > 0)) {
1134 @@ -655,7 +662,7 @@
1135         os_aio_simulated_wake_handler_threads();
1136  
1137         /* Flush pages from the end of the LRU list if necessary */
1138 -       buf_flush_free_margin();
1139 +       buf_flush_free_margin(FALSE);
1140  
1141  #ifdef UNIV_DEBUG
1142         if (buf_debug_prints) {
1143 @@ -727,7 +734,7 @@
1144         os_aio_simulated_wake_handler_threads();
1145  
1146         /* Flush pages from the end of the LRU list if necessary */
1147 -       buf_flush_free_margin();
1148 +       buf_flush_free_margin(FALSE);
1149  
1150  #ifdef UNIV_DEBUG
1151         if (buf_debug_prints) {
1152 diff -r 2e0c46e78b50 innobase/include/buf0buf.h
1153 --- a/innobase/include/buf0buf.h        Mon Dec 22 00:33:53 2008 -0800
1154 +++ b/innobase/include/buf0buf.h        Mon Dec 22 00:33:59 2008 -0800
1155 @@ -946,6 +946,7 @@
1156         mem_heap_t*     io_counter_heap;
1157         ulint           io_counters;
1158         hash_table_t*   page_hash;      /* hash table of the file pages */
1159 +       rw_lock_t       hash_latch;
1160  
1161         ulint           n_pend_reads;   /* number of pending read operations */
1162  
1163 @@ -978,6 +979,7 @@
1164         UT_LIST_BASE_NODE_T(buf_block_t) flush_list;
1165                                         /* base node of the modified block
1166                                         list */
1167 +       mutex_t         flush_list_mutex;
1168         ibool           init_flush[BUF_FLUSH_LIST + 1];
1169                                         /* this is TRUE when a flush of the
1170                                         given type is being initialized */
1171 @@ -1011,8 +1013,10 @@
1172                                         in the case of AWE, at the start are
1173                                         always free blocks for which the
1174                                         physical memory is mapped to a frame */
1175 +       mutex_t         free_mutex;
1176         UT_LIST_BASE_NODE_T(buf_block_t) LRU;
1177                                         /* base node of the LRU list */
1178 +       mutex_t         LRU_mutex;
1179         buf_block_t*    LRU_old;        /* pointer to the about 3/8 oldest
1180                                         blocks in the LRU list; NULL if LRU
1181                                         length less than BUF_LRU_OLD_MIN_LEN */
1182 diff -r 2e0c46e78b50 innobase/include/buf0buf.ic
1183 --- a/innobase/include/buf0buf.ic       Mon Dec 22 00:33:53 2008 -0800
1184 +++ b/innobase/include/buf0buf.ic       Mon Dec 22 00:33:59 2008 -0800
1185 @@ -112,7 +112,7 @@
1186         buf_block_t*    block;
1187         dulint          lsn;
1188         
1189 -       mutex_enter(&(buf_pool->mutex));
1190 +       mutex_enter(&(buf_pool->flush_list_mutex));
1191  
1192         block = UT_LIST_GET_LAST(buf_pool->flush_list);
1193  
1194 @@ -122,7 +122,7 @@
1195                 lsn = block->oldest_modification;
1196         }
1197  
1198 -       mutex_exit(&(buf_pool->mutex));
1199 +       mutex_exit(&(buf_pool->flush_list_mutex));
1200  
1201         return(lsn);
1202  }
1203 @@ -392,18 +392,18 @@
1204                                 /* out: TRUE if io going on */
1205         buf_block_t*    block)  /* in: buf_pool block, must be bufferfixed */
1206  {
1207 -       mutex_enter(&(buf_pool->mutex));
1208 +       mutex_enter(&block->mutex);
1209  
1210         ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
1211         ut_ad(block->buf_fix_count > 0);
1212  
1213         if (block->io_fix != 0) {
1214 -               mutex_exit(&(buf_pool->mutex));
1215 +               mutex_exit(&block->mutex);
1216  
1217                 return(TRUE);
1218         }
1219  
1220 -       mutex_exit(&(buf_pool->mutex));
1221 +       mutex_exit(&block->mutex);
1222  
1223         return(FALSE);
1224  }
1225 @@ -425,7 +425,7 @@
1226  
1227         block = buf_block_align(frame);
1228  
1229 -       mutex_enter(&(buf_pool->mutex));
1230 +       mutex_enter(&block->mutex);
1231  
1232         if (block->state == BUF_BLOCK_FILE_PAGE) {
1233                 lsn = block->newest_modification;
1234 @@ -433,7 +433,7 @@
1235                 lsn = ut_dulint_zero;
1236         }
1237  
1238 -       mutex_exit(&(buf_pool->mutex));
1239 +       mutex_exit(&block->mutex);
1240  
1241         return(lsn);
1242  }
1243 @@ -632,9 +632,9 @@
1244         ut_a(block->state == BUF_BLOCK_FILE_PAGE);
1245  
1246         if (rw_latch == RW_X_LATCH && mtr->modifications) {
1247 -               mutex_enter(&buf_pool->mutex);
1248 +               mutex_enter(&buf_pool->flush_list_mutex);
1249                 buf_flush_note_modification(block, mtr);
1250 -               mutex_exit(&buf_pool->mutex);
1251 +               mutex_exit(&buf_pool->flush_list_mutex);
1252         }
1253  
1254         mutex_enter(&block->mutex);
1255 diff -r 2e0c46e78b50 innobase/include/buf0flu.h
1256 --- a/innobase/include/buf0flu.h        Mon Dec 22 00:33:53 2008 -0800
1257 +++ b/innobase/include/buf0flu.h        Mon Dec 22 00:33:59 2008 -0800
1258 @@ -26,8 +26,9 @@
1259  a margin of replaceable pages there. */
1260  
1261  void
1262 -buf_flush_free_margin(void);
1263 +buf_flush_free_margin(
1264  /*=======================*/
1265 +       ibool   wait);
1266  /************************************************************************
1267  Initializes a page for writing to the tablespace. */
1268  
1269 diff -r 2e0c46e78b50 innobase/include/buf0flu.ic
1270 --- a/innobase/include/buf0flu.ic       Mon Dec 22 00:33:53 2008 -0800
1271 +++ b/innobase/include/buf0flu.ic       Mon Dec 22 00:33:59 2008 -0800
1272 @@ -84,7 +84,7 @@
1273         ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
1274  #endif /* UNIV_SYNC_DEBUG */
1275  
1276 -       mutex_enter(&(buf_pool->mutex));
1277 +       mutex_enter(&(buf_pool->flush_list_mutex));
1278         
1279         ut_ad(ut_dulint_cmp(block->newest_modification, end_lsn) <= 0);
1280         
1281 @@ -102,5 +102,5 @@
1282                                                         start_lsn) <= 0);
1283         }
1284  
1285 -       mutex_exit(&(buf_pool->mutex));
1286 +       mutex_exit(&(buf_pool->flush_list_mutex));
1287  }
1288 diff -r 2e0c46e78b50 innobase/log/log0recv.c
1289 --- a/innobase/log/log0recv.c   Mon Dec 22 00:33:53 2008 -0800
1290 +++ b/innobase/log/log0recv.c   Mon Dec 22 00:33:59 2008 -0800
1291 @@ -1693,11 +1693,11 @@
1292  
1293         mtr_start(&mtr);
1294  
1295 -       mutex_enter(&(buf_pool->mutex));
1296 +       rw_lock_s_lock(&(buf_pool->hash_latch));
1297  
1298         page = buf_page_hash_get(space, page_no)->frame;
1299  
1300 -       mutex_exit(&(buf_pool->mutex));
1301 +       rw_lock_s_unlock(&(buf_pool->hash_latch));
1302  
1303         replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
1304                                                         RW_X_LATCH, &mtr);
1305 diff -r 2e0c46e78b50 patch_info/split_buf_pool_mutex_fixed_optimistic_safe.info
1306 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
1307 +++ b/patch_info/split_buf_pool_mutex_fixed_optimistic_safe.info        Mon Dec 22 00:33:59 2008 -0800
1308 @@ -0,0 +1,6 @@
1309 +File=split_buf_pool_mutex_fixed_optimistic_safe.patch
1310 +Name=InnoDB patch to fix buffer pool scalability
1311 +Version=1.0
1312 +Author=Yasufumi Kinoshita
1313 +License=BSD
1314 +Comment=
This page took 0.20461 seconds and 3 git commands to generate.