lkml.org 
[lkml]   [2023]   [Feb]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [RFC PATCH] mm: memcontrol: don't account swap failures not due to cgroup limits
On Thu, Feb 2, 2023 at 7:56 AM Johannes Weiner <hannes@cmpxchg.org> wrote:
>
> Christian reports the following situation in a cgroup that doesn't
> have memory.swap.max configured:
>
> $ cat memory.swap.events
> high 0
> max 0
> fail 6218
>
> Upon closer examination, this is an ARM64 machine that doesn't support
> swapping out THPs. In that case, the first get_swap_page() fails, and
> the kernel falls back to splitting the THP and swapping the 4k
> constituents one by one. /proc/vmstat confirms this with a high rate
> of thp_swpout_fallback events.
>
> While the behavior can ultimately be explained, it's unexpected and
> confusing. I see three choices how to address this:
>
> a) Specifically exlude THP fallbacks from being counted, as the
> failure is transient and the memory is ultimately swapped.
>
> Arguably, though, the user would like to know if their cgroup's
> swap limit is causing high rates of THP splitting during swapout.
>
> b) Only count cgroup swap events when they are actually due to a
> cgroup's own limit. Exclude failures that are due to physical swap
> shortage or other system-level conditions (like !THP_SWAP). Also
> count them at the level where the limit is configured, which may be
> above the local cgroup that holds the page-to-be-swapped.
>
> This is in line with how memory.swap.high, memory.high and
> memory.max events are counted.
>
> However, it's a change in documented behavior.
>
> c) Leave it as is. The documentation says system-level events are
> counted, so stick to that.
>
> This is the conservative option, but isn't very user friendly.
> Cgroup events are usually due to a local control choice made by the
> user. Mixing in events that are beyond the user's control makes it
> difficult to id root causes and configure the system properly.
>
> Implement option b).

I prefer option b too.

>
> Reported-by: Christian Brauner <brauner@kernel.org>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>

Acked-by: Shakeel Butt <shakeelb@google.com>

I think we should CC stable as well for early exposure.

\
 
 \ /
  Last update: 2023-03-27 00:07    [W:0.169 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site