Bug 258787 - geli leaks memory
Summary: geli leaks memory
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Gleb Smirnoff
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-29 19:10 UTC by Li-Wen Hsu
Modified: 2021-10-01 20:33 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Li-Wen Hsu freebsd_committer freebsd_triage 2021-09-29 19:10:12 UTC
Since this build: https://ci.freebsd.org/job/FreeBSD-main-amd64-test/19372

The test case sys/geom/class/eli/attach_test:attach_d generates lots of messages like this:

    Freed UMA keg (GELI buffers) was not empty (0 items).  Lost 528 pages of memory.

And the while test procedure was killed in the end because of out of swap space.

On i386 ( https://ci.freebsd.org/job/FreeBSD-main-i386-test/13356/console ), it panics with:

    panic: deadlres_td_sleep_q: possible deadlock detected for 0x27685000 (mdconfig), blocked for 180141 ticks

when executing sys/geom/class/mirror/11_test:main or sys/geom/class/mirror/12_test:main , it may also caused by out of memory.

It may related to these geli/swap changes:
base 2dbc9a388eeb73a6b17eb6fd1349a2a7e95123cc
base 183f8e1e575b526515e70400a22af243cd1a4a78
Comment 2 commit-hook freebsd_committer freebsd_triage 2021-10-01 17:31:52 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b984d153e057b7879632b8e6015a05ce3f177580

commit b984d153e057b7879632b8e6015a05ce3f177580
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2021-10-01 17:24:50 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2021-10-01 17:31:17 +0000

    Don't set GELI UMA zone as UMA_ZONE_NOFREE.

    That fixes memory leak on last GELI provider destroyed, introduced
    in 2dbc9a388ee. This patch was originally developed late 2019 and
    the flag was necessary to prevent zone drainage under memory pressure.
    Today, with f09cbea31a3f the UMA is fixed not to drain into reserves.

    Discussed with: jtl, markj
    Fixes:          2dbc9a388ee
    PR:             258787

 sys/geom/eli/g_eli.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
Comment 3 Gleb Smirnoff freebsd_committer freebsd_triage 2021-10-01 17:35:47 UTC
Li-Wen, can you please re-enable GELI tests in CI. Sorry for the problem.
Comment 4 Li-Wen Hsu freebsd_committer freebsd_triage 2021-10-01 20:33:57 UTC
(In reply to Gleb Smirnoff from comment #3)
Tested and re-enabled the geli tests in https://github.com/freebsd/freebsd-ci/commit/db3e2f8eaf414ccd7efb162e46778eb36f32ce60