]> git.pld-linux.org Git - packages/mysql.git/blob - mysql-split_buf_pool_mutex_fixed_optimistic_safe.patch
- mysql 5.0.75 by Eero Hänninen
[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 +       mutex_create(&(buf_pool->hash_mutex));
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 +       mutex_set_level(&(buf_pool->hash_mutex), 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 +       mutex_enter(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter_fast(&(buf_pool->hash_mutex));
92  
93         block = buf_page_hash_get(space, offset);
94  
95 -       mutex_exit(&(buf_pool->mutex));
96 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter_fast(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter_fast(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter_fast(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter_fast(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +               mutex_enter_fast(&(buf_pool->hash_mutex));
193                 block = buf_page_hash_get(space, offset);
194 +               if(block) {
195 +                       mutex_enter(&block->mutex);
196 +               }
197 +               mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter(&(buf_pool->hash_mutex));
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 +               mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter(&(buf_pool->hash_mutex));
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 +               mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter(&(buf_pool->hash_mutex));
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 +               mutex_exit(&(buf_pool->hash_mutex));
616                 return(0);
617         }
618  
619         mutex_enter(&block->mutex);
620 +       mutex_enter(&(buf_pool->mutex));
621 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter(&(buf_pool->hash_mutex));
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 +                               mutex_exit(&(buf_pool->hash_mutex));
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 +                               mutex_enter(&(buf_pool->hash_mutex));
649                         } else {
650                                 mutex_exit(&block->mutex);
651                         }
652                 }
653         }
654                                 
655 -       mutex_exit(&(buf_pool->mutex));
656 +       mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_enter(&(buf_pool->hash_mutex));
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 +                               mutex_exit(&(buf_pool->hash_mutex));
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 +       mutex_exit(&(buf_pool->hash_mutex));
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 +                       mutex_enter(&(buf_pool->hash_mutex));
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 +                       mutex_exit(&(buf_pool->hash_mutex));
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 +                       mutex_exit(&(buf_pool->hash_mutex));
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 @@ -437,7 +477,7 @@
955  
956                 mutex_exit(&block->mutex);
957  
958 -               mutex_exit(&(buf_pool->mutex));
959 +               mutex_exit(&(buf_pool->free_mutex));
960  
961                 if (started_monitor) {
962                         srv_print_innodb_monitor = mon_value_was;
963 @@ -449,7 +489,7 @@
964         /* If no block was in the free list, search from the end of the LRU
965         list and try to free a block there */
966  
967 -       mutex_exit(&(buf_pool->mutex));
968 +       mutex_exit(&(buf_pool->free_mutex));
969  
970         freed = buf_LRU_search_and_free_block(n_iterations);
971  
972 @@ -486,7 +526,7 @@
973  
974         /* No free block was found: try to flush the LRU list */
975  
976 -       buf_flush_free_margin();
977 +       buf_flush_free_margin(TRUE);
978          ++srv_buf_pool_wait_free;
979  
980         os_aio_simulated_wake_handler_threads();
981 @@ -958,7 +998,7 @@
982         ulint           LRU_pos;
983         
984         ut_ad(buf_pool);
985 -       mutex_enter(&(buf_pool->mutex));
986 +       mutex_enter(&(buf_pool->LRU_mutex));
987  
988         if (UT_LIST_GET_LEN(buf_pool->LRU) >= BUF_LRU_OLD_MIN_LEN) {
989  
990 @@ -1001,7 +1041,10 @@
991  
992         if (buf_pool->LRU_old) {
993                 ut_a(buf_pool->LRU_old_len == old_len);
994 -       } 
995 +       }
996 +
997 +       mutex_exit(&(buf_pool->LRU_mutex));
998 +       mutex_enter(&(buf_pool->free_mutex));
999  
1000         UT_LIST_VALIDATE(free, buf_block_t, buf_pool->free);
1001  
1002 @@ -1013,7 +1056,7 @@
1003                 block = UT_LIST_GET_NEXT(free, block);
1004         }
1005  
1006 -       mutex_exit(&(buf_pool->mutex));
1007 +       mutex_exit(&(buf_pool->free_mutex));
1008         return(TRUE);
1009  }
1010  
1011 @@ -1029,7 +1072,7 @@
1012         ulint           len;
1013         
1014         ut_ad(buf_pool);
1015 -       mutex_enter(&(buf_pool->mutex));
1016 +       mutex_enter(&(buf_pool->LRU_mutex));
1017  
1018         fprintf(stderr, "Pool ulint clock %lu\n", (ulong) buf_pool->ulint_clock);
1019  
1020 @@ -1073,5 +1116,5 @@
1021                 }
1022         }
1023  
1024 -       mutex_exit(&(buf_pool->mutex));
1025 +       mutex_exit(&(buf_pool->LRU_mutex));
1026  }
1027 diff -r 2e0c46e78b50 innobase/buf/buf0rea.c
1028 --- a/innobase/buf/buf0rea.c    Mon Dec 22 00:33:53 2008 -0800
1029 +++ b/innobase/buf/buf0rea.c    Mon Dec 22 00:33:59 2008 -0800
1030 @@ -236,10 +236,12 @@
1031  
1032                 return(0);
1033         }       
1034 +       mutex_exit(&(buf_pool->mutex));
1035  
1036         /* Count how many blocks in the area have been recently accessed,
1037         that is, reside near the start of the LRU list. */
1038  
1039 +       mutex_enter(&(buf_pool->hash_mutex));
1040         for (i = low; i < high; i++) {
1041                 block = buf_page_hash_get(space, i);
1042  
1043 @@ -250,8 +252,9 @@
1044                         recent_blocks++;
1045                 }
1046         }
1047 +       mutex_exit(&(buf_pool->hash_mutex));
1048  
1049 -       mutex_exit(&(buf_pool->mutex));
1050 +       // mutex_exit(&(buf_pool->mutex));
1051         
1052         if (recent_blocks < BUF_READ_AHEAD_RANDOM_THRESHOLD) {
1053                 /* Do nothing */
1054 @@ -347,7 +350,7 @@
1055         }
1056  
1057         /* Flush pages from the end of the LRU list if necessary */
1058 -       buf_flush_free_margin();
1059 +       buf_flush_free_margin(FALSE);
1060  
1061         return(count + count2);
1062  }
1063 @@ -450,6 +453,7 @@
1064  
1065                 return(0);
1066         }       
1067 +       mutex_exit(&(buf_pool->mutex));
1068  
1069         /* Check that almost all pages in the area have been accessed; if
1070         offset == low, the accesses must be in a descending order, otherwise,
1071 @@ -463,6 +467,7 @@
1072  
1073         fail_count = 0;
1074  
1075 +       mutex_enter(&(buf_pool->hash_mutex));
1076         for (i = low; i < high; i++) {
1077                 block = buf_page_hash_get(space, i);
1078                 
1079 @@ -479,12 +484,13 @@
1080                         pred_block = block;
1081                 }
1082         }
1083 +       mutex_exit(&(buf_pool->hash_mutex));
1084  
1085         if (fail_count > BUF_READ_AHEAD_LINEAR_AREA -
1086                          BUF_READ_AHEAD_LINEAR_THRESHOLD) {
1087                 /* Too many failures: return */
1088  
1089 -               mutex_exit(&(buf_pool->mutex));
1090 +               //mutex_exit(&(buf_pool->mutex));
1091  
1092                 return(0);
1093         }
1094 @@ -492,10 +498,11 @@
1095         /* If we got this far, we know that enough pages in the area have
1096         been accessed in the right order: linear read-ahead can be sensible */
1097  
1098 +       mutex_enter(&(buf_pool->hash_mutex));
1099         block = buf_page_hash_get(space, offset);
1100  
1101         if (block == NULL) {
1102 -               mutex_exit(&(buf_pool->mutex));
1103 +               mutex_exit(&(buf_pool->hash_mutex));
1104  
1105                 return(0);
1106         }
1107 @@ -511,7 +518,7 @@
1108         pred_offset = fil_page_get_prev(frame);
1109         succ_offset = fil_page_get_next(frame);
1110  
1111 -       mutex_exit(&(buf_pool->mutex));
1112 +       mutex_exit(&(buf_pool->hash_mutex));
1113         
1114         if ((offset == low) && (succ_offset == offset + 1)) {
1115  
1116 @@ -587,7 +594,7 @@
1117         os_aio_simulated_wake_handler_threads();
1118  
1119         /* Flush pages from the end of the LRU list if necessary */
1120 -       buf_flush_free_margin();
1121 +       buf_flush_free_margin(FALSE);
1122  
1123  #ifdef UNIV_DEBUG
1124         if (buf_debug_prints && (count > 0)) {
1125 @@ -655,7 +662,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) {
1134 @@ -727,7 +734,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 diff -r 2e0c46e78b50 innobase/include/buf0buf.h
1144 --- a/innobase/include/buf0buf.h        Mon Dec 22 00:33:53 2008 -0800
1145 +++ b/innobase/include/buf0buf.h        Mon Dec 22 00:33:59 2008 -0800
1146 @@ -946,6 +946,7 @@
1147         mem_heap_t*     io_counter_heap;
1148         ulint           io_counters;
1149         hash_table_t*   page_hash;      /* hash table of the file pages */
1150 +       mutex_t         hash_mutex;
1151  
1152         ulint           n_pend_reads;   /* number of pending read operations */
1153  
1154 @@ -978,6 +979,7 @@
1155         UT_LIST_BASE_NODE_T(buf_block_t) flush_list;
1156                                         /* base node of the modified block
1157                                         list */
1158 +       mutex_t         flush_list_mutex;
1159         ibool           init_flush[BUF_FLUSH_LIST + 1];
1160                                         /* this is TRUE when a flush of the
1161                                         given type is being initialized */
1162 @@ -1011,8 +1013,10 @@
1163                                         in the case of AWE, at the start are
1164                                         always free blocks for which the
1165                                         physical memory is mapped to a frame */
1166 +       mutex_t         free_mutex;
1167         UT_LIST_BASE_NODE_T(buf_block_t) LRU;
1168                                         /* base node of the LRU list */
1169 +       mutex_t         LRU_mutex;
1170         buf_block_t*    LRU_old;        /* pointer to the about 3/8 oldest
1171                                         blocks in the LRU list; NULL if LRU
1172                                         length less than BUF_LRU_OLD_MIN_LEN */
1173 diff -r 2e0c46e78b50 innobase/include/buf0buf.ic
1174 --- a/innobase/include/buf0buf.ic       Mon Dec 22 00:33:53 2008 -0800
1175 +++ b/innobase/include/buf0buf.ic       Mon Dec 22 00:33:59 2008 -0800
1176 @@ -112,7 +112,7 @@
1177         buf_block_t*    block;
1178         dulint          lsn;
1179         
1180 -       mutex_enter(&(buf_pool->mutex));
1181 +       mutex_enter(&(buf_pool->flush_list_mutex));
1182  
1183         block = UT_LIST_GET_LAST(buf_pool->flush_list);
1184  
1185 @@ -122,7 +122,7 @@
1186                 lsn = block->oldest_modification;
1187         }
1188  
1189 -       mutex_exit(&(buf_pool->mutex));
1190 +       mutex_exit(&(buf_pool->flush_list_mutex));
1191  
1192         return(lsn);
1193  }
1194 @@ -392,18 +392,18 @@
1195                                 /* out: TRUE if io going on */
1196         buf_block_t*    block)  /* in: buf_pool block, must be bufferfixed */
1197  {
1198 -       mutex_enter(&(buf_pool->mutex));
1199 +       mutex_enter(&block->mutex);
1200  
1201         ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
1202         ut_ad(block->buf_fix_count > 0);
1203  
1204         if (block->io_fix != 0) {
1205 -               mutex_exit(&(buf_pool->mutex));
1206 +               mutex_exit(&block->mutex);
1207  
1208                 return(TRUE);
1209         }
1210  
1211 -       mutex_exit(&(buf_pool->mutex));
1212 +       mutex_exit(&block->mutex);
1213  
1214         return(FALSE);
1215  }
1216 @@ -425,7 +425,7 @@
1217  
1218         block = buf_block_align(frame);
1219  
1220 -       mutex_enter(&(buf_pool->mutex));
1221 +       mutex_enter(&block->mutex);
1222  
1223         if (block->state == BUF_BLOCK_FILE_PAGE) {
1224                 lsn = block->newest_modification;
1225 @@ -433,7 +433,7 @@
1226                 lsn = ut_dulint_zero;
1227         }
1228  
1229 -       mutex_exit(&(buf_pool->mutex));
1230 +       mutex_exit(&block->mutex);
1231  
1232         return(lsn);
1233  }
1234 @@ -632,9 +632,9 @@
1235         ut_a(block->state == BUF_BLOCK_FILE_PAGE);
1236  
1237         if (rw_latch == RW_X_LATCH && mtr->modifications) {
1238 -               mutex_enter(&buf_pool->mutex);
1239 +               mutex_enter(&buf_pool->flush_list_mutex);
1240                 buf_flush_note_modification(block, mtr);
1241 -               mutex_exit(&buf_pool->mutex);
1242 +               mutex_exit(&buf_pool->flush_list_mutex);
1243         }
1244  
1245         mutex_enter(&block->mutex);
1246 diff -r 2e0c46e78b50 innobase/include/buf0flu.h
1247 --- a/innobase/include/buf0flu.h        Mon Dec 22 00:33:53 2008 -0800
1248 +++ b/innobase/include/buf0flu.h        Mon Dec 22 00:33:59 2008 -0800
1249 @@ -26,8 +26,9 @@
1250  a margin of replaceable pages there. */
1251  
1252  void
1253 -buf_flush_free_margin(void);
1254 +buf_flush_free_margin(
1255  /*=======================*/
1256 +       ibool   wait);
1257  /************************************************************************
1258  Initializes a page for writing to the tablespace. */
1259  
1260 diff -r 2e0c46e78b50 innobase/include/buf0flu.ic
1261 --- a/innobase/include/buf0flu.ic       Mon Dec 22 00:33:53 2008 -0800
1262 +++ b/innobase/include/buf0flu.ic       Mon Dec 22 00:33:59 2008 -0800
1263 @@ -84,7 +84,7 @@
1264         ut_ad(rw_lock_own(&(block->lock), RW_LOCK_EX));
1265  #endif /* UNIV_SYNC_DEBUG */
1266  
1267 -       mutex_enter(&(buf_pool->mutex));
1268 +       mutex_enter(&(buf_pool->flush_list_mutex));
1269         
1270         ut_ad(ut_dulint_cmp(block->newest_modification, end_lsn) <= 0);
1271         
1272 @@ -102,5 +102,5 @@
1273                                                         start_lsn) <= 0);
1274         }
1275  
1276 -       mutex_exit(&(buf_pool->mutex));
1277 +       mutex_exit(&(buf_pool->flush_list_mutex));
1278  }
1279 diff -r 2e0c46e78b50 innobase/log/log0recv.c
1280 --- a/innobase/log/log0recv.c   Mon Dec 22 00:33:53 2008 -0800
1281 +++ b/innobase/log/log0recv.c   Mon Dec 22 00:33:59 2008 -0800
1282 @@ -1693,11 +1693,11 @@
1283  
1284         mtr_start(&mtr);
1285  
1286 -       mutex_enter(&(buf_pool->mutex));
1287 +       mutex_enter(&(buf_pool->hash_mutex));
1288  
1289         page = buf_page_hash_get(space, page_no)->frame;
1290  
1291 -       mutex_exit(&(buf_pool->mutex));
1292 +       mutex_exit(&(buf_pool->hash_mutex));
1293  
1294         replica = buf_page_get(space + RECV_REPLICA_SPACE_ADD, page_no,
1295                                                         RW_X_LATCH, &mtr);
1296 diff -r 2e0c46e78b50 patch_info/split_buf_pool_mutex_fixed_optimistic_safe.info
1297 --- /dev/null   Thu Jan 01 00:00:00 1970 +0000
1298 +++ b/patch_info/split_buf_pool_mutex_fixed_optimistic_safe.info        Mon Dec 22 00:33:59 2008 -0800
1299 @@ -0,0 +1,6 @@
1300 +File=split_buf_pool_mutex_fixed_optimistic_safe.patch
1301 +Name=InnoDB patch to fix buffer pool scalability
1302 +Version=1.0
1303 +Author=Yasufumi Kinoshita
1304 +License=BSD
1305 +Comment=
This page took 0.154561 seconds and 4 git commands to generate.