Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

luminous: osd: get loadavg per cpu for scrub load threshold check #24593

Merged
merged 1 commit into from Oct 25, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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