Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sunrpc: remove special handling of NULL pool from svc_start/stop_kthreads()

Now that svc_set_num_threads() handles distributing the threads among
the available pools, remove the special handling of a NULL pool pointer
from svc_start_kthreads() and svc_stop_kthreads().

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Jeff Layton and committed by
Chuck Lever
2c01f0cf e344f872

+7 -46
+7 -46
net/sunrpc/svc.c
··· 763 763 } 764 764 EXPORT_SYMBOL_GPL(svc_pool_wake_idle_thread); 765 765 766 - static struct svc_pool * 767 - svc_pool_next(struct svc_serv *serv, struct svc_pool *pool, unsigned int *state) 768 - { 769 - return pool ? pool : &serv->sv_pools[(*state)++ % serv->sv_nrpools]; 770 - } 771 - 772 - static struct svc_pool * 773 - svc_pool_victim(struct svc_serv *serv, struct svc_pool *target_pool, 774 - unsigned int *state) 775 - { 776 - struct svc_pool *pool; 777 - unsigned int i; 778 - 779 - pool = target_pool; 780 - 781 - if (!pool) { 782 - for (i = 0; i < serv->sv_nrpools; i++) { 783 - pool = &serv->sv_pools[--(*state) % serv->sv_nrpools]; 784 - if (pool->sp_nrthreads) 785 - break; 786 - } 787 - } 788 - 789 - if (pool && pool->sp_nrthreads) { 790 - set_bit(SP_VICTIM_REMAINS, &pool->sp_flags); 791 - set_bit(SP_NEED_VICTIM, &pool->sp_flags); 792 - return pool; 793 - } 794 - return NULL; 795 - } 796 - 797 766 static int 798 767 svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) 799 768 { 800 769 struct svc_rqst *rqstp; 801 770 struct task_struct *task; 802 - struct svc_pool *chosen_pool; 803 - unsigned int state = serv->sv_nrthreads-1; 804 771 int node; 805 772 int err; 806 773 807 774 do { 808 775 nrservs--; 809 - chosen_pool = svc_pool_next(serv, pool, &state); 810 - node = svc_pool_map_get_node(chosen_pool->sp_id); 776 + node = svc_pool_map_get_node(pool->sp_id); 811 777 812 - rqstp = svc_prepare_thread(serv, chosen_pool, node); 778 + rqstp = svc_prepare_thread(serv, pool, node); 813 779 if (!rqstp) 814 780 return -ENOMEM; 815 781 task = kthread_create_on_node(serv->sv_threadfn, rqstp, ··· 787 821 788 822 rqstp->rq_task = task; 789 823 if (serv->sv_nrpools > 1) 790 - svc_pool_map_set_cpumask(task, chosen_pool->sp_id); 824 + svc_pool_map_set_cpumask(task, pool->sp_id); 791 825 792 826 svc_sock_update_bufs(serv); 793 827 wake_up_process(task); ··· 806 840 static int 807 841 svc_stop_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs) 808 842 { 809 - unsigned int state = serv->sv_nrthreads-1; 810 - struct svc_pool *victim; 811 - 812 843 do { 813 - victim = svc_pool_victim(serv, pool, &state); 814 - if (!victim) 815 - break; 816 - svc_pool_wake_idle_thread(victim); 817 - wait_on_bit(&victim->sp_flags, SP_VICTIM_REMAINS, 818 - TASK_IDLE); 844 + set_bit(SP_VICTIM_REMAINS, &pool->sp_flags); 845 + set_bit(SP_NEED_VICTIM, &pool->sp_flags); 846 + svc_pool_wake_idle_thread(pool); 847 + wait_on_bit(&pool->sp_flags, SP_VICTIM_REMAINS, TASK_IDLE); 819 848 nrservs++; 820 849 } while (nrservs < 0); 821 850 return 0;