mirror of
https://github.com/ceph/ceph
synced 2024-12-15 07:56:12 +00:00
osd: get loadavg per cpu for scrub load threshold check
Signed-off-by: kungf <yang.wang@easystack.cn>
This commit is contained in:
parent
07159477ee
commit
c1dba46084
@ -13,7 +13,7 @@
|
||||
*
|
||||
*/
|
||||
#include "acconfig.h"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <errno.h>
|
||||
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user