mirror of https://github.com/xzeldon/htop.git
Implement PCP support for minimum ZFS ARC size
This commit is contained in:
parent
c0a9e92eea
commit
7694dbc821
|
@ -81,6 +81,7 @@ typedef enum PCPMetric_ {
|
||||||
PCP_ZFS_ARC_BONUS_SIZE, /* zfs.arc.bonus_size */
|
PCP_ZFS_ARC_BONUS_SIZE, /* zfs.arc.bonus_size */
|
||||||
PCP_ZFS_ARC_COMPRESSED_SIZE, /* zfs.arc.compressed_size */
|
PCP_ZFS_ARC_COMPRESSED_SIZE, /* zfs.arc.compressed_size */
|
||||||
PCP_ZFS_ARC_UNCOMPRESSED_SIZE, /* zfs.arc.uncompressed_size */
|
PCP_ZFS_ARC_UNCOMPRESSED_SIZE, /* zfs.arc.uncompressed_size */
|
||||||
|
PCP_ZFS_ARC_C_MIN, /* zfs.arc.c_min */
|
||||||
PCP_ZFS_ARC_C_MAX, /* zfs.arc.c_max */
|
PCP_ZFS_ARC_C_MAX, /* zfs.arc.c_max */
|
||||||
PCP_ZFS_ARC_DBUF_SIZE, /* zfs.arc.dbuf_size */
|
PCP_ZFS_ARC_DBUF_SIZE, /* zfs.arc.dbuf_size */
|
||||||
PCP_ZFS_ARC_DNODE_SIZE, /* zfs.arc.dnode_size */
|
PCP_ZFS_ARC_DNODE_SIZE, /* zfs.arc.dnode_size */
|
||||||
|
|
|
@ -601,6 +601,8 @@ static inline void PCPProcessList_scanZfsArcstats(PCPProcessList* this) {
|
||||||
memset(&this->zfs, 0, sizeof(ZfsArcStats));
|
memset(&this->zfs, 0, sizeof(ZfsArcStats));
|
||||||
if (PCPMetric_values(PCP_ZFS_ARC_ANON_SIZE, &value, 1, PM_TYPE_U64))
|
if (PCPMetric_values(PCP_ZFS_ARC_ANON_SIZE, &value, 1, PM_TYPE_U64))
|
||||||
this->zfs.anon = value.ull / ONE_K;
|
this->zfs.anon = value.ull / ONE_K;
|
||||||
|
if (PCPMetric_values(PCP_ZFS_ARC_C_MIN, &value, 1, PM_TYPE_U64))
|
||||||
|
this->zfs.min = value.ull / ONE_K;
|
||||||
if (PCPMetric_values(PCP_ZFS_ARC_C_MAX, &value, 1, PM_TYPE_U64))
|
if (PCPMetric_values(PCP_ZFS_ARC_C_MAX, &value, 1, PM_TYPE_U64))
|
||||||
this->zfs.max = value.ull / ONE_K;
|
this->zfs.max = value.ull / ONE_K;
|
||||||
if (PCPMetric_values(PCP_ZFS_ARC_BONUS_SIZE, &value, 1, PM_TYPE_U64))
|
if (PCPMetric_values(PCP_ZFS_ARC_BONUS_SIZE, &value, 1, PM_TYPE_U64))
|
||||||
|
|
|
@ -178,6 +178,7 @@ static const char* Platform_metricNames[] = {
|
||||||
[PCP_ZFS_ARC_BONUS_SIZE] = "zfs.arc.bonus_size",
|
[PCP_ZFS_ARC_BONUS_SIZE] = "zfs.arc.bonus_size",
|
||||||
[PCP_ZFS_ARC_COMPRESSED_SIZE] = "zfs.arc.compressed_size",
|
[PCP_ZFS_ARC_COMPRESSED_SIZE] = "zfs.arc.compressed_size",
|
||||||
[PCP_ZFS_ARC_UNCOMPRESSED_SIZE] = "zfs.arc.uncompressed_size",
|
[PCP_ZFS_ARC_UNCOMPRESSED_SIZE] = "zfs.arc.uncompressed_size",
|
||||||
|
[PCP_ZFS_ARC_C_MIN] = "zfs.arc.c_min",
|
||||||
[PCP_ZFS_ARC_C_MAX] = "zfs.arc.c_max",
|
[PCP_ZFS_ARC_C_MAX] = "zfs.arc.c_max",
|
||||||
[PCP_ZFS_ARC_DBUF_SIZE] = "zfs.arc.dbuf_size",
|
[PCP_ZFS_ARC_DBUF_SIZE] = "zfs.arc.dbuf_size",
|
||||||
[PCP_ZFS_ARC_DNODE_SIZE] = "zfs.arc.dnode_size",
|
[PCP_ZFS_ARC_DNODE_SIZE] = "zfs.arc.dnode_size",
|
||||||
|
@ -510,8 +511,13 @@ void Platform_setMemoryValues(Meter* this) {
|
||||||
this->values[4] = pl->availableMem;
|
this->values[4] = pl->availableMem;
|
||||||
|
|
||||||
if (ppl->zfs.enabled != 0) {
|
if (ppl->zfs.enabled != 0) {
|
||||||
this->values[0] -= ppl->zfs.size;
|
// ZFS does not shrink below the value of zfs_arc_min.
|
||||||
this->values[3] += ppl->zfs.size;
|
unsigned long long int shrinkableSize = 0;
|
||||||
|
if (ppl->zfs.size > ppl->zfs.min)
|
||||||
|
shrinkableSize = ppl->zfs.size - ppl->zfs.min;
|
||||||
|
this->values[0] -= shrinkableSize;
|
||||||
|
this->values[3] += shrinkableSize;
|
||||||
|
this->values[4] += shrinkableSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue