From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.179 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796269032; b=pw1+XN5HBfHLLUKtmzJnPqrc5ACr23ECGudxygtLxxU9AAA6Idb3cFp2PB7A/Her4TNZ 4z+TRVXVAcFQVPJ7Bt99MyGrNk5NPqkgsI3t9tabBZeiXmUQw43qFRJs9xTFCmJrsSzS+ TaO+asZ0ymhs0AUNZSII4578ihkh9ruZhvcYOvLCZG2/H4cFxhWMi2/xOG0nUZE0OwUQK wEhx8BACv/mP3A9e6bB+wm+l05W2vwASlUlRO1s/G6MMiZ7hzdcTB8XVEYj6Mi+40svIM 8JTUyOBC8daLruIqtSnCQWVa+pP1y2HtyGDQ/ZiQ+hz/LqsfIZdBSyQoTeJVl/BMPsg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796269032; 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=jHjaTDbWEBlkPxDqaHOrJ+9jlXvfiXJlCFLXfA4zE88=; b=02L2SL/htDXBTQAtUIMGmUaydZztiZr+DEw0m/tMc69crslKa3Ok9UQwLVrs40sakoMS 9wWeVGy2dM+XDxArA5LXe39SA9Kth9hsI5F+RwBD+jDAo2s7+AKVqy1n7Qsuq3xx4xUqq ju36mbl70nrodJfYAJo4YW03oSvHHHWtVx6yoWN9ed0eJOQMG/EtoExJgD8pZ4gI37Xiv Mdyv1sF+WMDPm34Up1WCyd9LIutwnR2jWgJ1FHfHR2i3mJW80qZUYaaZu4pFs8YZAcgoQ H6ebLB6yCEEJ1OiTQcJrqQGSlQEQendWCn69WLDH5i0zai6Dg3GESztNQwLLAFGUsyA== 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=jfzcpZjn; arc=none smtp.remote-ip=74.125.82.179 Received: from mail-dy1-f179.google.com (mail-dy1-f179.google.com [74.125.82.179]) (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 E1EFB606A32D for ; Thu, 3 Dec 2026 03:37:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E1EFB606A32D 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=jfzcpZjn Received: by mail-dy1-f179.google.com with SMTP id 5a478bee46e88-385d8a00598so23951289eec.1 for ; Wed, 02 Dec 2026 19:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1796269031; x=1796873831; 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=jHjaTDbWEBlkPxDqaHOrJ+9jlXvfiXJlCFLXfA4zE88=; b=jfzcpZjn7DUPTVbX2E+NYxx4eUsMa1a0C2vF61jWWVuNltHA/p0ekZGEUX2TpiZdVo dIgWjlNR79DFmkcDZyF+Ti+tVERXdQXWxNbJdcca5fP3yRJcYmWfbty0PpLNsMjlytvo 6YgtG8CHrJG3fD+FuCgFHK0Hwoaj2eoz9D650= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796269031; x=1796873831; 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=jHjaTDbWEBlkPxDqaHOrJ+9jlXvfiXJlCFLXfA4zE88=; b=wmBA4hZ/j5knXI6Cx8ulzmS2P11dgMg9XNcGRYRUqGTSYQVcN5fj9B2XoxxzrKyjgl LA1c5mTl0bLSorKXtdcwJFcaZYOsjYtxIe6tG1aFBCnsleCev9Pp1axIax9+d1Q68ynW fR38jEQcxqUdWhgJ4+ZElT09Gin4vcm0MCKwve/4QWr4vAbBp+4cNbGq0zZJ2xQwHmaE gNd4Yu6Av/N3HZ01ef5yRtM7BEBxWbckqko2bxJr1uJeaHIDPdEskLkuAvWK3BhrKKTP EENC9Am2IY5YJxK6FL97qMq+GomIkP2sLpwzjP8Av+WgZTuVSKZDyGHM1IvNjvEL2Ybu POIw== X-Forwarded-Encrypted: i=1; AL+hErGjhPxTl2PY+WznRI33BOQvnehPBfyee+K9PAS1znxOT1mRkqU87t2CMM6QPJGvsRQU2VyLb4UqgxuE8sw=@vger.kernel.org X-Gm-Message-State: APuU4Z+4v8ztJRBHhB5pCV3WyEMsD+ZmQVciNc/vMqJNsVac4s/UvJ9c aY9iwPF+4BTLRsABX8pMMsDpbXwQAGalhWW/Xgsrk6RpAMUWClveorgNdJTwyU8oZA== X-Gm-Gg: AZFdTZeJm8i9PVnRz3+JXtnld5TVhMBHndl2uL6bYl/MJ5ofZMJb2BpPxingN1NzFun 39ZPywmz8jHwO8q6lB2SGgohjb9u9ZEOcQnL8G/uwXIrLlJ26c8MBHDUMe9Eg0MbX/IqCpjY/lB 6jvOlHqPnKldbRFjYh3hxFDC9LU+Vm6o0yMIDihfKTJ8ZKUajPiXTB6uGmYrXz5dYOZ7UEsTGH2 Yvdrud5UB0tn7sDTX4glUsyP9ckXnc5ZOlNFGbAX7wHL2OQlbLYDnVJY8edRa8SzVs7NWQp53PC NdDMzd67uyCwG8MjVvhcIG5QL6biGcwQtjeJfQ8+VSxAo2MtkxqAzg+tv1Fs17z07vhpukgM94h Sfqs1OPRq/oKYQpOv5QBlgmMkx/Z/E2mJsyVLDVgjiKjSJ36jfXf67+p7o8I6VM2mokqrx07zqb qCQT2NShE6V6k4lwBuvdn16QX5aQjoxpgt2UG1bV3iU5ZGN8Eqhjr2IEqGPmOCN8QubUfWBvry/ vPsggacExGeAWpTKdGt1jFCKJSmQqEUSyx7lfu8pM+rIY4pJI6x/Bup2oy4TRWDRE00LHes0bls zmFoOHtZHX3Q5b30FOEJ9QXWhNBkNFZaUojIYLoc0K3vIXDv5aIJqFoaUVjTecezzRSnMw== X-Received: by 2002:a05:7300:ce93:b0:36c:a44c:1763 with SMTP id 5a478bee46e88-386bbfa6402mr27494272eec.32.1796269030925; Wed, 02 Dec 2026 19:37:10 -0800 (PST) Received: from google.com ([2a00:79e0:2031:6:e18c:e957:aa04:7114]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-386c7c62a91sm85930321eec.17.2026.12.02.19.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Dec 2026 19:37:10 -0800 (PST) Date: Thu, 3 Dec 2026 12:37:06 +0900 From: Sergey Senozhatsky To: Barry Song Cc: Sergey Senozhatsky , Chris Wiseman , Andrew Morton , Minchan Kim , Johannes Weiner , Yosry Ahmed , Nhat Pham , Chengming Zhou , Xueyuan Chen , Xueyuan Chen , Brian Geffon , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Nanzhe Zhao 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/03 11:24), Barry Song wrote: [..] > > I suppose compaction will be beneficial after a huge app swap-in, e.g. > > bringing back a web browser with (usual) million tabs. Or after a huge > > app kill/termination, if the app had swap presence. Both of these > > release memory from zsmalloc and create fragmentation, so we might > > benefit from doing a de-fragmentation. > > Right. I had Nanzhe(Cc-ed) test this patch on Pixel 6 phones by repeatedly > launching apps in a loop. We observed some negative results with > this patch in the absence of proactive compaction. > > Nanzhe collected the time series of (mem_used_total - compr_data_size). > Without the patch, the median was 32 MB. With the patch, it increased > to 182 MB, peaking at 622 MB. > > The median memory overhead due to fragmentation increased from > 2.5% without the patch to 16.87% with the patch. Hmm that's a high number... > So it seems that while mid-swap compaction is undesirable from a > performance perspective, it does help reduce the memory footprint > on phones. A bit of problem is that you need memory pressure to trigger compaction. On a device, which does proactive per-app swap outs w/o hitting memory pressure, the fragmentation footprint just sits there (and maybe even grows). I wonder if we should consider some sort of a background compaction triggered by zram instead of shrinker callback. E.g. when zram observes that mem_used_total to compr_data_size ration goes above some run-time configurable threshold (e.g. 5%).