From: Michal Hocko <mhocko@suse.com>
To: Liu Jing <liujing@cmss.chinamobile.com>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: The percpu memory used by memcg cannot be cleared
Date: Fri, 30 Aug 2024 09:08:22 +0200 [thread overview]
Message-ID: <ZtFv5jDx3Y3NMPrH@tiehlicka> (raw)
In-Reply-To: <20240829170644.15588-1-liujing@cmss.chinamobile.com>
On Fri 30-08-24 01:06:44, Liu Jing wrote:
> hello,linux boss
>
> I found a problem in the process of using linux memcg,When I turned swap off, the memcg memory I created with the following script could not be deleted with echo 0 > memory.force_empty, as explained below。
>
> ----------------------------------------------------------------------------------------------------------
> step1:swapoff -a
>
>
> step2:use this script to create memcg
>
> #!/bin/bash
> mkdir -p /tmp/test
> for i in 'seq 2000'
> do
> sudo mkdir -p /sys/fs/cgroup/memory/user.slice/user-0.slice/test$ {i}
> sudo echo $$ > /sys/fs/cgroup/memory/user.slice/user-0.slice/test$ {i}/tasks
> sudo echo 'data' > /tmp/test/test$ {i}
> sudo echo $$ > /sys/fs/cgroup/memory/user.slice/user-0.slice/tasks
> sudo rmdir /sys/fs/cgroup/memory/user.slice/user-0.slice/test$ {i}
> done
[...]
I assume you /tmp is tmpfs backed.
> Therefore, I want to know why swap affects memcg memory reclamation,
> echo 0 > memory.force_empty this interface should force the memory
> used by the cgroup to be reclaimed.
If the above is true then you simply do not have any backing storage to
reclaim to. You need swap to reclaim tmpfs/shmem memory.
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2024-08-30 7:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-29 17:06 Liu Jing
2024-08-30 7:08 ` Michal Hocko [this message]
2024-08-30 3:22 liujing
2024-08-30 7:13 ` Yosry Ahmed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZtFv5jDx3Y3NMPrH@tiehlicka \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=liujing@cmss.chinamobile.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox