Lines Matching defs:pool

47 	SVC_POOL_GLOBAL,	/* no mapping, just a single global pool
49 SVC_POOL_PERCPU, /* one pool per cpu */
50 SVC_POOL_PERNODE /* one pool per numa node */
64 unsigned int *pool_to; /* maps pool id to cpu or node */
65 unsigned int *to_pool; /* maps cpu or node to pool id */
128 * Detect best pool mapping mode heuristically,
155 /* default: one global pool */
183 * Initialise the pool map for SVC_POOL_PERCPU mode.
211 * Initialise the pool map for SVC_POOL_PERNODE mode.
291 * freed; this allows the sysadmin to change the pool
329 * will only run on cpus in the given pool.
360 * svc_pool_for_cpu - Select pool to run a thread on this cpu
364 * select the svc thread pool to use. Once initialized, the
506 struct svc_pool *pool = &serv->sv_pools[i];
508 dprintk("svc: initialising pool %u for %s\n",
511 pool->sp_id = i;
512 INIT_LIST_HEAD(&pool->sp_sockets);
513 INIT_LIST_HEAD(&pool->sp_all_threads);
514 spin_lock_init(&pool->sp_lock);
516 percpu_counter_init(&pool->sp_messages_arrived, 0, GFP_KERNEL);
517 percpu_counter_init(&pool->sp_sockets_queued, 0, GFP_KERNEL);
518 percpu_counter_init(&pool->sp_threads_woken, 0, GFP_KERNEL);
589 struct svc_pool *pool = &serv->sv_pools[i];
591 percpu_counter_destroy(&pool->sp_messages_arrived);
592 percpu_counter_destroy(&pool->sp_sockets_queued);
593 percpu_counter_destroy(&pool->sp_threads_woken);
635 svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
647 rqstp->rq_pool = pool;
672 svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node)
676 rqstp = svc_rqst_alloc(serv, pool, node);
685 spin_lock_bh(&pool->sp_lock);
686 pool->sp_nrthreads++;
687 list_add_rcu(&rqstp->rq_all, &pool->sp_all_threads);
688 spin_unlock_bh(&pool->sp_lock);
693 * svc_pool_wake_idle_thread - Awaken an idle thread in @pool
694 * @pool: service thread pool
701 void svc_pool_wake_idle_thread(struct svc_pool *pool)
706 list_for_each_entry_rcu(rqstp, &pool->sp_all_threads, rq_all) {
713 percpu_counter_inc(&pool->sp_threads_woken);
719 set_bit(SP_CONGESTED, &pool->sp_flags);
723 svc_pool_next(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state)
725 return pool ? pool : &serv->sv_pools[(*state)++ % serv->sv_nrpools];
729 svc_pool_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state)
734 if (pool != NULL) {
735 spin_lock_bh(&pool->sp_lock);
738 pool = &serv->sv_pools[--(*state) % serv->sv_nrpools];
739 spin_lock_bh(&pool->sp_lock);
740 if (!list_empty(&pool->sp_all_threads))
742 spin_unlock_bh(&pool->sp_lock);
748 if (!list_empty(&pool->sp_all_threads)) {
751 rqstp = list_entry(pool->sp_all_threads.next, struct svc_rqst, rq_all);
756 spin_unlock_bh(&pool->sp_lock);
761 svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
771 chosen_pool = svc_pool_next(serv, pool, &state);
796 svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
803 task = svc_pool_victim(serv, pool, &state);
818 * @pool: Specific pool from which to choose threads, or NULL
822 * given number. If @pool is non-NULL, change only threads in that pool;
833 svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
835 if (pool == NULL) {
838 spin_lock_bh(&pool->sp_lock);
839 nrservs -= pool->sp_nrthreads;
840 spin_unlock_bh(&pool->sp_lock);
844 return svc_start_kthreads(serv, pool, nrservs);
846 return svc_stop_kthreads(serv, pool, nrservs);
925 struct svc_pool *pool = rqstp->rq_pool;
927 spin_lock_bh(&pool->sp_lock);
928 pool->sp_nrthreads--;
931 spin_unlock_bh(&pool->sp_lock);