From 6713bb090d81a6e2b48ecf0fb28b85e0d3ae1ee1 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 17 Oct 2003 20:31:17 +0300 Subject: thr0loc.c, srv0start.c, srv0srv.c, srv0srv.h, os0thread.h: Reduce InnoDB memory allocation if buffer pool < 8 MB innobase/include/os0thread.h: Reduce InnoDB memory allocation if buffer pool < 8 MB innobase/include/srv0srv.h: Reduce InnoDB memory allocation if buffer pool < 8 MB innobase/srv/srv0srv.c: Reduce InnoDB memory allocation if buffer pool < 8 MB innobase/srv/srv0start.c: Reduce InnoDB memory allocation if buffer pool < 8 MB innobase/thr/thr0loc.c: Reduce InnoDB memory allocation if buffer pool < 8 MB --- innobase/srv/srv0srv.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'innobase/srv/srv0srv.c') diff --git a/innobase/srv/srv0srv.c b/innobase/srv/srv0srv.c index e16073c171c..2f3502f99ad 100644 --- a/innobase/srv/srv0srv.c +++ b/innobase/srv/srv0srv.c @@ -180,6 +180,12 @@ the user from forgetting the innodb_force_recovery keyword to my.cnf */ ulint srv_force_recovery = 0; /*-----------------------*/ +/* We are prepared for a situation that we have this many threads waiting for +a semaphore inside InnoDB. innobase_start_or_create_for_mysql() sets the +value. */ + +ulint srv_max_n_threads = 0; + /* The following controls how many threads we let inside InnoDB concurrently: threads waiting for locks are not counted into the number because otherwise we could get a deadlock. MySQL creates a thread for each user session, and @@ -219,7 +225,7 @@ struct srv_conc_slot_struct{ UT_LIST_BASE_NODE_T(srv_conc_slot_t) srv_conc_queue; /* queue of threads waiting to get in */ -srv_conc_slot_t srv_conc_slots[OS_THREAD_MAX_N]; /* array of wait +srv_conc_slot_t* srv_conc_slots; /* array of wait slots */ /* Number of times a thread is allowed to enter InnoDB within the same @@ -1712,6 +1718,8 @@ srv_init(void) UT_LIST_INIT(srv_conc_queue); + srv_conc_slots = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_conc_slot_t)); + for (i = 0; i < OS_THREAD_MAX_N; i++) { conc_slot = srv_conc_slots + i; conc_slot->reserved = FALSE; @@ -1758,7 +1766,7 @@ srv_conc_enter_innodb( thread */ { ibool has_slept = FALSE; - srv_conc_slot_t* slot; + srv_conc_slot_t* slot = NULL; ulint i; char err_buf[1000]; @@ -1835,6 +1843,7 @@ retry: slot = srv_conc_slots + i; if (!slot->reserved) { + break; } } -- cgit v1.2.1