@@ -8279,6 +8279,19 @@ static ssize_t swap_max_write(struct kernfs_open_file *of,
return nbytes;
}
+static int swap_max_effective_show(struct seq_file *m, void *v)
+{
+ unsigned long swap;
+ struct mem_cgroup *mi;
+
+ /* Hierarchical information */
+ swap = PAGE_COUNTER_MAX;
+ for (mi = mem_cgroup_from_seq(m); mi; mi = parent_mem_cgroup(mi))
+ swap = min(swap, READ_ONCE(mi->swap.max));
+
+ return seq_puts_memcg_tunable(m, swap);
+}
+
static int swap_events_show(struct seq_file *m, void *v)
{
struct mem_cgroup *memcg = mem_cgroup_from_seq(m);
@@ -8311,6 +8324,11 @@ static struct cftype swap_files[] = {
.seq_show = swap_max_show,
.write = swap_max_write,
},
+ {
+ .name = "swap.max.effective",
+ .flags = CFTYPE_NOT_ON_ROOT,
+ .seq_show = swap_max_effective_show,
+ },
{
.name = "swap.peak",
.flags = CFTYPE_NOT_ON_ROOT,