From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.174 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796356153; b=g9z22WmIf0ikvjhOttRDEf4vIFIbgimjsvfDliEmxg8EhjOxNaVRYHfMmyvffPSATWQI FOYun1lKYIKR/HiS/3mx9sU1ebUFK6GVKLDzCXAXiWcQUb2D4r5npiY0eOmtojyZPL+L5 QsTtLT+e9iuquZXhZlB/tXiOv1SVhkmmuCeci+G0Lg28uAcPl68k1z4jq6jlpevmV/bXH eK22tsI84iySPvPoDdyCkiLMpLFBVplOFNff1n6VHg1WVPcAlzuPSnoY5LY20k8NFoZAk +DiXZxHYZIr7oa513sZoxo3v0ZKEoDaaiJUyXgi8f8qGvokl++kXoE8/alnh00V5iXg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796356153; 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=K62Whgpi51LYmf5zKD/VcS1swZB/JClrE1WqLYM63h4=; b=0pwpdUqfNN4gSvtzus7B6LsGrnpYsK9kIHBoaVHfy5vemDTmZT68kKYn/v4I/IDHWrMm 3UdIAuO3gs5cLspVkREp9sT2gbfAQM5qKS1XR4zMiru5rbQPVpMAi9+kXs4Zx9RBfcujY OxKPGrJnoc9vJB9ASp3EycTcZQ62CYOgltmiIRwN5l9WuPt9acjd1zlAYla0Uq/ZIvK12 oHdrnPghmSKkppxHlFMK9h6UtiNJIEDBTuq8lZ8xgvY7T6gKi2te31XBHOsLXSJ2TVhyY hSyiW7M1ZxSGZ5HnFqre73tS1R6m3QoNqWOxnprPAsP39uTg/X0DmaPKcla4ARUHPpw== 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=aDp1znq+; arc=none smtp.remote-ip=74.125.82.174 Received: from mail-dy1-f174.google.com (mail-dy1-f174.google.com [74.125.82.174]) (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 880C5606A322 for ; Fri, 4 Dec 2026 03:49:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 880C5606A322 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=aDp1znq+ Received: by mail-dy1-f174.google.com with SMTP id 5a478bee46e88-385d8a00598so681461eec.1 for ; Thu, 03 Dec 2026 19:49:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1796356152; x=1796960952; 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=K62Whgpi51LYmf5zKD/VcS1swZB/JClrE1WqLYM63h4=; b=aDp1znq+pyFGj3C/S764AM5XrPA6yRMky1mnj6qs6RQlU47ivD5vUhbQVPRe6U4RBi C6FQQNNcqDKgpGcR8eXT28aNmEpzncsE8Qk2RccrwwfwAGrpoqxSLKwPajIFsEb7P2f9 hE2uh3LJuv/ReeGSQ+iVP3hqUumG18A8qEmu0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796356152; x=1796960952; 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=K62Whgpi51LYmf5zKD/VcS1swZB/JClrE1WqLYM63h4=; b=wgO1g7lSlhyWc5Czk8pJrQv3ZT+8rh3EiJpzcLjW+a+PzrCMQAiEp6Z9OeLJbQMesE aVmK47tvY3sUAl0NmkGkMTwHFFxjkwUy0Hr1xx0I0/x9YtfW1z1nmrpY+Llz+G8Oaur8 WGvgYnUwsG/kGO0K3gHZFcWfNq/YpMfSTdQn1TTPs8A8WnQUmLPBG4XEHaDTmInWchkC nFcyLQ1BnJpb3do2GC5ORz1vTE8wLXbZteHd+4ftH+ZUEnd3oiUUKd0p9bQaJw61V6BX F1+ZYHfkXRT32SycUWd2SjkmDLrVe80KFmH8sYvKFgo0VQaiY4fptsS3LyF4k3f8K7ls Ejjg== X-Forwarded-Encrypted: i=1; AL+hErFX2wLerHBE3cdSkiywuUnlazOqtl+8rP2DAl/Lp9bKCh4wX/jTn4uvn+T3bvvR7FUGjme1sLvtL8Hn5Q==@vger.kernel.org X-Gm-Message-State: APuU4Z+3PWClY+TDYJ11A0KX+ecMswSSY1Me71ZrJeEBJJWKNxxH0IoO EhNED6RQZhOwcX6eedJSwOWe9zIR+LysllP1sZQH1RxUJPGRF8KqVZU6/nI1GIOeBgUTMtO/8m6 sXys= X-Gm-Gg: AZFdTZfZs6Pe1MhDh1Ef8BtLqLRGsCqCLj4CjFxBatVXCbmHAECHqtf2YeRVDIHOKHk I9nhgQRsoEWWSlolwRbTuyh9L/xotE1X9zgJUjfnSLicFvMBav1a5dLOo9CZnW7YtLH0rkeUkFu Pqov6kyy7+ddaJAXpqryc0A0DrDPqv+LOVE1b5Qk56g7KH3dvmoFJ3FUktCrKJ+PXbSGZ/gw04B 8uPzURAPrJK/x1BG6++Jck35McOeh8bpNkEE16DIUCuxH1YdxPpt7Qg9POkfmAUM/1kJCBBfezW MgDnE78KB6S6FlljEVZL+TqhPnUQRSwtec8u4A1T1AS9QYYtXAAHVQJ1LCZfpTeVox/CIHLxU3l g+QsfGcGWP7s8BB7wwxwKtJeruPyHuS8EoGdKfSV41lflXHuXkcf2H59++HU5G8OyRsBapMXF4a ZU8+gS727iFxdOI7xYWRTMM+9Z/gxlKOtOlG8yrx0MXX5bE51N7IDU8W+P+ZVURhtzCuKnCOyre r7DGmyuXpwGvJpvN54GKNVwmHLyHJ7UtoRs9+8sL+kLxnPk/VpnUgsu9dNZVDYScwEJzRfr9o/n X+XKQIX7KgXMw3jxL/gMpXsdbH8ixNMGH/w3rDLu0Hn1ExJ+PnSD5wiR8Apmrlhgs4P2 X-Received: by 2002:a05:693c:69d8:b0:376:6aea:ab with SMTP id 5a478bee46e88-38751fca9b8mr878650eec.3.1796356152417; Thu, 03 Dec 2026 19:49:12 -0800 (PST) Received: from google.com ([2a00:79e0:2031:6:b1d8:8dc2:95bf:66b9]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3875224895asm2487221eec.27.2026.12.03.19.49.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 19:49:11 -0800 (PST) Date: Fri, 4 Dec 2026 12:49:07 +0900 From: Sergey Senozhatsky To: Xueyuan Chen Cc: Sergey Senozhatsky , Andrew Morton , Yosry Ahmed , Nhat Pham , Barry Song , Brian Geffon , Minchan Kim , Richard Chang , Johannes Weiner , Chengming Zhou , Xueyuan Chen , Nanzhe Zhao , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH 0/4] zsmalloc: replace shrinker with deferred compaction Message-ID: References: <20261203101411.3609533-1-senozhatsky@chromium.org> <179635291992.1911544.5833379956441668587.b4-reply@b4> X-Mailing-List: linux-block@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: <179635291992.1911544.5833379956441668587.b4-reply@b4> On (26/12/04 10:55), Xueyuan Chen wrote: > On 2026-12-03 19:13 +0900, Sergey Senozhatsky wrote: > > This is a follow-up to Chris's shrinker removal patch [1] and Barry's > > Pixel 6 fragmentation numbers [2]. > > > > Removing the shrinker avoids mid-swap compaction stalls, but without > > any automatic compaction we risk regressing memory footprint on systems > > that do not run a userspace compaction daemon, and on systems that do > > proactive swap-out without hitting memory pressure (no shrinker > > triggers). > > > > Replace shrinker callbacks (now removed) with deferred threshold-based > > compaction in zsmalloc (plus a runtime-tunable zram sysfs knob to > > configure or disable it). > > Hi Sergey, > > I wonder if we could also consider cross-class reuse to reduce the > need for compaction. > > In my Pixel 6 Pro workload, I observed that the 2048-byte class > grew by 3.5 MiB within a 2-second window while other size classes > had about 125 MiB of compactable memory. > > When a class runs out of free objects, could we try allocating from > an existing zspage in a slightly larger class before allocating > a new zspage? > > This would introduce some internal fragmentation, but might reduce > physical page allocations and object migration during compaction, > without changing the existing zspage layout or the allocation fast > path. > > What do you think about this trade-off? That idea did pop-up sometime in 2015-2017, but we were never sure about it. Borrowing free space from a higher size class comes with higher object padding overhead, potentially, so we never explored it in depth. This kind of changes zsmalloc design, from being slab-like to managing free spaces.