mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
cgroup: add support for memory.zswap.current
This commit is contained in:
parent
121cb88292
commit
26caa66867
@ -2782,6 +2782,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemorySwapPeak = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryZswapCurrent = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryAvailable = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t CPUUsageNSec = ...;
|
||||
@ -3415,6 +3417,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<!--property MemorySwapPeak is not documented!-->
|
||||
|
||||
<!--property MemoryZswapCurrent is not documented!-->
|
||||
|
||||
<!--property CPUUsageNSec is not documented!-->
|
||||
|
||||
<!--property EffectiveCPUs is not documented!-->
|
||||
@ -4053,6 +4057,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2eservice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemorySwapPeak"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryZswapCurrent"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryAvailable"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="CPUUsageNSec"/>
|
||||
@ -4855,6 +4861,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemorySwapPeak = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryZswapCurrent = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryAvailable = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t CPUUsageNSec = ...;
|
||||
@ -5498,6 +5506,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
|
||||
|
||||
<!--property MemorySwapPeak is not documented!-->
|
||||
|
||||
<!--property MemoryZswapCurrent is not documented!-->
|
||||
|
||||
<!--property CPUUsageNSec is not documented!-->
|
||||
|
||||
<!--property EffectiveCPUs is not documented!-->
|
||||
@ -6118,6 +6128,8 @@ node /org/freedesktop/systemd1/unit/avahi_2ddaemon_2esocket {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemorySwapPeak"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryZswapCurrent"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryAvailable"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="CPUUsageNSec"/>
|
||||
@ -6794,6 +6806,8 @@ node /org/freedesktop/systemd1/unit/home_2emount {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemorySwapPeak = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryZswapCurrent = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryAvailable = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t CPUUsageNSec = ...;
|
||||
@ -7365,6 +7379,8 @@ node /org/freedesktop/systemd1/unit/home_2emount {
|
||||
|
||||
<!--property MemorySwapPeak is not documented!-->
|
||||
|
||||
<!--property MemoryZswapCurrent is not documented!-->
|
||||
|
||||
<!--property CPUUsageNSec is not documented!-->
|
||||
|
||||
<!--property EffectiveCPUs is not documented!-->
|
||||
@ -7899,6 +7915,8 @@ node /org/freedesktop/systemd1/unit/home_2emount {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemorySwapPeak"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryZswapCurrent"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryAvailable"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="CPUUsageNSec"/>
|
||||
@ -8698,6 +8716,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemorySwapPeak = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryZswapCurrent = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryAvailable = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t CPUUsageNSec = ...;
|
||||
@ -9255,6 +9275,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
|
||||
|
||||
<!--property MemorySwapPeak is not documented!-->
|
||||
|
||||
<!--property MemoryZswapCurrent is not documented!-->
|
||||
|
||||
<!--property CPUUsageNSec is not documented!-->
|
||||
|
||||
<!--property EffectiveCPUs is not documented!-->
|
||||
@ -9775,6 +9797,8 @@ node /org/freedesktop/systemd1/unit/dev_2dsda3_2eswap {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemorySwapPeak"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryZswapCurrent"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryAvailable"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="CPUUsageNSec"/>
|
||||
@ -10433,6 +10457,8 @@ node /org/freedesktop/systemd1/unit/system_2eslice {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemorySwapPeak = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryZswapCurrent = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryAvailable = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t CPUUsageNSec = ...;
|
||||
@ -10616,6 +10642,8 @@ node /org/freedesktop/systemd1/unit/system_2eslice {
|
||||
|
||||
<!--property MemorySwapPeak is not documented!-->
|
||||
|
||||
<!--property MemoryZswapCurrent is not documented!-->
|
||||
|
||||
<!--property CPUUsageNSec is not documented!-->
|
||||
|
||||
<!--property EffectiveCPUs is not documented!-->
|
||||
@ -10800,6 +10828,8 @@ node /org/freedesktop/systemd1/unit/system_2eslice {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemorySwapPeak"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryZswapCurrent"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryAvailable"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="CPUUsageNSec"/>
|
||||
@ -11012,6 +11042,8 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope {
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemorySwapPeak = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryZswapCurrent = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t MemoryAvailable = ...;
|
||||
@org.freedesktop.DBus.Property.EmitsChangedSignal("false")
|
||||
readonly t CPUUsageNSec = ...;
|
||||
@ -11215,6 +11247,8 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope {
|
||||
|
||||
<!--property MemorySwapPeak is not documented!-->
|
||||
|
||||
<!--property MemoryZswapCurrent is not documented!-->
|
||||
|
||||
<!--property CPUUsageNSec is not documented!-->
|
||||
|
||||
<!--property EffectiveCPUs is not documented!-->
|
||||
@ -11429,6 +11463,8 @@ node /org/freedesktop/systemd1/unit/session_2d1_2escope {
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemorySwapPeak"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryZswapCurrent"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="MemoryAvailable"/>
|
||||
|
||||
<variablelist class="dbus-property" generated="True" extra-ref="CPUUsageNSec"/>
|
||||
@ -11827,8 +11863,9 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \
|
||||
<varname>SetLoginEnvironment</varname>,
|
||||
<varname>CoredumpReceive</varname>,
|
||||
<varname>MemoryPeak</varname>,
|
||||
<varname>MemorySwapCurrent</varname>, and
|
||||
<varname>MemorySwapPeak</varname> were added in version 255.</para>
|
||||
<varname>MemorySwapCurrent</varname>,
|
||||
<varname>MemorySwapPeak</varname>, and
|
||||
<varname>MemoryZswapCurrent</varname> were added in version 255.</para>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Socket Unit Objects</title>
|
||||
@ -11857,8 +11894,9 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \
|
||||
<varname>SetLoginEnvironment</varname>,
|
||||
<varname>CoredumpReceive</varname>,
|
||||
<varname>MemoryPeak</varname>,
|
||||
<varname>MemorySwapCurrent</varname>, and
|
||||
<varname>MemorySwapPeak</varname> were added in version 255.</para>
|
||||
<varname>MemorySwapCurrent</varname>,
|
||||
<varname>MemorySwapPeak</varname>, and
|
||||
<varname>MemoryZswapCurrent</varname> were added in version 255.</para>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Mount Unit Objects</title>
|
||||
@ -11885,8 +11923,9 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \
|
||||
<varname>SetLoginEnvironment</varname>,
|
||||
<varname>CoredumpReceive</varname>,
|
||||
<varname>MemoryPeak</varname>,
|
||||
<varname>MemorySwapCurrent</varname>, and
|
||||
<varname>MemorySwapPeak</varname> were added in version 255.</para>
|
||||
<varname>MemorySwapCurrent</varname>,
|
||||
<varname>MemorySwapPeak</varname>, and
|
||||
<varname>MemoryZswapCurrent</varname> were added in version 255.</para>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Swap Unit Objects</title>
|
||||
@ -11913,8 +11952,9 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \
|
||||
<varname>SetLoginEnvironment</varname>,
|
||||
<varname>CoredumpReceive</varname>,
|
||||
<varname>MemoryPeak</varname>,
|
||||
<varname>MemorySwapCurrent</varname>, and
|
||||
<varname>MemorySwapPeak</varname> were added in version 255.</para>
|
||||
<varname>MemorySwapCurrent</varname>,
|
||||
<varname>MemorySwapPeak</varname>, and
|
||||
<varname>MemoryZswapCurrent</varname> were added in version 255.</para>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Slice Unit Objects</title>
|
||||
@ -11932,8 +11972,9 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \
|
||||
<para><varname>NFTSet</varname>,
|
||||
<varname>CoredumpReceive</varname>,
|
||||
<varname>MemoryPeak</varname>,
|
||||
<varname>MemorySwapCurrent</varname>, and
|
||||
<varname>MemorySwapPeak</varname> were added in version 255.</para>
|
||||
<varname>MemorySwapCurrent</varname>,
|
||||
<varname>MemorySwapPeak</varname>, and
|
||||
<varname>MemoryZswapCurrent</varname> were added in version 255.</para>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Scope Unit Objects</title>
|
||||
@ -11952,8 +11993,9 @@ $ gdbus introspect --system --dest org.freedesktop.systemd1 \
|
||||
<para><varname>NFTSet</varname>,
|
||||
<varname>CoredumpReceive</varname>,
|
||||
<varname>MemoryPeak</varname>,
|
||||
<varname>MemorySwapCurrent</varname>, and
|
||||
<varname>MemorySwapPeak</varname> were added in version 255.</para>
|
||||
<varname>MemorySwapCurrent</varname>,
|
||||
<varname>MemorySwapPeak</varname>, and
|
||||
<varname>MemoryZswapCurrent</varname> were added in version 255.</para>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Job Objects</title>
|
||||
|
@ -4111,6 +4111,10 @@ int unit_get_memory_swap_peak(Unit *u, uint64_t *ret) {
|
||||
return unit_get_memory_attr_cached(u, "memory.swap.peak", &u->memory_swap_peak_last, ret);
|
||||
}
|
||||
|
||||
int unit_get_memory_zswap_current(Unit *u, uint64_t *ret) {
|
||||
return unit_get_memory_attr_raw(u, "memory.zswap.current", ret);
|
||||
}
|
||||
|
||||
int unit_get_tasks_current(Unit *u, uint64_t *ret) {
|
||||
assert(u);
|
||||
assert(ret);
|
||||
|
@ -356,6 +356,7 @@ int unit_get_memory_current(Unit *u, uint64_t *ret);
|
||||
int unit_get_memory_peak(Unit *u, uint64_t *ret);
|
||||
int unit_get_memory_swap_current(Unit *u, uint64_t *ret);
|
||||
int unit_get_memory_swap_peak(Unit *u, uint64_t *ret);
|
||||
int unit_get_memory_zswap_current(Unit *u, uint64_t *ret);
|
||||
int unit_get_memory_available(Unit *u, uint64_t *ret);
|
||||
int unit_get_tasks_current(Unit *u, uint64_t *ret);
|
||||
int unit_get_cpu_usage(Unit *u, nsec_t *ret);
|
||||
|
@ -1149,6 +1149,29 @@ static int property_get_peak_swap_memory(
|
||||
return sd_bus_message_append(reply, "t", sz);
|
||||
}
|
||||
|
||||
static int property_get_current_zswap_memory(
|
||||
sd_bus *bus,
|
||||
const char *path,
|
||||
const char *interface,
|
||||
const char *property,
|
||||
sd_bus_message *reply,
|
||||
void *userdata,
|
||||
sd_bus_error *error) {
|
||||
|
||||
uint64_t sz = UINT64_MAX;
|
||||
Unit *u = ASSERT_PTR(userdata);
|
||||
int r;
|
||||
|
||||
assert(bus);
|
||||
assert(reply);
|
||||
|
||||
r = unit_get_memory_swap_current(u, &sz);
|
||||
if (r < 0 && r != -ENODATA)
|
||||
log_unit_warning_errno(u, r, "Failed to get memory.zswap.current attribute: %m");
|
||||
|
||||
return sd_bus_message_append(reply, "t", sz);
|
||||
}
|
||||
|
||||
static int property_get_available_memory(
|
||||
sd_bus *bus,
|
||||
const char *path,
|
||||
@ -1608,6 +1631,7 @@ const sd_bus_vtable bus_unit_cgroup_vtable[] = {
|
||||
SD_BUS_PROPERTY("MemoryPeak", "t", property_get_peak_memory, 0, 0),
|
||||
SD_BUS_PROPERTY("MemorySwapCurrent", "t", property_get_current_swap_memory, 0, 0),
|
||||
SD_BUS_PROPERTY("MemorySwapPeak", "t", property_get_peak_swap_memory, 0, 0),
|
||||
SD_BUS_PROPERTY("MemoryZswapCurrent", "t", property_get_current_zswap_memory, 0, 0),
|
||||
SD_BUS_PROPERTY("MemoryAvailable", "t", property_get_available_memory, 0, 0),
|
||||
SD_BUS_PROPERTY("CPUUsageNSec", "t", property_get_cpu_usage, 0, 0),
|
||||
SD_BUS_PROPERTY("EffectiveCPUs", "ay", property_get_cpuset_cpus, 0, 0),
|
||||
|
@ -253,6 +253,7 @@ typedef struct UnitStatusInfo {
|
||||
uint64_t memory_peak;
|
||||
uint64_t memory_swap_current;
|
||||
uint64_t memory_swap_peak;
|
||||
uint64_t memory_zswap_current;
|
||||
uint64_t memory_min;
|
||||
uint64_t memory_low;
|
||||
uint64_t startup_memory_low;
|
||||
@ -707,9 +708,11 @@ static void print_status_info(
|
||||
|
||||
/* Only show current swap if it ever was non-zero or is currently non-zero. In both cases
|
||||
memory_swap_peak will be non-zero (and not CGROUP_LIMIT_MAX). */
|
||||
bool show_memory_swap = !IN_SET(i->memory_swap_peak, 0, CGROUP_LIMIT_MAX);
|
||||
bool show_memory_swap = !IN_SET(i->memory_swap_peak, 0, CGROUP_LIMIT_MAX),
|
||||
show_memory_zswap_current = !IN_SET(i->memory_zswap_current, 0, CGROUP_LIMIT_MAX);
|
||||
if (i->memory_peak != CGROUP_LIMIT_MAX ||
|
||||
show_memory_swap ||
|
||||
show_memory_zswap_current ||
|
||||
i->memory_min > 0 ||
|
||||
i->memory_low > 0 || i->startup_memory_low > 0 ||
|
||||
i->memory_high != CGROUP_LIMIT_MAX || i->startup_memory_high != CGROUP_LIMIT_MAX ||
|
||||
@ -785,6 +788,10 @@ static void print_status_info(
|
||||
printf("%sswap peak: %s", prefix, FORMAT_BYTES(i->memory_swap_peak));
|
||||
prefix = " ";
|
||||
}
|
||||
if (show_memory_zswap_current) {
|
||||
printf("%szswap: %s", prefix, FORMAT_BYTES(i->memory_zswap_current));
|
||||
prefix = " ";
|
||||
}
|
||||
printf(")");
|
||||
}
|
||||
printf("\n");
|
||||
@ -2054,6 +2061,7 @@ static int show_one(
|
||||
{ "MemoryPeak", "t", NULL, offsetof(UnitStatusInfo, memory_peak) },
|
||||
{ "MemorySwapCurrent", "t", NULL, offsetof(UnitStatusInfo, memory_swap_current) },
|
||||
{ "MemorySwapPeak", "t", NULL, offsetof(UnitStatusInfo, memory_swap_peak) },
|
||||
{ "MemoryZswapCurrent", "t", NULL, offsetof(UnitStatusInfo, memory_zswap_current) },
|
||||
{ "MemoryAvailable", "t", NULL, offsetof(UnitStatusInfo, memory_available) },
|
||||
{ "DefaultMemoryMin", "t", NULL, offsetof(UnitStatusInfo, default_memory_min) },
|
||||
{ "DefaultMemoryLow", "t", NULL, offsetof(UnitStatusInfo, default_memory_low) },
|
||||
@ -2113,6 +2121,7 @@ static int show_one(
|
||||
.memory_peak = CGROUP_LIMIT_MAX,
|
||||
.memory_swap_current = CGROUP_LIMIT_MAX,
|
||||
.memory_swap_peak = CGROUP_LIMIT_MAX,
|
||||
.memory_zswap_current = CGROUP_LIMIT_MAX,
|
||||
.memory_available = CGROUP_LIMIT_MAX,
|
||||
.cpu_usage_nsec = UINT64_MAX,
|
||||
.tasks_current = UINT64_MAX,
|
||||
|
Loading…
Reference in New Issue
Block a user