From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7ACBD10C16 for ; Sun, 27 Oct 2024 10:25:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 381EA6B007B; Sun, 27 Oct 2024 06:25:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3323C6B0082; Sun, 27 Oct 2024 06:25:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1FA0C6B0085; Sun, 27 Oct 2024 06:25:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 004BA6B007B for ; Sun, 27 Oct 2024 06:25:17 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B84BE141A31 for ; Sun, 27 Oct 2024 10:24:54 +0000 (UTC) X-FDA: 82718999076.25.E54BE87 Received: from forward501b.mail.yandex.net (forward501b.mail.yandex.net [178.154.239.145]) by imf26.hostedemail.com (Postfix) with ESMTP id BA88D140003 for ; Sun, 27 Oct 2024 10:24:58 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=yandex.ru header.s=mail header.b=VhwMqJLV; spf=pass (imf26.hostedemail.com: domain of Hi-Angel@yandex.ru designates 178.154.239.145 as permitted sender) smtp.mailfrom=Hi-Angel@yandex.ru; dmarc=pass (policy=none) header.from=yandex.ru ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1730024507; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=eBHJ+ja8MPAoLAhGqduPHbBvzIgnOol2pu4jm6Pt6JI=; b=6kOR+ROqOTJBYJ7OxgLi1+uDztLX1wBKWupS1Squ3+Wa+0k8j104YxYV0FPkuFcbNIUOtL M4+1GiFhVcTE019XOFsXXDbB+66qHUR3vKNO1MkhNivXSfgUOda5m1SF8etWuc6/LHtcJm baH7u7FQC0y5SGTtsANTUy6oXnOy+6U= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=yandex.ru header.s=mail header.b=VhwMqJLV; spf=pass (imf26.hostedemail.com: domain of Hi-Angel@yandex.ru designates 178.154.239.145 as permitted sender) smtp.mailfrom=Hi-Angel@yandex.ru; dmarc=pass (policy=none) header.from=yandex.ru ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730024507; a=rsa-sha256; cv=none; b=1+SagmjNVIN+MRvs5242Ss3zPm9nLKqax0uINyX+T0TzcNI9eGy0pVinOqCGp2mI6isaP/ 0YK1EH/ZpOXra1h4TmnOM+B/T0KJLtGmJamVV/U50n8tbUxSh7W9KlhTvgKRVUPZCbstAj Eu6n922223zAt1LrIVUOqIEULc2t7ak= Received: from mail-nwsmtp-smtp-production-main-44.sas.yp-c.yandex.net (mail-nwsmtp-smtp-production-main-44.sas.yp-c.yandex.net [IPv6:2a02:6b8:c08:df8e:0:640:17d3:0]) by forward501b.mail.yandex.net (Yandex) with ESMTPS id 546D561021; Sun, 27 Oct 2024 13:25:13 +0300 (MSK) Received: by mail-nwsmtp-smtp-production-main-44.sas.yp-c.yandex.net (smtp/Yandex) with ESMTPSA id BPUBRaJXqGk0-2W4nl0cb; Sun, 27 Oct 2024 13:25:12 +0300 X-Yandex-Fwd: 1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1730024712; bh=eBHJ+ja8MPAoLAhGqduPHbBvzIgnOol2pu4jm6Pt6JI=; h=References:Date:In-Reply-To:Cc:To:From:Subject:Message-ID; b=VhwMqJLVsGa0G8RZvqWzfIfam9N4FU6US+sD6jxOa/x3WXjs8FTi+SHF/aqXJt1lU PYeESrgx0z1Mt3YWk9XW5qsDqa6D3SHsBFX0vcUuuDl53eR79VEgXYL4H4IeTv4TW0 qRpjegmO2bP+/FE4r/NIFn7DWoKtZTWzmCsAvod4= Message-ID: Subject: Re: [BUG] ZSwap leaks memory upon being disabled From: Konstantin Kharlamov To: Nhat Pham Cc: Yosry Ahmed , linux-mm@kvack.org, Johannes Weiner , Chengming Zhou Date: Sun, 27 Oct 2024 13:25:11 +0300 In-Reply-To: References: <7d873b2682a7513a4d5aad5ac09f5c78851efbb6.camel@yandex.ru> <28352fb75268060f2e78a32325f02e46737a16ea.camel@yandex.ru> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.54.0 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: BA88D140003 X-Stat-Signature: p4foj9qi419w8hnsfq4ono5u91jnznn1 X-Rspam-User: X-HE-Tag: 1730024698-187658 X-HE-Meta: U2FsdGVkX1+IJYfDByS/rSWdD7clxYaSs+DkCEPiuFePP7ASo3m3csIXXnP53iQvP2IEnSMLDhrXWnWHpcEHxehgX7w5h4wk0dOf5t5MTOrtIZMnDyapIQffMW376VlycHmgGHfNx24Eh4l78jUUXXuuABd/Y7cVL+aUEG/mQVXTzqeXIbD9SAtBD0WlyKvuIXEoSeySCrjF4qLTjSBPAtCEhxYM1Fg58DH0cz3Oc9nSJarbB46MDd6fuK32L28Q01cdHo7CU+bsvc2P2ll4ADqZHeipRFgi8Y3tz0Ua6ezGFaBGKJzo7TkENNb3ZFDvGapvbQnyha0ogv50LGsBelAAV8ox7O6NRFGmBsFmseg4C0Hq4EJSmb2y9+gRRFHamyL1u8bBdigMjqlitFMTr+8XvpgzxYpYHrdc/0YNR9ovvfK1oXIg9EVc7dr8JepzUTBGdPul2Eg0jKAl96Z9Twd/50HN1tLuA4fhtesl9FdoS3RUxLynYxlP9wI84tGVzb1cFYcgr82h8ni2pY2sqVdy+U28SQTV7pjDhHRReJqYhus03/EYe/efH0/mEucjZheUqXGZMQgWq4oJUJ2ovwtpnuzHQAbGKlKlAjqn2pIFggAGppplN3KPqmxwsnT+B66Eu6Jub6IhMTXBCvon5Nd74FvfljFKlXqn320c0Urckism43HF5wdGI2WNuuFbFdFJLy4iZMpk8PQUlqF3pe7tAt+vfcyGy2eXjh/7RJWtbyc5tNUz1aJkATX8NHVmDrH0tbsSIHXmbp82Cka+ahvjZkc3ohxqVuKlkRbpgc3GdT8mYtttvOSp8IoZF526yUkv6NYWSATMmj9zC9hiEmYzUrwn36dJvpfb3U/a1GoFujTKeYFjc4LWqGAikpiISZNjsfH+EPsfs9W4v8BZds2LtCV6mDdZU0Li9rrSPJ0Z3LVBIJ3Um/BBY4x2yrO6SltgeeO5mGHn6A8MiFM AGXTEFir wgskuwFrNjZXKmTiqx9+oVemB38YrjZjuBZ4J/vSJcjcPlvd0SOfTHYrkUvn7+V2Pjqb6WzTU7K6BQbzvxyewW7f6BpbozQ5ZHlam45zDgputMq9fPzDx9QMDNuHBB9YB50ekIFEF8cuOupRzH0gBMH/E5vMJhblXd8FSu8OdVo4KPVY97wEmwYCpEx9NMs61Nn7/lKLWc5ggwwTQGg+6PLlp7NxZ7nckQ89NN/TX7ekSQjgC4GiXawgfR/H0Z80yBgR7lslTmmbofKxm02K/mNmsj/K1xH2oa69StLf0ZryoiVqOrmDTUN523+nXFLtZz6OaJw62yta920Tss6iSAQiCyizJYaNM5UQ2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.017509, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Sat, 2024-10-26 at 20:14 -0700, Nhat Pham wrote: > On Sat, Oct 26, 2024 at 5:29=E2=80=AFPM Konstantin Kharlamov > wrote: > >=20 > > That was a good idea! The > > `/sys/fs/cgroup/system.slice/memory.swap.current` seems to have the > > missing half of the SWAP memory. From my understanding of the > > `systemctl status` graph `sytem.slice` and `user.slice` groups do > > not > > intersect, and by adding up `system.slice/=E2=80=A6` + `user.slice/=E2= =80=A6` I get > > around 8G. > >=20 > > However, I'm still unclear what does this memory belong to. > > `system.slice/memory.swap.current` is 4.4G currently, that's a lot > > and > > I'm not seeing anything that could take so much memory. >=20 > I assume you do not have any proactive memory reclaimer? :)=C2=A0 No, just the kernel with `vm.swappiness =3D 100` and with ZSWAP (ZSWAP is on on Archlinux nowadays via CONFIG_ZSWAP_DEFAULT_ON). > I believe > the top utility can display swap usage by process. Have you tried > that? I just tried. Well, the data seems the same as what `smem` shows, except I can't add up the column numbers because top is interactive =F0=9F= =98=8A I noticed plasmashell was too bloated, so restarted it. Didn't solve the problem with some unknown memory taking gigabytes in SWAP though. > There are a couple of edge cases - for instance, if you disable zswap > writeback and zswap at the same time. We will allocate slots on > swapfile, and store it at the page table entry, but we cannot store > the page's content in zswap or the swapfile, so the page remains in > memory. You're occupying swap space, but are not really saving any > memory usage. I never disabled zswap writeback and as of writing the words zswap is on, so this certainly not it. > IIRC, there is also an edge case where a page is faulted back into > memory from swap, but the associated swap space cannot be immediately > released. This should be temporary though - memory reclaimer will > attempt to release these pages later on, or they can be released when > we scan the swapfile for slots during swap out. Replied in a separate email.