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 F2DE0CF9C6F for ; Tue, 24 Sep 2024 15:37:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 87E646B00A2; Tue, 24 Sep 2024 11:37:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 82C256B00A3; Tue, 24 Sep 2024 11:37:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6CCC66B00A7; Tue, 24 Sep 2024 11:37:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 45C416B00A2 for ; Tue, 24 Sep 2024 11:37:12 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id F276D81844 for ; Tue, 24 Sep 2024 15:37:11 +0000 (UTC) X-FDA: 82600035462.14.E3EE0CE Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 06A6E80012 for ; Tue, 24 Sep 2024 15:37:09 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GarYv3Ov; spf=pass (imf02.hostedemail.com: domain of chrisl@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chrisl@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1727192111; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LmlkT4xjBEkNZDsuHQHxN+9Xxvo1pcCjCf5KO2cDLfk=; b=AN6XQS6SldiKCq8xubFmSK+Wi/qjx+8RW5R+J8ZI0jze5JuJUCdIzMdV9KCdBJ19wQVrKU jfzqZRamPLhV+SR5pviPiMgCvTmDUen1eUYCgEJRzrtkfEAD58tHPCrOpeRTGxp07EDSnu 0/5oM16kI0wM//lt9jrOzHwYvrLM+og= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1727192111; a=rsa-sha256; cv=none; b=t5xuBXOBoGhw9XkhoM41owVil4mYd0WRjnVHBALbKfD+G9q89gwa+OaNdHCx0X8ii9TlKs dyhznyuK7F7FiED96aAx08IS3rUhpKDndxMAkIdE+83KothSa4BWhtUlqlAKs2gSULr8d8 UQXS9hpHsNSEUve5wPKkaKFxYS9PEi0= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=GarYv3Ov; spf=pass (imf02.hostedemail.com: domain of chrisl@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=chrisl@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id B6F545C4CDE for ; Tue, 24 Sep 2024 15:37:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42CB0C4CED1 for ; Tue, 24 Sep 2024 15:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727192228; bh=X87M23vXy/+UKm5prN70WHHA3mzys0TlJtJMxus/SpM=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GarYv3OvdB4QNq8aLRPtFKb+Mcizx+6UV/iKeuVewyoOftC3GmdzYTmuAN0md0HZ2 eFJTqVDw3uUwAP6sTUMyldyS75+81ZZkupgw/UcQYFVATNLu15xWCEkS/zBJFD7tIy vg7gVznUrCqKQnd5seFuvP8JZcAY5P+n7ob/WTS4VPdWTxNFL+BSGsH3CyvppL+gVk 3xv/Qm4nZNsLhNzoVDAn2uvCU0+2wavwfUQcgRTCUz6b1Zqlby+Nd4U+zXVKzuz1aw mEreo5iaEruiPhCkVCLuMVXcTOKDYXydTT6P3ZJNuUyfenf6iMXbhiK5oCu4YK8j75 UdkKHOdnyUO3Q== Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3a0cb892c6aso364825ab.0 for ; Tue, 24 Sep 2024 08:37:08 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCV9rs6V7vivFG+2mOJRCld3qySeyTmaJ/tJbt7FMNDuI11CwjbUYxG6748Nf1qqCUDosDWFklj/uw==@kvack.org X-Gm-Message-State: AOJu0YxJprtO8BpHjedVlZLh/Rv/CpLPvdhzSE9EYkEdVXQvH466VXwA jukKcJdsmP8OhR907HYV/L1gqzfsU/MpBq3T71JmvuPkuTiLx6jSbC0bfa9g8mzJdE8E55K394B YRzFHXNit9rruKSrk72KuS6FqZwXvLSXkKWw5 X-Google-Smtp-Source: AGHT+IF8aC0HqPDerO3PzCYjW0TTtnt+sA6rpr3uPglCUrGQEBEQ6wvzGA4c+vD9osv/GpcQxc4EKwBTmWNB/braJYs= X-Received: by 2002:a92:c545:0:b0:3a0:a233:caf8 with SMTP id e9e14a558f8ab-3a1a3f9fb7fmr3581035ab.26.1727192227291; Tue, 24 Sep 2024 08:37:07 -0700 (PDT) MIME-Version: 1.0 References: <20240911025600.3681789-1-senozhatsky@chromium.org> <20240917013021.868769-1-senozhatsky@chromium.org> In-Reply-To: <20240917013021.868769-1-senozhatsky@chromium.org> From: Chris Li Date: Tue, 24 Sep 2024 08:36:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCHv2] zram: free secondary algorithms names To: Sergey Senozhatsky Cc: Andrew Morton , Minchan Kim , linux-kernel@vger.kernel.org, linux-mm , Kairui Song Content-Type: multipart/alternative; boundary="0000000000002b501b0622df47d2" X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 06A6E80012 X-Stat-Signature: 5ajw8u6bux8wwio5dw9dxnagzt48rhy6 X-HE-Tag: 1727192229-389466 X-HE-Meta: U2FsdGVkX1+BW4T7WbCZUjcQp+0HXc0kuUv34bnk9RVRosrKkYdOnEuZPIXHv8VMHHuqiOiiVFyUDkI0kxMEHl4RLZJVUzWFXEVp66lRf0cEbHqOw6iWCeBn/xFsjJ4KL7Xm8gcTe6Ki80ow1AuTnEKPBWEbb2jlpg0l2eNXVugeWOdBYl6a7NCp9GD7Mj+Zwqu+yIFLGiLgnuinGPBoOJH84c90YolCGBiERcqO1VwgU8u8/D1dhiY/OnInflh1epB0yzYDRXyZBN90YfitZuZfirWlxX/FVbufN/KwY5WtrjJCj90qUw11M1JxVde0iQZxbXTfqd8xV8BI/Hbj4JDXUEo1GCI/Eks4Vo4u54rXU1ZvhYPxVzuC7ihKD9mVl5Nnd5uAaOixmYRsBWcMJmXTwsgED5cTfqjN4+55NZrvIJ7AAn2PuICFQbjLm6rGVXvHAKGCgJaoEn22N97AtrXfRLcHxu8/hYHunTyZrZpHyWXtrtooGU+SZDQppISzcTzgy6Auzs2MRXTqj9Thci8gebbQw9MojOlVMiHq60Wk4gSoKuJwpgIOU5lh+aMpRTarjdcm5gyrV6Xtuejj6VUNDWVTVcmve3SBlZ+rOuMwVfSaP5z8woiGJMd1LUo6Ay5GYMX/ZX4Qeee3CV04x3igMsGoc1bqHaO4R4JTQHYTEBdEErwpyqqAdoht1Z3Wcr0ZZTvDLrTnGxyEjHWyl9nMKb+YxpFIYLkGh35Y7tUPKmEtxCSxSCS9cCszNG4+EzfLSqY87X3r8srZXJh8YMmcovJ0crFoxkYhfDMe9vhPt89pZL5RTNwOauvU1BIVzam+xdEabJr5EJw3I6vHrwusFI64k3wmLsmCKoevui4FMPtBBxslMb08r83WwQKoNDcNQSUSDwUSMBnYilhl0ZQWhQv+XkMQ3Wn6Y8eJHuT3Vn5K0HmdNXrSIg54TL3wWwKsJOS+ANRDlf32ySa ANwnyf5Y KFnu7xsTf/QFPSAqDcLERUW/10UV5WVfw1VvyDu4jIZ+2oW4orwzNputGN/WAgdlU9n3vbeflFMzajZFOsHnPpUsm77Qfgmi5sgvlBIqBtLGzuQYbU7+kaXNhHiwK07C0WaLPHqsxbky8xf7SxX1vxIogBGVYgCSBwNB0Z6ikwlQiQb3Ubtyam0GAFh85u44JYn/hRlFIOagdCIAYhzY12WSzvH5FGEfB3glFUBZ6pbm3v55KsU85TzJkdJoJX4QmVojOODap/S32Nyv4o715W9JpwOi0AmY3MAVSwz8C/oxXcQs3GfMl/utvET2av/oGQCUfGj7HLaie7c39LfoiyGlfa7gR0oOoXP/fK+ezYi7VwTUqiM/fpqdXSPvQnpWGKX38OMOLdDPxZK+W1wr7g+Hw+RFnHM8GQxHgCQKc6WTneD2MDvNoKcgTgJIxCzJP12ZjLLaFnaafByE= 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: List-Subscribe: List-Unsubscribe: --0000000000002b501b0622df47d2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Sergey, The current mm-unstable is breaking my swap stress test again. While there seems to be multiple bad commits that cause it. I have bisected into this commit causing kernel warning and followed by BUG(). [ 56.630032] zswap: loaded using pool lzo/zsmalloc [ 56.718027] zram0: detected capacity change from 16777216 to 0 [ 56.725492] zram: Removed device: zram0 [ 56.740125] ------------[ cut here ]------------ [ 56.744616] WARNING: CPU: 2 PID: 1894 at mm/slub.c:4556 free_large_kmalloc+0x4d/0x80 [ 56.745119] Modules linked in: [ 56.749551] CPU: 2 UID: 0 PID: 1894 Comm: zram-generator Tainted: G S 6.11.0-rc6+ #33 [ 56.750129] Tainted: [S]=3DCPU_OUT_OF_SPEC [ 56.750908] Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9, BIOS P89 09/21/2023 [ 56.751354] RIP: 0010:free_large_kmalloc+0x4d/0x80 [ 56.756120] Code: 00 10 00 00 48 d3 e0 f7 d8 81 e2 c0 00 00 00 75 2f 89 c6 48 89 df e8 82 ff ff ff f0 ff 4b 34 0f 85 e 9 7d f5 00 e9 eb 7d f5 00 <0f> 0b 80 3d a8 f3 9b 02 00 0f 84 bd 7d f5 00 b8 00 f0 ff ff eb d1 [ 56.761370] RSP: 0018:ffffaeaaa3657b20 EFLAGS: 00010246 [ 56.761676] RAX: 0057ffffc0002000 RBX: ffffece0c1f40e80 RCX: 000000008040003f [ 56.766293] RDX: ffffece0c1f40e88 RSI: ffffffff9a03a131 RDI: ffffece0c1f40e80 [ 56.770931] RBP: 0000000000200000 R08: ffff95571d256480 R09: 000000008040003f [ 56.775540] R10: 000000008040003f R11: 000000000000032c R12: 0000000000200000 [ 56.780212] R13: ffff953787c71e40 R14: 0000000000000047 R15: ffff95379b2e3e20 [ 56.784943] FS: 00007fb0f1d58bc0(0000) GS:ffff95567ed00000(0000) knlGS:0000000000000000 [ 56.785403] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 56.789937] CR2: 00007f35b6449050 CR3: 00000001112ac006 CR4: 00000000001706f0 [ 56.794784] Call Trace: [ 56.794941] [ 56.799377] ? free_large_kmalloc+0x4d/0x80 [ 56.799598] ? __warn.cold+0x8e/0xe8 [ 56.799842] ? free_large_kmalloc+0x4d/0x80 [ 56.800065] ? report_bug+0xff/0x140 [ 56.800296] ? handle_bug+0x3c/0x80 [ 56.804703] ? exc_invalid_op+0x17/0x70 [ 56.804912] ? asm_exc_invalid_op+0x1a/0x20 [ 56.805132] ? free_large_kmalloc+0x4d/0x80 [ 56.805344] zram_destroy_comps+0x32/0x70 [ 56.805568] zram_reset_device+0x102/0x190 [ 56.805812] reset_store+0xa6/0x110 [ 56.810207] kernfs_fop_write_iter+0x141/0x1f0 [ 56.814689] vfs_write+0x294/0x460 [ 56.819106] ksys_write+0x6d/0xf0 [ 56.823550] do_syscall_64+0x82/0x160 [ 56.823827] ? __pfx_kfree_link+0x10/0x10 [ 56.824051] ? do_sys_openat2+0x9c/0xe0 [ 56.824263] ? __handle_mm_fault+0xb34/0xfb0 [ 56.828752] ? syscall_exit_to_user_mode+0x10/0x220 [ 56.833220] ? do_syscall_64+0x8e/0x160 [ 56.833429] ? __count_memcg_events+0x77/0x130 [ 56.838021] ? count_memcg_events.constprop.0+0x1a/0x30 [ 56.838318] ? handle_mm_fault+0x1bb/0x2c0 [ 56.838542] ? do_user_addr_fault+0x55a/0x7b0 [ 56.843014] ? exc_page_fault+0x7e/0x180 [ 56.843228] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 56.843831] RIP: 0033:0x7fb0f1f7a984 [ 56.844045] Code: c7 00 16 00 00 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 80 3d c5 06 0e 00 00 7 4 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 55 48 89 e5 48 83 ec 20 48 89 [ 56.849247] RSP: 002b:00007ffc7db8fde8 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [ 56.853889] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fb0f1f7a984 [ 56.858482] RDX: 0000000000000001 RSI: 0000560df4e4ea65 RDI: 0000000000000004 [ 56.863154] RBP: 0000000000000004 R08: 0000560e0e417010 R09: 0000000000000007 [ 56.867794] R10: 00000000000001b6 R11: 0000000000000202 R12: 7fffffffffffffff [ 56.872980] R13: 00007fb0f1f7a970 R14: 0000560df4e4ea65 R15: 0000560df4e71bd0 [ 56.878043] [ 56.878555] ---[ end trace 0000000000000000 ]--- [ 56.883420] object pointer: 0x00000000f38e5ae7 [ 56.888235] BUG: Bad page state in process zram-generator pfn:407d03a [ 56.889026] page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x407d03a [ 56.889877] flags: 0x57ffffc0002000(reserved|node=3D1|zone=3D2|lastcpupid=3D0x1fffff) [ 56.894915] raw: 0057ffffc0002000 ffffece0c1f40e88 ffffece0c1f40e88 0000000000000000 [ 56.895771] raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 [ 56.896562] page dumped because: PAGE_FLAGS_CHECK_AT_FREE flag(s) set [ 56.897332] Modules linked in: [ 56.902165] CPU: 2 UID: 0 PID: 1894 Comm: zram-generator Tainted: G S W 6.11.0-rc6+ #33 [ 56.903155] Tainted: [S]=3DCPU_OUT_OF_SPEC, [W]=3DWARN [ 56.908082] Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9, BIOS P89 09/21/2023 [ 56.908918] Call Trace: [ 56.909484] [ 56.914148] dump_stack_lvl+0x5d/0x80 [ 56.914747] bad_page.cold+0x7a/0x91 [ 56.915318] free_unref_page+0x344/0x520 [ 56.915975] zram_destroy_comps+0x32/0x70 [ 56.916452] zram_reset_device+0x102/0x190 [ 56.917057] reset_store+0xa6/0x110 [ 56.921874] kernfs_fop_write_iter+0x141/0x1f0 [ 56.926685] vfs_write+0x294/0x460 [ 56.931385] ksys_write+0x6d/0xf0 [ 56.936087] do_syscall_64+0x82/0x160 [ 56.936656] ? __pfx_kfree_link+0x10/0x10 [ 56.937257] ? do_sys_openat2+0x9c/0xe0 [ 56.937810] ? __handle_mm_fault+0xb34/0xfb0 [ 56.942593] ? syscall_exit_to_user_mode+0x10/0x220 [ 56.947362] ? do_syscall_64+0x8e/0x160 [ 56.947974] ? __count_memcg_events+0x77/0x130 [ 56.952762] ? count_memcg_events.constprop.0+0x1a/0x30 [ 56.953356] ? handle_mm_fault+0x1bb/0x2c0 [ 56.953937] ? do_user_addr_fault+0x55a/0x7b0 [ 56.958999] ? exc_page_fault+0x7e/0x180 [ 56.959523] entry_SYSCALL_64_after_hwframe+0x76/0x7e [ 56.960163] RIP: 0033:0x7fb0f1f7a984 [ 56.960731] Code: c7 00 16 00 00 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 80 3d c5 06 0e 00 00 7 4 13 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 54 c3 0f 1f 00 55 48 89 e5 48 83 ec 20 48 89 [ 56.966840] RSP: 002b:00007ffc7db8fde8 EFLAGS: 00000202 ORIG_RAX: 0000000000000001 [ 56.971903] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: 00007fb0f1f7a984 [ 56.976953] RDX: 0000000000000001 RSI: 0000560df4e4ea65 RDI: 0000000000000004 [ 56.981946] RBP: 0000000000000004 R08: 0000560e0e417010 R09: 0000000000000007 [ 56.986980] R10: 00000000000001b6 R11: 0000000000000202 R12: 7fffffffffffffff [ 56.991985] R13: 00007fb0f1f7a970 R14: 0000560df4e4ea65 R15: 0000560df4e71bd0 [ 56.996963] [ 56.997533] Disabling lock debugging due to kernel taint [ 57.037759] zram: Added device: zram0 [ 57.088669] zram: Added device: zram1 [ 57.249105] zram0: detected capacity change from 0 to 6553600 [ 57.320547] zram1: detected capacity change from 0 to 40960000 [ 57.443012] Adding 3276796k swap on /dev/zram0. Priority:100 extents:1 across:3276796k SS [ 57.470295] Adding 20479996k swap on /dev/zram1. Priority:0 extents:1 across:20479996k SS Here is the bisect log: $ git bisect log # bad: [684826f8271ad97580b138b9ffd462005e470b99] zram: free secondary algorithms names # good: [2cacbdfdee65b18f9952620e762eab043d71b564] mm: swap: add a adaptive full cluster cache reclaim git bisect start 'mm-stable' 'HEAD' # good: [9bfbaa5e44c52422a046ce291469c8ebeb6c475d] mm/damon: move kunit tests to tests/ subdirectory with _kunit suffix git bisect good 9bfbaa5e44c52422a046ce291469c8ebeb6c475d # good: [1e673c8cf7f9c1156f615b7c00f224a8110070da] zram: add dictionary support to lz4hc git bisect good 1e673c8cf7f9c1156f615b7c00f224a8110070da # good: [3c8e44c9b369b3d422516b3f2bf47a6e3c61d1ea] mm: mark special bits for huge pfn mappings when inject git bisect good 3c8e44c9b369b3d422516b3f2bf47a6e3c61d1ea # good: [f9e54c3a2f5b79ecc57c7bc7d0d3521e461a2101] vfio/pci: implement huge_fault support git bisect good f9e54c3a2f5b79ecc57c7bc7d0d3521e461a2101 # good: [659c55ef981bb63355a65ffc3b3b5cad562b806a] mm/vma: return the exact errno in vms_gather_munmap_vmas() git bisect good 659c55ef981bb63355a65ffc3b3b5cad562b806a # good: [325efb16da2c840e165d9b620fec8049d4d664cc] mm: add nr argument in mem_cgroup_swapin_uncharge_swap() helper to support large folios git bisect good 325efb16da2c840e165d9b620fec8049d4d664cc # good: [ed8d5b0ce1d738e13c60d6b1a901a56d832e5070] Revert "uprobes: use vm_special_mapping close() functionality" git bisect good ed8d5b0ce1d738e13c60d6b1a901a56d832e5070 # good: [2abbcc099ec60844ca7c15214ab12955d3c11e68] uprobes: turn xol_area->pages[2] into xol_area->page git bisect good 2abbcc099ec60844ca7c15214ab12955d3c11e68 # first bad commit: [684826f8271ad97580b138b9ffd462005e470b99] zram: free secondary algorithms names Sergey told me there is a fix on the way: https://lore.kernel.org/all/20240923164843.1117010-1-andrej.skvortzov@gmail= .com/ This commit did not really break my swap stress test, the test can pass those kernel oops messages. It is just my bisect script that picks up the kernel oops and determines that is a bad commit. There is another bad commit in the current mm-unstable I need to haunt down. Chris On Mon, Sep 16, 2024 at 6:30=E2=80=AFPM Sergey Senozhatsky wrote: > We need to kfree() secondary algorithms names when reset > zram device that had multi-streams, otherwise we leak memory. > > Fixes: 001d92735701 ("zram: add recompression algorithm sysfs knob") > Signed-off-by: Sergey Senozhatsky > --- > drivers/block/zram/zram_drv.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.= c > index f8206ba6cbbb..c3d245617083 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -2115,6 +2115,11 @@ static void zram_destroy_comps(struct zram *zram) > zram->num_active_comps--; > } > > + for (prio =3D ZRAM_SECONDARY_COMP; prio < ZRAM_MAX_COMPS; prio++)= { > + kfree(zram->comp_algs[prio]); > + zram->comp_algs[prio] =3D NULL; > + } > + > zram_comp_params_reset(zram); > } > > -- > 2.46.0.662.g92d0881bb0-goog > > > --0000000000002b501b0622df47d2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi Sergey,

The current mm-un= stable is breaking my swap stress test again. While there seems to be multi= ple=C2=A0bad commits that cause it. I have bisected into this commit causin= g kernel warning and followed by BUG().

[ =C2=A0 5= 6.630032] zswap: loaded using pool lzo/zsmalloc
[ =C2=A0 56.718027] zram= 0: detected capacity change from 16777216 to 0
[ =C2=A0 56.725492] zram:= Removed device: zram0
[ =C2=A0 56.740125] ------------[ cut here ]-----= -------
[ =C2=A0 56.744616] WARNING: CPU: 2 PID: 1894 at mm/slub.c:4556 = free_large_kmalloc+0x4d/0x80
[ =C2=A0 56.745119] Modules linked in:
[= =C2=A0 56.749551] CPU: 2 UID: 0 PID: 1894 Comm: zram-generator Tainted: G = S =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 6.11.0-rc6+ #33[ =C2=A0 56.750129] Tainted: [S]=3DCPU_OUT_OF_SPEC
[ =C2=A0 56.750908]= Hardware name: HP ProLiant DL360 Gen9/ProLiant DL360 Gen9, BIOS P89 09/21/= 2023
[ =C2=A0 56.751354] RIP: 0010:free_large_kmalloc+0x4d/0x80
[ =C2= =A0 56.756120] Code: 00 10 00 00 48 d3 e0 f7 d8 81 e2 c0 00 00 00 75 2f 89 = c6 48 89 df e8 82 ff ff ff f0 ff 4b 34 0f 85 e
9 7d f5 00 e9 eb 7d f5 00= <0f> 0b 80 3d a8 f3 9b 02 00 0f 84 bd 7d f5 00 b8 00 f0 ff ff eb d1<= br>[ =C2=A0 56.761370] RSP: 0018:ffffaeaaa3657b20 EFLAGS: 00010246
[ =C2= =A0 56.761676] RAX: 0057ffffc0002000 RBX: ffffece0c1f40e80 RCX: 00000000804= 0003f
[ =C2=A0 56.766293] RDX: ffffece0c1f40e88 RSI: ffffffff9a03a131 RD= I: ffffece0c1f40e80
[ =C2=A0 56.770931] RBP: 0000000000200000 R08: ffff9= 5571d256480 R09: 000000008040003f
[ =C2=A0 56.775540] R10: 0000000080400= 03f R11: 000000000000032c R12: 0000000000200000
[ =C2=A0 56.780212] R13:= ffff953787c71e40 R14: 0000000000000047 R15: ffff95379b2e3e20
[ =C2=A0 5= 6.784943] FS: =C2=A000007fb0f1d58bc0(0000) GS:ffff95567ed00000(0000) knlGS:= 0000000000000000
[ =C2=A0 56.785403] CS: =C2=A00010 DS: 0000 ES: 0000 CR= 0: 0000000080050033
[ =C2=A0 56.789937] CR2: 00007f35b6449050 CR3: 00000= 001112ac006 CR4: 00000000001706f0
[ =C2=A0 56.794784] Call Trace:
[ = =C2=A0 56.794941] =C2=A0<TASK>
[ =C2=A0 56.799377] =C2=A0? free_la= rge_kmalloc+0x4d/0x80
[ =C2=A0 56.799598] =C2=A0? __warn.cold+0x8e/0xe8<= br>[ =C2=A0 56.799842] =C2=A0? free_large_kmalloc+0x4d/0x80
[ =C2=A0 56.= 800065] =C2=A0? report_bug+0xff/0x140
[ =C2=A0 56.800296] =C2=A0? handle= _bug+0x3c/0x80
[ =C2=A0 56.804703] =C2=A0? exc_invalid_op+0x17/0x70
[= =C2=A0 56.804912] =C2=A0? asm_exc_invalid_op+0x1a/0x20
[ =C2=A0 56.8051= 32] =C2=A0? free_large_kmalloc+0x4d/0x80
[ =C2=A0 56.805344] =C2=A0zram_= destroy_comps+0x32/0x70
[ =C2=A0 56.805568] =C2=A0zram_reset_device+0x10= 2/0x190
[ =C2=A0 56.805812] =C2=A0reset_store+0xa6/0x110
[ =C2=A0 56.= 810207] =C2=A0kernfs_fop_write_iter+0x141/0x1f0
[ =C2=A0 56.814689] =C2= =A0vfs_write+0x294/0x460
[ =C2=A0 56.819106] =C2=A0ksys_write= +0x6d/0xf0
[ =C2=A0 56.823550] =C2=A0do_syscall_64+0x82/0x160
[ =C2= =A0 56.823827] =C2=A0? __pfx_kfree_link+0x10/0x10
[ =C2=A0 56.824051] = =C2=A0? do_sys_openat2+0x9c/0xe0
[ =C2=A0 56.824263] =C2=A0? __handle_mm= _fault+0xb34/0xfb0
[ =C2=A0 56.828752] =C2=A0? syscall_exit_to_user_mode= +0x10/0x220
[ =C2=A0 56.833220] =C2=A0? do_syscall_64+0x8e/0x160
[ = =C2=A0 56.833429] =C2=A0? __count_memcg_events+0x77/0x130
[ =C2=A0 56.83= 8021] =C2=A0? count_memcg_events.constprop.0+0x1a/0x30
[ =C2=A0 56.83831= 8] =C2=A0? handle_mm_fault+0x1bb/0x2c0
[ =C2=A0 56.838542] =C2=A0? do_us= er_addr_fault+0x55a/0x7b0
[ =C2=A0 56.843014] =C2=A0? exc_page_fault+0x7= e/0x180
[ =C2=A0 56.843228] =C2=A0entry_SYSCALL_64_after_hwframe+0x76/0x= 7e
[ =C2=A0 56.843831] RIP: 0033:0x7fb0f1f7a984
[ =C2=A0 56.844045] C= ode: c7 00 16 00 00 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 f3 0= f 1e fa 80 3d c5 06 0e 00 00 7
4 13 b8 01 00 00 00 0f 05 <48> 3d 0= 0 f0 ff ff 77 54 c3 0f 1f 00 55 48 89 e5 48 83 ec 20 48 89
[ =C2=A0 56.8= 49247] RSP: 002b:00007ffc7db8fde8 EFLAGS: 00000202 ORIG_RAX: 00000000000000= 01
[ =C2=A0 56.853889] RAX: ffffffffffffffda RBX: 0000000000000001 RCX: = 00007fb0f1f7a984
[ =C2=A0 56.858482] RDX: 0000000000000001 RSI: 0000560d= f4e4ea65 RDI: 0000000000000004
[ =C2=A0 56.863154] RBP: 0000000000000004= R08: 0000560e0e417010 R09: 0000000000000007
[ =C2=A0 56.867794] R10: 00= 000000000001b6 R11: 0000000000000202 R12: 7fffffffffffffff
[ =C2=A0 56.8= 72980] R13: 00007fb0f1f7a970 R14: 0000560df4e4ea65 R15: 0000560df4e71bd0[ =C2=A0 56.878043] =C2=A0</TASK>
[ =C2=A0 56.878555] ---[ end tr= ace 0000000000000000 ]---
[ =C2=A0 56.883420] object pointer: 0x00000000= f38e5ae7
[ =C2=A0 56.888235] BUG: Bad page state in process zram-generat= or =C2=A0pfn:407d03a
[ =C2=A0 56.889026] page: refcount:0 mapcount:0 map= ping:0000000000000000 index:0x0 pfn:0x407d03a
[ =C2=A0 56.889877] flags:= 0x57ffffc0002000(reserved|node=3D1|zone=3D2|lastcpupid=3D0x1fffff)
[ = =C2=A0 56.894915] raw: 0057ffffc0002000 ffffece0c1f40e88 ffffece0c1f40e88 0= 000000000000000
[ =C2=A0 56.895771] raw: 0000000000000000 00000000000000= 00 00000000ffffffff 0000000000000000
[ =C2=A0 56.896562] page dumped bec= ause: PAGE_FLAGS_CHECK_AT_FREE flag(s) set
[ =C2=A0 56.897332] Modules l= inked in:
[ =C2=A0 56.902165] CPU: 2 UID: 0 PID: 1894 Comm: zram-generat= or Tainted: G S =C2=A0 =C2=A0 =C2=A0W =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A06.1= 1.0-rc6+ #33
[ =C2=A0 56.903155] Tainted: [S]=3DCPU_OUT_OF_SPEC, [W]=3DW= ARN
[ =C2=A0 56.908082] Hardware name: HP ProLiant DL360 Gen9/ProLiant D= L360 Gen9, BIOS P89 09/21/2023
[ =C2=A0 56.908918] Call Trace:
[ =C2= =A0 56.909484] =C2=A0<TASK>
[ =C2=A0 56.914148] =C2=A0dump_stack_l= vl+0x5d/0x80
[ =C2=A0 56.914747] =C2=A0bad_page.cold+0x7a/0x91
=
[ =C2=A0 56.915318] =C2=A0free_unref_page+0x344/0x520
[ =C2=A0 56.9= 15975] =C2=A0zram_destroy_comps+0x32/0x70
[ =C2=A0 56.916452] =C2=A0zram= _reset_device+0x102/0x190
[ =C2=A0 56.917057] =C2=A0reset_store+0xa6/0x1= 10
[ =C2=A0 56.921874] =C2=A0kernfs_fop_write_iter+0x141/0x1f0
[ =C2= =A0 56.926685] =C2=A0vfs_write+0x294/0x460
[ =C2=A0 56.931385] =C2=A0ksy= s_write+0x6d/0xf0
[ =C2=A0 56.936087] =C2=A0do_syscall_64+0x82/0x160
= [ =C2=A0 56.936656] =C2=A0? __pfx_kfree_link+0x10/0x10
[ =C2=A0 56.93725= 7] =C2=A0? do_sys_openat2+0x9c/0xe0
[ =C2=A0 56.937810] =C2=A0? __handle= _mm_fault+0xb34/0xfb0
[ =C2=A0 56.942593] =C2=A0? syscall_exit_to_user_m= ode+0x10/0x220
[ =C2=A0 56.947362] =C2=A0? do_syscall_64+0x8e/0x160
[= =C2=A0 56.947974] =C2=A0? __count_memcg_events+0x77/0x130
[ =C2=A0 56.9= 52762] =C2=A0? count_memcg_events.constprop.0+0x1a/0x30
[ =C2=A0 56.9533= 56] =C2=A0? handle_mm_fault+0x1bb/0x2c0
[ =C2=A0 56.953937] =C2=A0? do_u= ser_addr_fault+0x55a/0x7b0
[ =C2=A0 56.958999] =C2=A0? exc_page_fault+0x= 7e/0x180
[ =C2=A0 56.959523] =C2=A0entry_SYSCALL_64_after_hwframe+0x76/0= x7e
[ =C2=A0 56.960163] RIP: 0033:0x7fb0f1f7a984
[ =C2=A0 56.960731] = Code: c7 00 16 00 00 00 b8 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 f3 = 0f 1e fa 80 3d c5 06 0e 00 00 7
4 13 b8 01 00 00 00 0f 05 <48> 3d = 00 f0 ff ff 77 54 c3 0f 1f 00 55 48 89 e5 48 83 ec 20 48 89
[ =C2=A0 56.= 966840] RSP: 002b:00007ffc7db8fde8 EFLAGS: 00000202 ORIG_RAX: 0000000000000= 001
[ =C2=A0 56.971903] RAX: ffffffffffffffda RBX: 0000000000000001 RCX:= 00007fb0f1f7a984
[ =C2=A0 56.976953] RDX: 0000000000000001 RSI: 0000560= df4e4ea65 RDI: 0000000000000004
[ =C2=A0 56.981946] RBP: 000000000000000= 4 R08: 0000560e0e417010 R09: 0000000000000007
[ =C2=A0 56.986980] R10: 0= 0000000000001b6 R11: 0000000000000202 R12: 7fffffffffffffff
[ =C2=A0 56.= 991985] R13: 00007fb0f1f7a970 R14: 0000560df4e4ea65 R15: 0000560df4e71bd0[ =C2=A0 56.996963] =C2=A0</TASK>
[ =C2=A0 56.997533] Disabling = lock debugging due to kernel taint
[ =C2=A0 57.037759] zram: Added devic= e: zram0
[ =C2=A0 57.088669] zram: Added device: zram1
[ =C2=A0 57.24= 9105] zram0: detected capacity change from 0 to 6553600
[ =C2=A0 57.3205= 47] zram1: detected capacity change from 0 to 40960000
[ =C2=A0 57.44301= 2] Adding 3276796k swap on /dev/zram0.=C2=A0 Priority:100 extents:1 across:= 3276796k SS
[ =C2=A0 57.470295] Adding 20479996k swap on /dev/zram1.=C2= =A0 Priority:0 extents:1 across:20479996k SS

H= ere is the bisect log:

$ git bisect log
# bad: = [684826f8271ad97580b138b9ffd462005e470b99] zram: free secondary algorithms = names
# good: [2cacbdfdee65b18f9952620e762eab043d71b564] mm: swap: add a= adaptive full cluster cache reclaim
git bisect start 'mm-stable'= ; 'HEAD'
# good: [9bfbaa5e44c52422a046ce291469c8ebeb6c475d] mm/d= amon: move kunit tests to tests/ subdirectory with _kunit suffix
git bis= ect good 9bfbaa5e44c52422a046ce291469c8ebeb6c475d
# good: [1e673c8cf7f9c= 1156f615b7c00f224a8110070da] zram: add dictionary support to lz4hc
git b= isect good 1e673c8cf7f9c1156f615b7c00f224a8110070da
# good: [3c8e44c9b36= 9b3d422516b3f2bf47a6e3c61d1ea] mm: mark special bits for huge pfn mappings = when inject
git bisect good 3c8e44c9b369b3d422516b3f2bf47a6e3c61d1ea
= # good: [f9e54c3a2f5b79ecc57c7bc7d0d3521e461a2101] vfio/pci: implement huge= _fault support
git bisect good f9e54c3a2f5b79ecc57c7bc7d0d3521e461a2101<= br># good: [659c55ef981bb63355a65ffc3b3b5cad562b806a] mm/vma: return the ex= act errno in vms_gather_munmap_vmas()
git bisect good 659c55ef981bb63355= a65ffc3b3b5cad562b806a
# good: [325efb16da2c840e165d9b620fec8049d4d664cc= ] mm: add nr argument in mem_cgroup_swapin_uncharge_swap() helper to suppor= t large folios
git bisect good 325efb16da2c840e165d9b620fec8049d4d664cc<= br># good: [ed8d5b0ce1d738e13c60d6b1a901a56d832e5070] Revert "uprobes:= use vm_special_mapping close() functionality"
git bisect good ed8d= 5b0ce1d738e13c60d6b1a901a56d832e5070
# good: [2abbcc099ec60844ca7c15214a= b12955d3c11e68] uprobes: turn xol_area->pages[2] into xol_area->page<= br>git bisect good 2abbcc099ec60844ca7c15214ab12955d3c11e68
# first bad = commit: [684826f8271ad97580b138b9ffd462005e470b99] zram: free secondary alg= orithms names

Sergey told me there is a fix on= the way:

This commit did not really break my swap stress test, the t= est can pass those kernel oops messages. It is just my bisect script that p= icks up the kernel oops and determines that is a bad commit. There is anoth= er bad commit in the current mm-unstable I need to haunt down.
Chris



On Mon, Sep 16, 2024 at 6:3= 0=E2=80=AFPM Sergey Senozhatsky <senozhatsky@chromium.org> wrote:
We need to kfree() secondary= algorithms names when reset
zram device that had multi-streams, otherwise we leak memory.

Fixes: 001d92735701 ("zram: add recompression algorithm sysfs knob&quo= t;)
Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
=C2=A0drivers/block/zram/zram_drv.c | 5 +++++
=C2=A01 file changed, 5 insertions(+)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c<= br> index f8206ba6cbbb..c3d245617083 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -2115,6 +2115,11 @@ static void zram_destroy_comps(struct zram *zram) =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 zram->num_active= _comps--;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

+=C2=A0 =C2=A0 =C2=A0 =C2=A0for (prio =3D ZRAM_SECONDARY_COMP; prio < ZR= AM_MAX_COMPS; prio++) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0kfree(zram->comp= _algs[prio]);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0zram->comp_algs[= prio] =3D NULL;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 zram_comp_params_reset(zram);
=C2=A0}

--
2.46.0.662.g92d0881bb0-goog


--0000000000002b501b0622df47d2--