From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.173 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796199260; b=1JZ3ZQYrw1tDI94or+ffl0AiSTEDWHYnqzgEalaT4d46UtcXw3x0eCBi5vYCAuFGSOHa rloOkmgBr4v9aHakoqOlFJMgaNFwdy00XtsPje9py/hZ/w798hVm+jlKIael3u0Y9LtD5 J0jNsj9OuJunrIM+ib527UPkDBNUGRNnq0mq+bUFd4kx0i7cL+XIthJVVtXf+FQyQCesm 3nZkp4JUKxhuay++P/qvNTunHeift9UOUg0/Qxu/GZSbaa3iL1yIcDH90lkETwAqauLvV ZMI8n0Re5AJIn0JOa/WaFOnIDufZlzBVjTWa5b2Bc5Vdxhu2oi5C8DUJWvBylBp+N+g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796199260; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=8dFqyYK21wUfoKyQ7oHsG9394dPnY4YWNELFavfg/o4=; b=H/7QB528V2KhqLNaFF+bS5e0wHKpfwvJOo+OU/QyuTUKTKvhWovdLuJR4Q/uiHeKSRq5 0fj/JBS2mmYcKjj2jbkRRtKblze6VbPH4z110N9mBiGWfGrHd0buyu3Ags+6Luqybl9HY EpRdQrn12TGUTAcgPsIJPttlY4XllfNRU3s2DeJmbWEcmucJFp4+eu7D8JQeBtoYOvI74 QRa2CIC05ViTQ3KiWy9vJKZjN2vK7hzsE4AfgJGS922g8EHBovaDQXg9PE+VP1bD6qN0A AL6M05/ct1/PJ6QKSlzyxR4gb64Qc4quTzaFn/rGU3699hRZdPLSkwLrHPAB1kZm6Mw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=d1uWNe93; arc=none smtp.remote-ip=209.85.210.173 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A4C5606A322 for ; Wed, 2 Dec 2026 08:14:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5A4C5606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=d1uWNe93 Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-8a070755c8cso6103887b3a.0 for ; Wed, 02 Dec 2026 00:14:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1796199259; x=1796804059; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=8dFqyYK21wUfoKyQ7oHsG9394dPnY4YWNELFavfg/o4=; b=d1uWNe935j9d/CGPBKFTcrp6dmf7m7xTQJDVXb6agnanD+ygkYZtOcfa5O0YTnLxLf 7ZV0RJJ0XHNDUqpdLT8/mNVDqOkVqlfIGaabO4cd6REX5X8SNyJ4gCUHSbNtbMvlevOH HNtKxusn6TgAkbZ7MUEdlZ8hv+mptU965wP4o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796199259; x=1796804059; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=8dFqyYK21wUfoKyQ7oHsG9394dPnY4YWNELFavfg/o4=; b=C47REBcLRtXkzW4rMds51b36dlSUZuoYfl0fSuqRl8pIl2lYPCD1DnYMVHWuIa6qEi 6nkLI9dHV0Z4UpIwAPhtWlla12L5diz2lzC4Gp1lAFj7rcwkfRUw5fPATI7RCOrXehLF 8RLn8Sf5SZ6BuLUG0vAxrxmJxg4n6J/pXDU36n7F+A5ewYh3bKFcDEWFHbZUwASZVPq9 4RAVAD/pEEbA1NUvu4cJmTbjYQNBnoTN8dIkqxLI4QNGCEnkigIs8qHz1yIoUrp641IN A5eO2VcrqGGWlqaez7PQioQuGRLZRrRt8KybcfakDQeTniFBsxplCZlCoRi5ohEn2Tym H9RA== X-Forwarded-Encrypted: i=1; AL+hErFl1r7T6vdxovOiU8+TqexketSwOerRaHroKcgChBP+JOH+WKiWRAxwdsm3M7GYgEpe8hOUmUef2AxSTHI=@vger.kernel.org X-Gm-Message-State: APuU4Z9DY+Hz1QHFe3RUdvQjhjTxwG0JhrS90mCTYuCf7q5y3agh5Xzd qmydvkvtUr+bG7QUoJ7/XywKPVVd11hPwy4zAeWcstIOsUgz8UkAbeFGXYKSRfj5/A== X-Gm-Gg: AZFdTZeNFmZK2g7GDVwccewaGBj0FpHf6xGLeoVTnsjTGeJVQOlKVTTOR45rD1Wlt1n 13mBfOwIvw67BmkZjo03XTRKCYbIDY4InSpQ8fqFePG8kP3N19mIdvic3jttLNAkwTid8BP3McZ fan7IGoiTMAbMG6Re5B8sVxc46RoxpD+Viferk+scnwymOkosDXz9IONBU+3TirMP7Mdzr5J+l+ WPG5ITtuH91e0e27uJwkQDfsACMHuXG2imNulJWHCDKWYUr6bk7R14Ia+7lud3msMDgmPOddrQE 3arb7JLnzjplC5tg42+UuK5LB781VOw8qf7UfRNWXfvrvKZIaPU8Xr6+w8uqskb9J7A6bsz0jIK aFigJ5rguHXDnZYsfdyF8zyjCaJ8JajLZDs6aaV8OnzUsXMv6K1VkVdff+Bt6Kp0JlZ13CWcZha +5Aof0ztHkt1bcdYQ5Xm49K+d1kzHspCrgQ2OgHVj4ChQrB505dagRj1uh3qPkFnq0USBgc+fJg kEXQMfyWY/VzW/v8ngWtYXamWjbfOhgeE8u229PXFrg2gIS/rKOX4QyvtD1jyxISjRrs37LyViC EHIsrgijGvAtae7+hq8e5LAFj9jsxvU8RC1wNqNqq7PI2dDArZ8Eb+AVwOy3nTqo4u4= X-Received: by 2002:a05:6a00:8c81:b0:87d:e8a0:2389 with SMTP id d2e1a72fcca58-8cd83960b2amr20088007b3a.21.1796199259646; Wed, 02 Dec 2026 00:14:19 -0800 (PST) Received: from google.com ([2a00:79e0:2031:6:8ebb:4c5:27ad:b8d0]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c873442863sm21640199b3a.43.2026.12.02.00.14.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 00:14:19 -0800 (PST) Date: Wed, 2 Dec 2026 17:14:14 +0900 From: Sergey Senozhatsky To: Barry Song Cc: Chris Wiseman , Andrew Morton , Minchan Kim , Sergey Senozhatsky , Johannes Weiner , Yosry Ahmed , Nhat Pham , Chengming Zhou , Xueyuan Chen , Xueyuan Chen , Brian Geffon , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/zsmalloc: remove shrinker Message-ID: References: <18ed2967f99a2eff.3137322e32332e3235332e313736.2c2157.0000sendgmr@google.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On (26/12/02 15:04), Barry Song wrote: > > zsmalloc registers a shrinker to run automatic pool compaction under > > memory pressure. Because zs_shrinker_scan() calls zs_compact(), it > > ignores sc->nr_to_scan and compacts every size class, taking > > write_lock(&pool->lock) and per-class locks (dropping them only when a > > destination zspage fills or pool->lock is contended). During active > > memory pressure, swap-out allocates concurrently from the same size > > classes, so physical pages freed by mid-swap compaction are immediately > > reallocated. Incoming swap-out refills free slots on its own, while > > shrinker compaction contends with page faults and swap-out. > > > > In the RFC discussion, Xueyuan Chen reported compaction stalls up to > > 269.68 ms (p95 38.86 ms) on a 12 GB Android device. Testing on ARM64 > > QEMU shows that removing the shrinker eliminates mid-swap compaction > > churn without increasing active pool memory usage for either zram or > > zswap, and cuts zswap page-fault latency under active swap-out: > > > > ARM64 QEMU (Linux 7.3.0+, zram0, 16 boots per config, ~240 MB swap-out): > > > > Before After > > Pages compacted mid-swap 2,218 0 > > zram mem_used_total (mid-swap) 121.0 MB 120.9 MB > > zram mem_used_total (post-compact) 111.2 MB 110.9 MB > > > > ARM64 QEMU (Linux 7.3.0+, 4 vCPUs, zswap lz4): > > > > Before After > > Active swap-out pool size 95.9 MB 95.1 MB > > Active swap-out p50 fault 3,262 us 2,414 us (-26%) > > After swap-out stops (holes held) 44.2 MB 65.1 MB (+20.9 MB) > > > > For zram, userspace can still trigger compaction explicitly via > > /sys/block/zram/compact (zs_compact()), and mm_stat's > > pages_compacted now reflects manual compaction only. For zswap, the > > shrinker only reduced pool size after new swap-outs stopped; as > > discussed on the RFC thread, reclaim-time compaction hurts active fault > > latency without reducing active pool size, and any proactive compaction > > interface for zswap can be evaluated separately. > > Hi Chris, Xueyuan and all, > > Thanks for the patch and the report. Just curious, do we need > userspace-triggered proactive compaction Wouldn't hurt to keep it around, I guess. But maybe can NOOP it in the future (removing zram device attributes is a bit difficult, we usually give around 3-5 years of deprecation cooldown period before removal.)