lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAVpQUAsZsEKQ65Kuh7wmcf6Yqq8m4im7dYFvVd1RL4QHxMN8g@mail.gmail.com>
Date: Mon, 14 Jul 2025 11:02:48 -0700
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: Daniel Sedlak <daniel.sedlak@...77.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, 
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Simon Horman <horms@...nel.org>, 
	Jonathan Corbet <corbet@....net>, Neal Cardwell <ncardwell@...gle.com>, David Ahern <dsahern@...nel.org>, 
	Andrew Morton <akpm@...ux-foundation.org>, Shakeel Butt <shakeel.butt@...ux.dev>, 
	Yosry Ahmed <yosry.ahmed@...ux.dev>, linux-mm@...ck.org, netdev@...r.kernel.org, 
	Matyas Hurtik <matyas.hurtik@...77.com>, Daniel Sedlak <danie.sedlak@...77.com>
Subject: Re: [PATCH v2 net-next 2/2] mm/vmpressure: add tracepoint for socket
 pressure detection

On Mon, Jul 14, 2025 at 7:37 AM Daniel Sedlak <daniel.sedlak@...77.com> wrote:
>
> From: Matyas Hurtik <matyas.hurtik@...77.com>
>
> When the vmpressure function marks all sockets within a particular
> cgroup as under pressure, it can silently reduce network throughput
> significantly. This socket pressure is not currently signaled in any way
> to the users, and it is difficult to detect which cgroup is under socket
> pressure.
>
> This patch adds a new tracepoint that is called when a cgroup is under
> socket pressure.
>
> Signed-off-by: Matyas Hurtik <matyas.hurtik@...77.com>
> Co-developed-by: Daniel Sedlak <danie.sedlak@...77.com>
> Signed-off-by: Daniel Sedlak <danie.sedlak@...77.com>
> ---
>  include/trace/events/memcg.h | 25 +++++++++++++++++++++++++
>  mm/vmpressure.c              |  3 +++
>  2 files changed, 28 insertions(+)
>
> diff --git a/include/trace/events/memcg.h b/include/trace/events/memcg.h
> index dfe2f51019b4..19a51db73913 100644
> --- a/include/trace/events/memcg.h
> +++ b/include/trace/events/memcg.h
> @@ -100,6 +100,31 @@ TRACE_EVENT(memcg_flush_stats,
>                 __entry->force, __entry->needs_flush)
>  );
>
> +TRACE_EVENT(memcg_socket_under_pressure,
> +
> +       TP_PROTO(const struct mem_cgroup *memcg, unsigned long scanned,
> +               unsigned long reclaimed),
> +
> +       TP_ARGS(memcg, scanned, reclaimed),
> +
> +       TP_STRUCT__entry(
> +               __field(u64, id)
> +               __field(unsigned long, scanned)
> +               __field(unsigned long, reclaimed)
> +       ),
> +
> +       TP_fast_assign(
> +               __entry->id = cgroup_id(memcg->css.cgroup);
> +               __entry->scanned = scanned;
> +               __entry->reclaimed = reclaimed;
> +       ),
> +
> +       TP_printk("memcg_id=%llu scanned=%lu reclaimed=%lu",
> +               __entry->id,

Maybe a noob question: How can we translate the memcg ID
to the /sys/fs/cgroup/... path ?

It would be nice to place this patch first and the description of
patch 2 has how to use the new stat with this tracepoint.


> +               __entry->scanned,
> +               __entry->reclaimed)
> +);
> +
>  #endif /* _TRACE_MEMCG_H */
>
>  /* This part must be outside protection */
> diff --git a/mm/vmpressure.c b/mm/vmpressure.c
> index bd5183dfd879..aa9583066731 100644
> --- a/mm/vmpressure.c
> +++ b/mm/vmpressure.c
> @@ -21,6 +21,8 @@
>  #include <linux/printk.h>
>  #include <linux/vmpressure.h>
>
> +#include <trace/events/memcg.h>
> +
>  /*
>   * The window size (vmpressure_win) is the number of scanned pages before
>   * we try to analyze scanned/reclaimed ratio. So the window is used as a
> @@ -317,6 +319,7 @@ void vmpressure(gfp_t gfp, struct mem_cgroup *memcg, bool tree,
>                          * pressure events can occur.
>                          */
>                         WRITE_ONCE(memcg->socket_pressure, jiffies + HZ);
> +                       trace_memcg_socket_under_pressure(memcg, scanned, reclaimed);

This is triggered only when we enter the memory pressure state
and not when we leave the state, right ?  Is it possible to issue
such an event ?


>                 }
>         }
>  }
> --
> 2.39.5
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ