diff options
author | Dmitry Kozlov <xeb@mail.ru> | 2011-01-26 00:50:30 +0300 |
---|---|---|
committer | Dmitry Kozlov <xeb@mail.ru> | 2011-01-26 00:50:30 +0300 |
commit | 64b0cc8703122437fb46e890ea0c0b4fda1d77da (patch) | |
tree | c6a29f38bb442474ab8af80894cfce0b499fc023 /accel-pppd/triton/triton.c | |
parent | 2742af0f2760b7b8d326aa4112aac14b453e3bbb (diff) | |
download | accel-ppp-64b0cc8703122437fb46e890ea0c0b4fda1d77da.tar.gz accel-ppp-64b0cc8703122437fb46e890ea0c0b4fda1d77da.zip |
futher memory usage optimization
Diffstat (limited to 'accel-pppd/triton/triton.c')
-rw-r--r-- | accel-pppd/triton/triton.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/accel-pppd/triton/triton.c b/accel-pppd/triton/triton.c index 00dfcf6..9236a00 100644 --- a/accel-pppd/triton/triton.c +++ b/accel-pppd/triton/triton.c @@ -90,7 +90,7 @@ static void* triton_thread(struct _triton_thread_t *thread) while (1) { spin_lock(&threads_lock); - if (!list_empty(&ctx_queue) && !need_config_reload) { + if (!list_empty(&ctx_queue) && !need_config_reload && triton_stat.thread_active <= thread_count) { thread->ctx = list_entry(ctx_queue.next, typeof(*thread->ctx), entry2); log_debug2("thread: %p: dequeued ctx %p\n", thread, thread->ctx); list_del(&thread->ctx->entry2); @@ -252,7 +252,7 @@ int triton_queue_ctx(struct _triton_context_t *ctx) return 0; spin_lock(&threads_lock); - if (list_empty(&sleep_threads) || need_config_reload) { + if (list_empty(&sleep_threads) || need_config_reload || triton_stat.thread_active > thread_count) { if (ctx->priority) list_add(&ctx->entry2, &ctx_queue); else @@ -513,7 +513,7 @@ static void ru_update(struct triton_timer_t *t) int __export triton_init(const char *conf_file) { - ctx_pool = mempool_create2(sizeof(struct _triton_context_t)); + ctx_pool = mempool_create(sizeof(struct _triton_context_t)); call_pool = mempool_create(sizeof(struct _triton_ctx_call_t)); if (conf_load(conf_file)) |