Skip to content

Commit

Permalink
Merge pull request #24593 from dzafman/wip-36419
Browse files Browse the repository at this point in the history
luminous: osd: get loadavg per cpu for scrub load threshold check

Reviewed-by: Neha Ojha <nojha@redhat.com>
  • Loading branch information
yuriw committed Oct 25, 2018
2 parents e85db1a + 9b94528 commit 869ce7e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/osd/OSD.cc
Expand Up @@ -13,7 +13,7 @@
*
*/
#include "acconfig.h"

#include <unistd.h>
#include <fstream>
#include <iostream>
#include <errno.h>
Expand Down Expand Up @@ -7595,8 +7595,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;
Expand Down

0 comments on commit 869ce7e

Please sign in to comment.