diff options
author | Oleg Drokin <green@linuxhacker.ru> | 2015-03-04 01:07:51 -0500 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2015-03-04 23:57:05 -0500 |
commit | dc0d838a0527296730af6d3826bcda79d2918613 (patch) | |
tree | 29350e178ad08dd83a405e1d6abd1d17d6a8fae7 | |
parent | 35168f512ff7eff9153e8c192f1155c994a75a0a (diff) |
staging/lustre/ptlrpc: Do not use deprecated cpus_* functions
As per Rusty Russel, cpus_* functions are deprecated.
When mixing cpumask_copy with cpus_weight, they operate on different
sized masks if CPUMASK_OFFSTACK is enabled, causing an
immediate assertion failure.
Copying of cpumasks by assignment is also not allowed now.
Additionally, in ptlrpc/service.c avoid the cpumask copies,
since we only use it to check how many siblings are there for
core #0 and nothing else.
Reported-by: Tyson Whitehead <twhitehead@gmail.com>
Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | 8 | ||||
-rw-r--r-- | drivers/staging/lustre/lustre/ptlrpc/service.c | 9 |
2 files changed, 7 insertions, 10 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c index 4621b71fe0b6..7f13a2845e9f 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c +++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c | |||
@@ -511,10 +511,10 @@ static int ptlrpcd_bind(int index, int max) | |||
511 | #if defined(CONFIG_NUMA) | 511 | #if defined(CONFIG_NUMA) |
512 | { | 512 | { |
513 | int i; | 513 | int i; |
514 | mask = *cpumask_of_node(cpu_to_node(index)); | 514 | cpumask_copy(&mask, cpumask_of_node(cpu_to_node(index))); |
515 | for (i = max; i < num_online_cpus(); i++) | 515 | for (i = max; i < num_online_cpus(); i++) |
516 | cpu_clear(i, mask); | 516 | cpumask_clear_cpu(i, &mask); |
517 | pc->pc_npartners = cpus_weight(mask) - 1; | 517 | pc->pc_npartners = cpumask_weight(&mask) - 1; |
518 | set_bit(LIOD_BIND, &pc->pc_flags); | 518 | set_bit(LIOD_BIND, &pc->pc_flags); |
519 | } | 519 | } |
520 | #else | 520 | #else |
@@ -554,7 +554,7 @@ static int ptlrpcd_bind(int index, int max) | |||
554 | * that are already initialized | 554 | * that are already initialized |
555 | */ | 555 | */ |
556 | for (pidx = 0, i = 0; i < index; i++) { | 556 | for (pidx = 0, i = 0; i < index; i++) { |
557 | if (cpu_isset(i, mask)) { | 557 | if (cpumask_test_cpu(i, &mask)) { |
558 | ppc = &ptlrpcds->pd_threads[i]; | 558 | ppc = &ptlrpcds->pd_threads[i]; |
559 | pc->pc_partners[pidx++] = ppc; | 559 | pc->pc_partners[pidx++] = ppc; |
560 | ppc->pc_partners[ppc-> | 560 | ppc->pc_partners[ppc-> |
diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c index 635b12b22cef..8e61421515cb 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/service.c +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c | |||
@@ -543,7 +543,6 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, | |||
543 | if (tc->tc_thr_factor != 0) { | 543 | if (tc->tc_thr_factor != 0) { |
544 | int factor = tc->tc_thr_factor; | 544 | int factor = tc->tc_thr_factor; |
545 | const int fade = 4; | 545 | const int fade = 4; |
546 | cpumask_t mask; | ||
547 | 546 | ||
548 | /* | 547 | /* |
549 | * User wants to increase number of threads with for | 548 | * User wants to increase number of threads with for |
@@ -557,8 +556,8 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, | |||
557 | * have too many threads no matter how many cores/HTs | 556 | * have too many threads no matter how many cores/HTs |
558 | * there are. | 557 | * there are. |
559 | */ | 558 | */ |
560 | cpumask_copy(&mask, topology_thread_cpumask(0)); | 559 | /* weight is # of HTs */ |
561 | if (cpus_weight(mask) > 1) { /* weight is # of HTs */ | 560 | if (cpumask_weight(topology_thread_cpumask(0)) > 1) { |
562 | /* depress thread factor for hyper-thread */ | 561 | /* depress thread factor for hyper-thread */ |
563 | factor = factor - (factor >> 1) + (factor >> 3); | 562 | factor = factor - (factor >> 1) + (factor >> 3); |
564 | } | 563 | } |
@@ -2752,7 +2751,6 @@ int ptlrpc_start_thread(struct ptlrpc_service_part *svcpt, int wait) | |||
2752 | 2751 | ||
2753 | int ptlrpc_hr_init(void) | 2752 | int ptlrpc_hr_init(void) |
2754 | { | 2753 | { |
2755 | cpumask_t mask; | ||
2756 | struct ptlrpc_hr_partition *hrp; | 2754 | struct ptlrpc_hr_partition *hrp; |
2757 | struct ptlrpc_hr_thread *hrt; | 2755 | struct ptlrpc_hr_thread *hrt; |
2758 | int rc; | 2756 | int rc; |
@@ -2770,8 +2768,7 @@ int ptlrpc_hr_init(void) | |||
2770 | 2768 | ||
2771 | init_waitqueue_head(&ptlrpc_hr.hr_waitq); | 2769 | init_waitqueue_head(&ptlrpc_hr.hr_waitq); |
2772 | 2770 | ||
2773 | cpumask_copy(&mask, topology_thread_cpumask(0)); | 2771 | weight = cpumask_weight(topology_thread_cpumask(0)); |
2774 | weight = cpus_weight(mask); | ||
2775 | 2772 | ||
2776 | cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) { | 2773 | cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) { |
2777 | hrp->hrp_cpt = i; | 2774 | hrp->hrp_cpt = i; |