From: kungf Date: Thu, 14 Sep 2017 06:09:30 +0000 (+0800) Subject: osd: get loadavg per cpu for scrub load threshold check X-Git-Tag: v13.0.1~882^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c1dba46084a7800d4cd34eda4966295faf0a6366;p=ceph.git osd: get loadavg per cpu for scrub load threshold check Signed-off-by: kungf --- diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 0dd615527479..b530a683d1f4 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -13,7 +13,7 @@ * */ #include "acconfig.h" - +#include #include #include #include @@ -7099,8 +7099,10 @@ bool OSD::scrub_load_below_threshold() } // allow scrub if below configured threshold - if (loadavgs[0] < cct->_conf->osd_scrub_load_threshold) { - dout(20) << __func__ << " loadavg " << loadavgs[0] + long cpus = sysconf(_SC_NPROCESSORS_ONLN); + double loadavg_per_cpu = cpus > 0 ? loadavgs[0] / cpus : loadavgs[0]; + if (loadavg_per_cpu < cct->_conf->osd_scrub_load_threshold) { + dout(20) << __func__ << " loadavg per cpu " << loadavg_per_cpu << " < max " << cct->_conf->osd_scrub_load_threshold << " = yes" << dendl; return true;