From patchwork Mon Sep 18 12:09:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13389537 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 24407CD37B0 for ; Mon, 18 Sep 2023 12:10:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B19376B0329; Mon, 18 Sep 2023 08:10:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AC7046B032B; Mon, 18 Sep 2023 08:10:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9DF346B032D; Mon, 18 Sep 2023 08:10:36 -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 8F1586B0329 for ; Mon, 18 Sep 2023 08:10:36 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 68D8A16033A for ; Mon, 18 Sep 2023 12:10:36 +0000 (UTC) X-FDA: 81249601272.22.A4110CF Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf26.hostedemail.com (Postfix) with ESMTP id D541114000A for ; Mon, 18 Sep 2023 12:10:32 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of ruanjinjie@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=ruanjinjie@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695039033; 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; bh=SQj0XjZlvDVuTPBNiLfEoMO3isjlh9uqOVrXvHZdD30=; b=vPp7unbGLkD1NiqYX6n0+mc78dcvFgePv3vvytCzit5GMUYYwQ4uDQQCNNM0scPYhJ3MGz A+lZ3joRgs7yPesSZIDZapT5C5rEpYGaOEplyn7W+sEZUUYBhqyKX0ixgIiWGPng7opg8t Th87167ce1jve9LW66UwXE5Z23vXJjg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of ruanjinjie@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=ruanjinjie@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695039033; a=rsa-sha256; cv=none; b=H3ElbfRSk1U9tZZaBbS6/xsJk2f1J5qR+wCPXekdIhiGja/xXkdO9lHBn31mVObvtJE3B4 YvWJPGKL22gU0tUckhpewTynEwggC46T1LKcs3oLUqI2zMnBO4rpd8GEEew7RFybGXiOia V5V8wV/2vs7Zyt5tkt45k4+SKebRxg4= Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Rq3RV4p9WztSbb; Mon, 18 Sep 2023 20:06:14 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 18 Sep 2023 20:10:26 +0800 From: Jinjie Ruan To: , , , , , , , , CC: Subject: [PATCH v3 1/2] mm/damon/core-test: Fix memory leak in damon_new_region() Date: Mon, 18 Sep 2023 20:09:50 +0800 Message-ID: <20230918120951.2230468-2-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230918120951.2230468-1-ruanjinjie@huawei.com> References: <20230918120951.2230468-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D541114000A X-Stat-Signature: dtwuyscda4ks7cwkpjf6zhnp7b1yefrb X-HE-Tag: 1695039032-907153 X-HE-Meta: U2FsdGVkX18PTbxLgH3jNBq6KqV5Qvduh0S5s6VHLle/xH///Qhn5+1uw3D/jsUni/u5x8BNl3PxOF3xtv8Akui3SchCv6VdXAhqaVMQhtl+AtlRsF3h5yovwpRDXUM5uRS1oHnOrA+3pvbeB1+uXpLQC4MctzZMAMUJOVmtBtB5X+S37bB5886uuvJUjQM+6PojVbWF7nJaARlVKhFC3cKn2Q7Y0gL52a1pCKJf+0M3p0iipu/2JmuoQRN7EBX9jWcKeUsY/c/DuFg+bno5CvaQxyGwq6bZHtJDaizge3gCfCigOPzyHNipd9GKRcXbx9sOYc7Apgi7+zj2H1PWRcmtwHGvJ6e1vHEvGnXofXXrm0S3gR7KkuDWCsyxpCRQrCLlm6EZXNk/lzOqtWqX7MBnX8giWPmZ3g38aGH2MVlswLC5o7QWZ6sJ2d8lVFN5dUmUMJ0OMDdf2wIkqYAUCnsJ7oVhh1f7KT+RaqkYrzH3qCpIhTWeHxIm3VOSzOshzup/vZub4B7xTEGB/yEQbpn5TFLiWeA0bLT5FQcNcHOZvjMGVEHKBZwdcK3FFNzhVgaGNW9iQ9jVsBdN6GeIFFqJoiOclUaALQIoCnH6ZM2lkLuJG2Xd/4NwaVZjx8Rw1qmD6NvutW9KsWU9xL07DUKjn7qvrDpGr8Nq6BAzxIaXSrsF27E+KwMfXJql8+Jqm+ofmGdFfqzvnoy+h3e61dUV+SSjRPYASmHunYgOgzziKNrI47aghOTJqXr0GZpFqu13ippjsS1KizhcV6SUzKDDzj2u1we+RDeRJjmBnGFs7TLC0gQ3rDaNyjobf5+WA3423Ro0BjAd1TQ3P0e1v6TYUvZzD/hCqu1jPRmSu5/pxCwWaVNKbLNa2hXBnVZi75PvooGz+VW91OxJC2ygfn2RGZBUWvs6jpOZ0HkAkI2BbpE1l0q2w1jqlkU9DUjBmo4DBEKOvXk8rLzKaOW bafOMwi1 fuSMIxFz8xZKd272ZMWnczr3YC+u/k7rnWCGfd4bH6512H3cc3Uf2pHVtPrU62PZe8G6WyXGu9/+pCvXo0PGBjZHyW2NvG0bt/e77FdBu6AxNMlE26HBXf8w+3nNKclf7wX2NTm+2L0oY6+e7BBQRWjAnDNsJuWbDGq9ERU5vaVeqpkCouG12Xcy6NrcgjDFtTb6kDO+qYdGtnrgVfk7ksT2Qr0Bs5UGqySiujIyc7iEusBpsZmGsnGZCHGtn5QLT43xQ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When CONFIG_DAMON_KUNIT_TEST=y and making CONFIG_DEBUG_KMEMLEAK=y and CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y, the below memory leak is detected. The damon_region which is allocated by kmem_cache_alloc() in damon_new_region() in damon_test_regions() and damon_test_update_monitoring_result() are not freed. So for damon_test_regions(), replace damon_del_region() call with damon_destroy_region() so that it calls both damon_del_region() and damon_free_region(), the latter will free the damon_region. For damon_test_update_monitoring_result(), call damon_free_region() to free it. After applying this patch, the following memory leak is never detected. unreferenced object 0xffff2b49c3edc000 (size 56): comm "kunit_try_catch", pid 338, jiffies 4294895280 (age 557.084s) hex dump (first 32 bytes): 01 00 00 00 00 00 00 00 02 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 00 00 00 00 49 2b ff ff ............I+.. backtrace: [<0000000088e71769>] slab_post_alloc_hook+0xb8/0x368 [<00000000b528f67c>] kmem_cache_alloc+0x168/0x284 [<000000008603f022>] damon_new_region+0x28/0x54 [<00000000a3b8c64e>] damon_test_regions+0x38/0x270 [<00000000559c4801>] kunit_try_run_case+0x50/0xac [<000000003932ed49>] kunit_generic_run_threadfn_adapter+0x20/0x2c [<000000003c3e9211>] kthread+0x124/0x130 [<0000000028f85bdd>] ret_from_fork+0x10/0x20 unreferenced object 0xffff2b49c5b20000 (size 56): comm "kunit_try_catch", pid 354, jiffies 4294895304 (age 556.988s) hex dump (first 32 bytes): 03 00 00 00 00 00 00 00 07 00 00 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 96 00 00 00 49 2b ff ff ............I+.. backtrace: [<0000000088e71769>] slab_post_alloc_hook+0xb8/0x368 [<00000000b528f67c>] kmem_cache_alloc+0x168/0x284 [<000000008603f022>] damon_new_region+0x28/0x54 [<00000000ca019f80>] damon_test_update_monitoring_result+0x18/0x34 [<00000000559c4801>] kunit_try_run_case+0x50/0xac [<000000003932ed49>] kunit_generic_run_threadfn_adapter+0x20/0x2c [<000000003c3e9211>] kthread+0x124/0x130 [<0000000028f85bdd>] ret_from_fork+0x10/0x20 Fixes: 17ccae8bb5c9 ("mm/damon: add kunit tests") Fixes: f4c978b6594b ("mm/damon/core-test: add a test for damon_update_monitoring_results()") Signed-off-by: Jinjie Ruan Reviewed-by: SeongJae Park --- v3: - Update the commit message to be more accurate. - Add Reviewed-by. v2: - Replace the damon_del_region() with damon_destroy_region() rather than calling damon_free_region(). - Update the commit message. --- mm/damon/core-test.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/damon/core-test.h b/mm/damon/core-test.h index 6cc8b245586d..28d24e698318 100644 --- a/mm/damon/core-test.h +++ b/mm/damon/core-test.h @@ -30,7 +30,7 @@ static void damon_test_regions(struct kunit *test) damon_add_region(r, t); KUNIT_EXPECT_EQ(test, 1u, damon_nr_regions(t)); - damon_del_region(r, t); + damon_destroy_region(r, t); KUNIT_EXPECT_EQ(test, 0u, damon_nr_regions(t)); damon_free_target(t); @@ -316,6 +316,8 @@ static void damon_test_update_monitoring_result(struct kunit *test) damon_update_monitoring_result(r, &old_attrs, &new_attrs); KUNIT_EXPECT_EQ(test, r->nr_accesses, 150); KUNIT_EXPECT_EQ(test, r->age, 20); + + damon_free_region(r); } static void damon_test_set_attrs(struct kunit *test) From patchwork Mon Sep 18 12:09:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13389538 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 026C0C46CA1 for ; Mon, 18 Sep 2023 12:10:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 571966B032B; Mon, 18 Sep 2023 08:10:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 521E06B032D; Mon, 18 Sep 2023 08:10:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C3746B032F; Mon, 18 Sep 2023 08:10:38 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 2D9716B032B for ; Mon, 18 Sep 2023 08:10:38 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 024111CAB14 for ; Mon, 18 Sep 2023 12:10:37 +0000 (UTC) X-FDA: 81249601356.05.79DDB64 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf11.hostedemail.com (Postfix) with ESMTP id D97DC40012 for ; Mon, 18 Sep 2023 12:10:34 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of ruanjinjie@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=ruanjinjie@huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1695039036; 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; bh=TL79/b7WRnBrG95p+70ViKkiyAU9oWj/HDEFTEwS2ZM=; b=4EZmu+kWQiimlfkGANUGANHsPLj6B8QI70uQEo63qVoertIOIowKa45H4irjGlDlnf7E13 JvLVU4Fng9p01RFi/RVl28pU2coKeQb2OY9LomAsM01PaehwPhYUCo7t+Bymx/pzqvL9vM agSojPbUa9q8b73HdKufBZ8yNUj4QD0= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf11.hostedemail.com: domain of ruanjinjie@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=ruanjinjie@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1695039036; a=rsa-sha256; cv=none; b=VKr3knM1C4+FTGuUgZRBprh+87TBmgjmfdzQE4EiddlnzO3AD9uiqblGY64x4diit6PngS dx/WzAKcom/CaXzSd0ERl6N2wcdvErZUYgcEYY81Ph9gBqnpEQSx4f5rD4zi375PhR8c6k aNFKWlXulc9/OBeWjfb4p9DZFxXEwgg= Received: from kwepemi500008.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Rq3T12BGVzVkwV; Mon, 18 Sep 2023 20:07:33 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemi500008.china.huawei.com (7.221.188.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Mon, 18 Sep 2023 20:10:27 +0800 From: Jinjie Ruan To: , , , , , , , , CC: Subject: [PATCH v3 2/2] mm/damon/core-test: Fix memory leak in damon_new_ctx() Date: Mon, 18 Sep 2023 20:09:51 +0800 Message-ID: <20230918120951.2230468-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230918120951.2230468-1-ruanjinjie@huawei.com> References: <20230918120951.2230468-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemi500008.china.huawei.com (7.221.188.139) X-CFilter-Loop: Reflected X-Rspamd-Queue-Id: D97DC40012 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 16k41mbbpboje11khj11onbnhsmu3u54 X-HE-Tag: 1695039034-654067 X-HE-Meta: U2FsdGVkX18HSdq3B2fDjbMh3juOo7FgfiZ6PlaOx/78Gjg0zAVKFRckzr5jqtts1o8r1ys4vqgFY5vpuREtHVrgtQfZh4XVW5zZ575glKIeqExfjoDicjI1g3D+H5H+pPf8tyDzDHg7fd5DfBO1IKQoJSWDdcszMpwTCBE/q0aaaVMKmKLgiZ1NoExevOm7CUlYMSMd7VcNBzzrY64mHwXfYyq8a/ZxcyaKUcunJeMptZqGvwNU1yJ5ipDElvNHcxDJbcCt/MfFhhnGU4rsXmP8WVYQMGL4VvThd5ATcJR1nm94TKKjl2OWO5NEv4a1uQVFkjoq04J6XHCpRnTvKD0ZwjnmoBQ8gl+RyOC2bl8zPzkUQhmQopV8nbyeUQcJIyJ7Vz6D1Ukon5UIijpDRFVIvsUyG14u7QIE7fip4v1qi1fqYszK9BbuAxOwa9kruA9tl3/eJszeYujJYX3mm4Fu2725fDNLTXvM+ZjgdHE97hZycmWBV1XVgbyoAkGdvcA2X9K/adAso6fr0bAmMR+2YsYPHmEpzhk6p4CjdpE9MqEUuASFaLCTmuTn91ntMluKSr2AmKYAoOtc0lylclhTjyIYwbWx3L3TQFuJhjDV/3Chk4km4TPEDEg+x6rS2BI975R6GFu7ePsAXZQgFOTvp53Ndr+3g3ZoLX7H8c5azxE8r98IrKBz61IAmHPlzVBBCuLVHUWAd3B4pTxsMQNIIOse4bJJvoBJUSeAQnQ6q9thD3DH4ia1l8x+yiOVtlLm+TfUsEImxbbiY4YSFdjeONk5aMNwoK3qbs54bDLyHUiWTA4jN6X3cJk2z7NlMs0nexrGUlrcNt0jXrzMxUeCqlKKXa4vBstiWjBBn/Tp4SnSUDjkSzRbQ/eWxtLs3eXmEc2f0sg6L95sF8Mua/NjwMp6c0bFtH3HNkT+/84pK3gQeBL+KKCS9n5vEBRBVrKba8wUGfQCEHlYn7X WhBlMHJR TSL7uqMuPO7QKErjn7TGGfBv6NfTSYeadnkDcnFwaA3gDPUUrqAwuS54HSnwerEWqIqH8RnykxDQf9PTr6M25WZgO6CI0j54VC0nQd89tui4lR9R8IcJ0C6xPVJ75lQmxQMIyABjReyPTcYhTAYpRMrLP4BIi35fSt79lrk5U3hBHQMyxMzad3A3azc0gj9JYKjQlQDmZYY5JI7SzaLALJBSs2jEwviVUxgKcF7GY7ECPV3vopJNHUv3gAVQl2R0wz470pYS/LCo1ScVlTaQnrlqmUQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When CONFIG_DAMON_KUNIT_TEST=y and making CONFIG_DEBUG_KMEMLEAK=y and CONFIG_DEBUG_KMEMLEAK_AUTO_SCAN=y, the below memory leak is detected. The damon_ctx which is allocated by kzalloc() in damon_new_ctx() in damon_test_ops_registration() and damon_test_set_attrs() are not freed. So use damon_destroy_ctx() to free it. After applying this patch, the following memory leak is never detected unreferenced object 0xffff2b49c6968800 (size 512): comm "kunit_try_catch", pid 350, jiffies 4294895294 (age 557.028s) hex dump (first 32 bytes): 88 13 00 00 00 00 00 00 a0 86 01 00 00 00 00 00 ................ 00 87 93 03 00 00 00 00 0a 00 00 00 00 00 00 00 ................ backtrace: [<0000000088e71769>] slab_post_alloc_hook+0xb8/0x368 [<0000000073acab3b>] __kmem_cache_alloc_node+0x174/0x290 [<00000000b5f89cef>] kmalloc_trace+0x40/0x164 [<00000000eb19e83f>] damon_new_ctx+0x28/0xb4 [<00000000daf6227b>] damon_test_ops_registration+0x34/0x328 [<00000000559c4801>] kunit_try_run_case+0x50/0xac [<000000003932ed49>] kunit_generic_run_threadfn_adapter+0x20/0x2c [<000000003c3e9211>] kthread+0x124/0x130 [<0000000028f85bdd>] ret_from_fork+0x10/0x20 unreferenced object 0xffff2b49c1a9cc00 (size 512): comm "kunit_try_catch", pid 356, jiffies 4294895306 (age 557.000s) hex dump (first 32 bytes): 88 13 00 00 00 00 00 00 a0 86 01 00 00 00 00 00 ................ 00 00 00 00 00 00 00 00 0a 00 00 00 00 00 00 00 ................ backtrace: [<0000000088e71769>] slab_post_alloc_hook+0xb8/0x368 [<0000000073acab3b>] __kmem_cache_alloc_node+0x174/0x290 [<00000000b5f89cef>] kmalloc_trace+0x40/0x164 [<00000000eb19e83f>] damon_new_ctx+0x28/0xb4 [<00000000058495c4>] damon_test_set_attrs+0x30/0x1a8 [<00000000559c4801>] kunit_try_run_case+0x50/0xac [<000000003932ed49>] kunit_generic_run_threadfn_adapter+0x20/0x2c [<000000003c3e9211>] kthread+0x124/0x130 [<0000000028f85bdd>] ret_from_fork+0x10/0x20 Fixes: d1836a3b2a9a ("mm/damon/core-test: initialise context before test in damon_test_set_attrs()") Fixes: 4f540f5ab4f2 ("mm/damon/core-test: add a kunit test case for ops registration") Signed-off-by: Jinjie Ruan Reviewed-by: Feng Tang Reviewed-by: SeongJae Park --- v3: - Add a new Reviewed-by. v2: - Add Reviewed-by. - Rebased on mm-unstable. - Update the commit message. --- mm/damon/core-test.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/damon/core-test.h b/mm/damon/core-test.h index 28d24e698318..b2a388ee062d 100644 --- a/mm/damon/core-test.h +++ b/mm/damon/core-test.h @@ -265,6 +265,8 @@ static void damon_test_ops_registration(struct kunit *test) /* Check double-registration failure again */ KUNIT_EXPECT_EQ(test, damon_register_ops(&ops), -EINVAL); + + damon_destroy_ctx(c); } static void damon_test_set_regions(struct kunit *test) @@ -341,6 +343,8 @@ static void damon_test_set_attrs(struct kunit *test) invalid_attrs = valid_attrs; invalid_attrs.aggr_interval = 4999; KUNIT_EXPECT_EQ(test, damon_set_attrs(c, &invalid_attrs), -EINVAL); + + damon_destroy_ctx(c); } static void damos_test_new_filter(struct kunit *test)