Lines Matching defs:pool

107  * Detect best pool mapping mode heuristically,
134 /* default: one global pool */
162 * Initialise the pool map for SVC_POOL_PERCPU mode.
190 * Initialise the pool map for SVC_POOL_PERNODE mode.
263 * freed; this allows the sysadmin to change the pool
300 * will only run on cpus in the given pool.
331 * Use the mapping mode to choose a pool for a given CPU.
333 * a non-NULL pool pointer.
474 struct svc_pool *pool = &serv->sv_pools[i];
476 dprintk("svc: initialising pool %u for %s\n",
479 pool->sp_id = i;
480 INIT_LIST_HEAD(&pool->sp_sockets);
481 INIT_LIST_HEAD(&pool->sp_all_threads);
482 spin_lock_init(&pool->sp_lock);
604 svc_rqst_alloc(struct svc_serv *serv, struct svc_pool *pool, int node)
615 rqstp->rq_pool = pool;
636 svc_prepare_thread(struct svc_serv *serv, struct svc_pool *pool, int node)
640 rqstp = svc_rqst_alloc(serv, pool, node);
645 spin_lock_bh(&pool->sp_lock);
646 pool->sp_nrthreads++;
647 list_add_rcu(&rqstp->rq_all, &pool->sp_all_threads);
648 spin_unlock_bh(&pool->sp_lock);
654 * Choose a pool in which to create a new thread, for svc_set_num_threads
657 choose_pool(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state)
659 if (pool != NULL)
660 return pool;
669 choose_victim(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state)
674 if (pool != NULL) {
675 spin_lock_bh(&pool->sp_lock);
677 /* choose a pool in round-robin fashion */
679 pool = &serv->sv_pools[--(*state) % serv->sv_nrpools];
680 spin_lock_bh(&pool->sp_lock);
681 if (!list_empty(&pool->sp_all_threads))
683 spin_unlock_bh(&pool->sp_lock);
689 if (!list_empty(&pool->sp_all_threads)) {
693 * Remove from the pool->sp_all_threads list
696 rqstp = list_entry(pool->sp_all_threads.next, struct svc_rqst, rq_all);
701 spin_unlock_bh(&pool->sp_lock);
708 svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
718 chosen_pool = choose_pool(serv, pool, &state);
748 svc_signal_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
755 task = choose_victim(serv, pool, &state);
767 * of threads the given number. If `pool' is non-NULL, applies
768 * only to threads in that pool, otherwise round-robins between
777 * to be pool-aware.
780 svc_set_num_threads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
782 if (pool == NULL) {
786 spin_lock_bh(&pool->sp_lock);
787 nrservs -= pool->sp_nrthreads;
788 spin_unlock_bh(&pool->sp_lock);
792 return svc_start_kthreads(serv, pool, nrservs);
794 return svc_signal_kthreads(serv, pool, nrservs);
801 svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
809 task = choose_victim(serv, pool, &state);
822 svc_set_num_threads_sync(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
824 if (pool == NULL) {
828 spin_lock_bh(&pool->sp_lock);
829 nrservs -= pool->sp_nrthreads;
830 spin_unlock_bh(&pool->sp_lock);
834 return svc_start_kthreads(serv, pool, nrservs);
836 return svc_stop_kthreads(serv, pool, nrservs);
860 struct svc_pool *pool = rqstp->rq_pool;
862 spin_lock_bh(&pool->sp_lock);
863 pool->sp_nrthreads--;
866 spin_unlock_bh(&pool->sp_lock);