From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Nhat Pham <nphamcs@gmail.com>,
linux-mm@kvack.org, Johannes Weiner <hannes@cmpxchg.org>,
Chengming Zhou <chengming.zhou@linux.dev>
Subject: Re: phantom memory in a cgroup (was [BUG] ZSwap leaks memory upon being disabled)
Date: Wed, 30 Oct 2024 17:41:56 +0300 [thread overview]
Message-ID: <861b38be2afcc1678cc2178a20f85b8fa1842bcc.camel@yandex.ru> (raw)
In-Reply-To: <ea5a4edac46b7776ed0f86ee64c425a04175ff5c.camel@yandex.ru>
On Mon, 2024-10-28 at 01:13 +0300, Konstantin Kharlamov wrote:
> On Sun, 2024-10-27 at 12:31 -0700, Yosry Ahmed wrote:
> > One thing you can do is take a snapshot of memory.stat when
> > memory.swap.current is at a high value (for sddm), then swapoff,
> > then
> > take another snapshot of memory.stat.
> >
> > We should see an increase in either anon or shmem, which will tell
> > us
> > which type of memory was swapped out.
>
> Okay. I will have to wait, because the session got killed by OOM. But
> I
> think it's gonna reproduce in just a few days, my new workflow seems
> to
> be triggering that a lot.
Done. I missed one cycle, which again got my session killed by OOM 😅
Now I caught this in time. The information was retrieved by:
(systemctl status sddm && cat /sys/fs/cgroup/system.slice/sddm.service/memory.stat) > ~/Projects/cgroups-mem-leak/"$(date -R)".log
I wasn't sure how to represent it in email, and decided to post a diff
of "before `swapoff -a`" and "after …", to be viewed with `diffr` or
with `perl /path/to/diff-highlight` of git or similar.
Diff follows:
--- "Wed, 30 Oct 2024 17:27:38 +0300.log" 2024-10-30 17:27:38.401290017 +0300
+++ "Wed, 30 Oct 2024 17:28:12 +0300.log" 2024-10-30 17:28:12.397695798 +0300
@@ -6,8 +6,8 @@
man:sddm.conf(5)
Main PID: 710 (sddm)
Tasks: 9 (limit: 18621)
- Memory: 1.2G (peak: 2.8G swap: 1.7G swap peak: 3.2G zswap: 58.3M)
- CPU: 6h 10min 7.847s
+ Memory: 2.8G (peak: 2.8G swap: 0B swap peak: 3.2G)
+ CPU: 6h 10min 14.748s
CGroup: /system.slice/sddm.service
├─710 /usr/bin/sddm
└─746 /usr/lib/Xorg -nolisten tcp -background none -seat seat0 vt2 -auth /run/sddm/xauth_GXHGRA -noreset -displayfd 20
@@ -22,36 +22,36 @@
окт 28 09:22:36 dell-g15 sddm-helper[925]: Writing cookie to "/tmp/xauth_RKKlcB"
окт 28 09:22:36 dell-g15 sddm-helper[925]: Starting X11 session: "" "/usr/share/sddm/scripts/Xsession \"env KDEWM=/usr/bin/i3 /usr/bin/startplasma-x11\""
окт 28 09:22:36 dell-g15 sddm[710]: Session started true
-anon 42807296
-file 1150423040
-kernel 79376384
+anon 93822976
+file 2957750272
+kernel 18210816
kernel_stack 147456
pagetables 7204864
sec_pagetables 0
percpu 2184
sock 0
vmalloc 12288
-shmem 1150795776
-zswap 61173438
-zswapped 1751408640
+shmem 2958123008
+zswap 0
+zswapped 0
file_mapped 4108288
file_dirty 0
file_writeback 0
-swapcached 17666048
+swapcached 0
anon_thp 2097152
file_thp 0
shmem_thp 0
-inactive_anon 445014016
-active_anon 625201152
+inactive_anon 589209600
+active_anon 2321489920
inactive_file 2895872
active_file 2244608
-unevictable 140836864
-slab_reclaimable 8166656
-slab_unreclaimable 2618128
-slab 10784784
-workingset_refault_anon 69854
+unevictable 141144064
+slab_reclaimable 8169032
+slab_unreclaimable 2625208
+slab 10794240
+workingset_refault_anon 177253
workingset_refault_file 12496
-workingset_activate_anon 33476
+workingset_activate_anon 41579
workingset_activate_file 2372
workingset_restore_anon 12558
workingset_restore_file 2132
@@ -64,14 +64,14 @@
pgsteal_kswapd 1243374
pgsteal_direct 348876
pgsteal_khugepaged 9149
-pgfault 626853
+pgfault 626941
pgmajfault 11521
pgrefill 560417
pgactivate 85087
pgdeactivate 0
pglazyfree 0
pglazyfreed 0
-zswpin 87568
+zswpin 515158
zswpout 1395410
zswpwb 211559
thp_fault_alloc 8
next prev parent reply other threads:[~2024-10-30 14:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 13:02 [BUG] ZSwap leaks memory upon being disabled Konstantin Kharlamov
2024-10-24 20:47 ` Yosry Ahmed
2024-10-25 6:41 ` Konstantin Kharlamov
2024-10-25 7:50 ` Yosry Ahmed
2024-10-26 11:33 ` Konstantin Kharlamov
2024-10-26 17:47 ` Yosry Ahmed
2024-10-27 0:29 ` Konstantin Kharlamov
2024-10-27 3:14 ` Nhat Pham
2024-10-27 6:46 ` Yosry Ahmed
2024-10-27 10:11 ` Konstantin Kharlamov
2024-10-27 10:32 ` Konstantin Kharlamov
2024-10-27 11:28 ` Konstantin Kharlamov
2024-10-27 19:31 ` Yosry Ahmed
2024-10-27 22:13 ` phantom memory in a cgroup (was [BUG] ZSwap leaks memory upon being disabled) Konstantin Kharlamov
2024-10-30 14:41 ` Konstantin Kharlamov [this message]
2024-10-30 19:44 ` Yosry Ahmed
2024-10-31 21:59 ` Konstantin Kharlamov
2024-10-31 22:04 ` Yosry Ahmed
2024-10-27 10:25 ` [BUG] ZSwap leaks memory upon being disabled Konstantin Kharlamov
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=861b38be2afcc1678cc2178a20f85b8fa1842bcc.camel@yandex.ru \
--to=hi-angel@yandex.ru \
--cc=chengming.zhou@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=yosryahmed@google.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