* 1 : disable multiple partitions
* >1 : specify number of partitions
*/
-/* NB: we set it to 1 for now, multiple partitions will be enabled after
- * all smp node affinity code landed */
-static int cpu_npartitions = 1;
+static int cpu_npartitions;
CFS_MODULE_PARM(cpu_npartitions, "i", int, 0444, "# of CPU partitions");
/**
ni->ni_ncpts = rc;
}
- /* LND will fill in the address part of the NID */
- ni->ni_nid = LNET_MKNID(net, 0);
- ni->ni_last_alive = cfs_time_current();
- cfs_list_add_tail(&ni->ni_list, nilist);
- return ni;
+ /* LND will fill in the address part of the NID */
+ ni->ni_nid = LNET_MKNID(net, 0);
+ ni->ni_last_alive = cfs_time_current_sec();
+ cfs_list_add_tail(&ni->ni_list, nilist);
+ return ni;
failed:
lnet_ni_free(ni);
return NULL;
local tstarted
local paramp
local msg="Insane $modname thread counts"
+ local ncpts=$(check_cpt_number)
shift 4
setup
lassert 24 "$msg" '(($tstarted >= $tmin && $tstarted <= $tmax ))' || return $?
# Check that we can change min/max
- do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + 1))"
- do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - 1))"
- tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
- tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
- lassert 25 "$msg" '(($tmin2 == ($tmin + 1) && $tmax2 == ($tmax -1)))' || return $?
+ do_facet $facet "lctl set_param ${paramp}.threads_min=$((tmin + ncpts))"
+ do_facet $facet "lctl set_param ${paramp}.threads_max=$((tmax - ncpts))"
+ tmin2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
+ tmax2=$(do_facet $facet "lctl get_param -n ${paramp}.threads_max" || echo 0)
+ lassert 25 "$msg" '(($tmin2 == ($tmin + $ncpts) && $tmax2 == ($tmax - $ncpts)))' || return $?
# Check that we can set min/max to the same value
tmin=$(do_facet $facet "lctl get_param -n ${paramp}.threads_min" || echo 0)
}
test_53a() {
- thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads=64'
+ local ncpts=$(check_cpt_number)
+ local nthrs
+
+ nthrs=`expr 16 \* $ncpts`
+ thread_sanity OST ost1 'ost.*.ost' 'oss_num_threads='$nthrs
}
run_test 53a "check OSS thread count params"
test_53b() {
- thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads=64'
+ local ncpts=$(check_cpt_number)
+ local nthrs
+
+ nthrs=`expr 16 \* $ncpts`
+ thread_sanity MDT $SINGLEMDS 'mdt.*.*.' 'mdt_num_threads='$nthrs
}
run_test 53b "check MDT thread count params"
# /proc/sys/lnet/nis should look like this:
# nid status alive refs peer rtr max tx min
# where nid is a string like 192.168.1.1@tcp2, status is up/down,
- # alive is numeric (0 or >0 or <0), refs > 0, peer >= 0,
+ # alive is numeric (0 or >0 or <0), refs >= 0, peer >= 0,
# rtr >= 0, max >=0, tx and min are numeric (0 or >0 or <0).
L1="^nid +status +alive +refs +peer +rtr +max +tx +min$"
- BR="^$NID +(up|down) +$I +$P +$N +$N +$N +$I +$I$"
+ BR="^$NID +(up|down) +$I +$N +$N +$N +$N +$I +$I$"
create_lnet_proc_files "nis"
check_lnet_proc_entry "nis.out" "/proc/sys/lnet/nis" "$BR" "$L1"
check_lnet_proc_entry "nis.sys" "lnet.nis" "$BR" "$L1"
rm -f $TMP/*active
}
+check_cpt_number() {
+ local ncpts
+
+ ncpts=$(lctl get_param -n cpu_partition_table 2>/dev/null| wc -l)
+ if [ $ncpts -eq 0 ]; then
+ echo "1"
+ else
+ echo $ncpts
+ fi
+}
+
version_code() {
# split arguments like "1.8.6-wc3" into "1", "8", "6", "wc3"
eval set -- $(tr "[:punct:]" " " <<< $*)
return 0
fi
- echo Loading modules from $LUSTRE
- load_module ../libcfs/libcfs/libcfs
+ echo Loading modules from $LUSTRE
+
+ local ncpus
+
+ if [ -f /sys/devices/system/cpu/online ]; then
+ ncpus=$(($(cut -d "-" -f 2 /sys/devices/system/cpu/online) + 1))
+ echo "detected $ncpus online CPUs by sysfs"
+ else
+ ncpus=$(getconf _NPROCESSORS_CONF 2>/dev/null)
+ local rc=$?
+ if [ $rc -eq 0 ]; then
+ echo "detected $ncpus online CPUs by getconf"
+ else
+ echo "Can't detect number of CPUs"
+ ncpus=1
+ fi
+ fi
+
+ local ncpts=0
+ # if there is only one CPU core, libcfs can only create one partition
+ # if there is more than 4 CPU cores, libcfs should create multiple CPU
+ # partitions. So we just force libcfs to create 2 partitions for
+ # system with 2 or 4 cores
+ if [ $ncpus -le 4 ] && [ $ncpus -gt 1 ]; then
+ # force to enable multiple CPU partitions
+ echo "Force libcfs to create 2 CPU partitions"
+ ncpts=2
+ else
+ echo "libcfs will create CPU partition based on online CPUs"
+ fi
+
+ load_module ../libcfs/libcfs/libcfs cpu_npartitions=$ncpts
+
[ "$PTLDEBUG" ] && lctl set_param debug="$PTLDEBUG"
[ "$SUBSYSTEM" ] && lctl set_param subsystem_debug="${SUBSYSTEM# }"
load_module ../lnet/lnet/lnet