diff options
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r-- | kernel/rcutorture.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index b31065522104..3245b40952c6 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -868,49 +868,52 @@ static int rcu_idle_cpu; /* Force all torture tasks off this CPU */ | |||
868 | */ | 868 | */ |
869 | static void rcu_torture_shuffle_tasks(void) | 869 | static void rcu_torture_shuffle_tasks(void) |
870 | { | 870 | { |
871 | cpumask_t tmp_mask; | 871 | cpumask_var_t tmp_mask; |
872 | int i; | 872 | int i; |
873 | 873 | ||
874 | cpus_setall(tmp_mask); | 874 | if (!alloc_cpumask_var(&tmp_mask, GFP_KERNEL)) |
875 | BUG(); | ||
876 | |||
877 | cpumask_setall(tmp_mask); | ||
875 | get_online_cpus(); | 878 | get_online_cpus(); |
876 | 879 | ||
877 | /* No point in shuffling if there is only one online CPU (ex: UP) */ | 880 | /* No point in shuffling if there is only one online CPU (ex: UP) */ |
878 | if (num_online_cpus() == 1) { | 881 | if (num_online_cpus() == 1) |
879 | put_online_cpus(); | 882 | goto out; |
880 | return; | ||
881 | } | ||
882 | 883 | ||
883 | if (rcu_idle_cpu != -1) | 884 | if (rcu_idle_cpu != -1) |
884 | cpu_clear(rcu_idle_cpu, tmp_mask); | 885 | cpumask_clear_cpu(rcu_idle_cpu, tmp_mask); |
885 | 886 | ||
886 | set_cpus_allowed_ptr(current, &tmp_mask); | 887 | set_cpus_allowed_ptr(current, tmp_mask); |
887 | 888 | ||
888 | if (reader_tasks) { | 889 | if (reader_tasks) { |
889 | for (i = 0; i < nrealreaders; i++) | 890 | for (i = 0; i < nrealreaders; i++) |
890 | if (reader_tasks[i]) | 891 | if (reader_tasks[i]) |
891 | set_cpus_allowed_ptr(reader_tasks[i], | 892 | set_cpus_allowed_ptr(reader_tasks[i], |
892 | &tmp_mask); | 893 | tmp_mask); |
893 | } | 894 | } |
894 | 895 | ||
895 | if (fakewriter_tasks) { | 896 | if (fakewriter_tasks) { |
896 | for (i = 0; i < nfakewriters; i++) | 897 | for (i = 0; i < nfakewriters; i++) |
897 | if (fakewriter_tasks[i]) | 898 | if (fakewriter_tasks[i]) |
898 | set_cpus_allowed_ptr(fakewriter_tasks[i], | 899 | set_cpus_allowed_ptr(fakewriter_tasks[i], |
899 | &tmp_mask); | 900 | tmp_mask); |
900 | } | 901 | } |
901 | 902 | ||
902 | if (writer_task) | 903 | if (writer_task) |
903 | set_cpus_allowed_ptr(writer_task, &tmp_mask); | 904 | set_cpus_allowed_ptr(writer_task, tmp_mask); |
904 | 905 | ||
905 | if (stats_task) | 906 | if (stats_task) |
906 | set_cpus_allowed_ptr(stats_task, &tmp_mask); | 907 | set_cpus_allowed_ptr(stats_task, tmp_mask); |
907 | 908 | ||
908 | if (rcu_idle_cpu == -1) | 909 | if (rcu_idle_cpu == -1) |
909 | rcu_idle_cpu = num_online_cpus() - 1; | 910 | rcu_idle_cpu = num_online_cpus() - 1; |
910 | else | 911 | else |
911 | rcu_idle_cpu--; | 912 | rcu_idle_cpu--; |
912 | 913 | ||
914 | out: | ||
913 | put_online_cpus(); | 915 | put_online_cpus(); |
916 | free_cpumask_var(tmp_mask); | ||
914 | } | 917 | } |
915 | 918 | ||
916 | /* Shuffle tasks across CPUs, with the intent of allowing each CPU in the | 919 | /* Shuffle tasks across CPUs, with the intent of allowing each CPU in the |