From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 146E9283FCF for ; Wed, 25 Mar 2026 02:26:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774405618; cv=none; b=RWU1bQcPyySd9iGTY0jLgIl84+5+ywhoVhY8uh7gkpR9RsZTZvmrnVuQbJFSwJ4+TxvRJ0JUwO8hqeQwaTErAC/3MGMmw7K0ZnEfmHJezLUY36STVoHhCNrmbDYqZKxnBeR408M0B0FDPplAipNoIVOwQ4x5XaccEWypr8mPFHQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774405618; c=relaxed/simple; bh=uaOXi8+Uaz+CtoxjqhLmQyoQhmCYXQYtJirqEaqsTuY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=B5fx1KtB0l2bU9lc6X9O2Tl3yK67NZI0hDmX2uBMkIX6QPJmx83SB01KWW3UE5Y1qROl7g4eBP4KysbjF3FNEjQnDYvqUkCqFYfv9girW8iScSwXBfkpS70q0Ct+nJmZUFhGsdpaL0I+RkxHvji9gPdj1DOZck6rEqvNkNuAa3k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=M/z8VoD8; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=RWzVho1a; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="M/z8VoD8"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="RWzVho1a" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1774405615; h=from:from: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=GGhwUXkV7JnIH35nWRgyF7GMpBr4atLQijvaTPOK50k=; b=M/z8VoD8bBszzfEIbVp85fugR41Y/N3xZ04fI9EJEX5Sjb7rWadjUUNKCizW2Pq+giCAdY ZA5nLEntUo4fVuqvQaUCDb+v5Gs9gpXv+AAGrwsbbbCG5ZA/3//4cmRZSxOEmKyh+nRoNE uRMvqTPWGQmOsjjQsWSRA5NWBlfHoiA= Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-343-1Wx3jf4lMzCfCAQq8MiiAw-1; Tue, 24 Mar 2026 22:26:53 -0400 X-MC-Unique: 1Wx3jf4lMzCfCAQq8MiiAw-1 X-Mimecast-MFC-AGG-ID: 1Wx3jf4lMzCfCAQq8MiiAw_1774405612 Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-35a0b51eb23so1896087a91.2 for ; Tue, 24 Mar 2026 19:26:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1774405612; x=1775010412; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=GGhwUXkV7JnIH35nWRgyF7GMpBr4atLQijvaTPOK50k=; b=RWzVho1aD8xLapD0FHj4+4PoHyL2xwQT1KIeH3NVfD1yvE7RaJs97+Mli7VYIMoYTA YC8Ab/oYU99txqQXpOfQtR06yIiL5Emr441V11KdyVqmLQndax4l3dGMqHfWHsPNEtPL 0r3IziIogmFUidyXutfxWdMB92mHdOBcvbJ2atZvlr44I0HTy5SAJF0u2l8qnWaUoPDg GdQmD7BeINRK0hAdVnNdH/9IISfzi12EbVVksxWzyUR6UDFA+an7xWG9nYuZaZV1vsth age8rY1JcruSYcCLmDxNNoaB8zmn058w/s0f2rVP2ypPBCoGQjTioPYfCfvpPD7t6OE2 ukUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774405612; x=1775010412; h=in-reply-to:content-transfer-encoding:content-disposition :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; bh=GGhwUXkV7JnIH35nWRgyF7GMpBr4atLQijvaTPOK50k=; b=X7G1d+7HQiM4320+HUhmNRUL6iMrf77wVujYYeSMIesYTgfL2AFqnRYXgCB2jkLMg9 C08eqDAxDR553c+d51vnD8PKntGxl+0W6dUnogUBt0AGSXis9pRTcTcWkQGA966hladk dTEIl1xTxpo5lvBszmfvxF6y4A2uslc1Z/pGn+G01tFU6xwu/k1vkSHR78gd6CfIQdi7 Gw1s0h/d7dAdUm0H6lkJ097XgjRxL7HLiq3SH20STp2YD0zpKDoqinKXEV2SxyQ5FNXd 4JRfF9I4iseVR/Et+ONcdxcjpBYuGRylFQP0eL2IgnGyeqZJuWnP+E5DZumKxHkCS3Mo NB2Q== X-Forwarded-Encrypted: i=1; AJvYcCUdg3g8RRYRuDP+t4YSdT/4o+3r+JBI9IzTYH4XuK+rrsRBoLWJMlfuar+Iz2Qaxg4HZt55xcakd2u3FIE=@vger.kernel.org X-Gm-Message-State: AOJu0YymxqqXfnrU8hffie6jTOYZ24bzBgQpKAgsXd8fgFW285FkVrFY nhPYx7Ffo49WW9tNgVlr4dmrYwCUaNfCaFyruvGMJGc2lYav0tHKw7Pzfw/14sSEr7PQWnkSxL/ TUwSjZ8s9oszkUpO2kkjJKS+6k/J8c8fLJBAbl1d9OmWZkUEVZ1uFtkwOvN/F5m6bOA== X-Gm-Gg: ATEYQzyN/KxGLSfsHtiFRGYFCtjTRCRYvvovzjxHqxiGH9PwnRkJWprgZBoM3sTtnef hkje+tGCamUc3TtcC0V3vEj8opAcLIjWYEdqsVmakIGTQIvBTN2NEI7N+ipn5zXHpFsYF96apK3 XI3TyzV/uGL50FtfGwWIg8cyjFEk3x7OAbxzhE1pqctb1sZUr3lJYerdQTFt7gLkXyQ1VObduKF UuOxGQQ+Q+bQG0Ejb2PcC2IsU2cUKa3JI9OZmyWUV1u6Xu3UVZ1jp8l2zkhyJChSjtIJY7YdcUF yHdrzleMCFL6jk2Jr6GcI3yElFE90dN8c0UQm7RGx3JZph5P3ioLVDRYnrSzvV1+pAiyet6b9fE y+QoT3s7xl5ri4fn38g== X-Received: by 2002:a17:90b:3fcd:b0:359:1821:b4d5 with SMTP id 98e67ed59e1d1-35c0dcb0d3cmr1536843a91.5.1774405612254; Tue, 24 Mar 2026 19:26:52 -0700 (PDT) X-Received: by 2002:a17:90b:3fcd:b0:359:1821:b4d5 with SMTP id 98e67ed59e1d1-35c0dcb0d3cmr1536815a91.5.1774405611803; Tue, 24 Mar 2026 19:26:51 -0700 (PDT) Received: from redhat.com ([209.132.188.88]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-35c0e95653csm245975a91.4.2026.03.24.19.26.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Mar 2026 19:26:51 -0700 (PDT) Date: Wed, 25 Mar 2026 10:26:48 +0800 From: Li Wang To: Yosry Ahmed Cc: Andrew Morton , longman@redhat.com, yosryahmed@google.com, nphamcs@gmail.com, hannes@cmpxchg.org, mhocko@kernel.org, mkoutny@suse.com, muchun.song@linux.dev, tj@kernel.org, roman.gushchin@linux.dev, shakeel.butt@linux.dev, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v4 0/7] selftests/cgroup: improve zswap tests robustness and support large page sizes Message-ID: References: <20260322061038.156146-1-liwang@redhat.com> <20260322091851.e965d3a2f0d6af5bd985407f@linux-foundation.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, Mar 24, 2026 at 01:28:12PM -0700, Yosry Ahmed wrote: > > > Sashiko claims that 512 pages will end up consuming 11K to 15K in > > > zswap with this setup, do you know what the actual number is? > > > > Not very sure, I guess each 64K page contains 1 byte of 'a' and 65535 bytes > > of zero. A single page like that compresses down to roughly 20–30 bytes > > (a short literal plus a very long zero run, plus frame/header overhead). > > So the estimate is roughly 512 × 25 bytes ≈ 12.8 KB, which is where the > > "11 to 15 kilobytes" ballpark comes from. > > > > > Especially with different compressors? If it's close to 64K, this > > > might be a problem. > > > > Yes, good point, when I swith to use 'zstd' compressor, it doesn't work. > > > > > Maybe we can fill half of each page with increasing values? It should > > > still be compressible but not too compressible. > > > > I tried, this method works on Lzo algorithm but not Zstd. > > Anyway, I am still investigating. > > Do you mean the compressibility is still very high on zstd? I vaguely > remember filling a page with repeating patterns (e.g. alphabet > letters) seemed to produce a decent compression ratio, but I don't > remember the specifics. > > I am pretty sure an LLM could figure out what values will work for > different compression algorithms :) Well, I have tried many ways for ditry each page of the total, but none works on zstd compreseor. e.g,. --- a/tools/testing/selftests/cgroup/test_zswap.c +++ b/tools/testing/selftests/cgroup/test_zswap.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "kselftest.h" #include "cgroup_util.h" @@ -473,8 +474,12 @@ static int test_no_invasive_cgroup_shrink(const char *root) if (cg_enter_current(control_group)) goto out; control_allocation = malloc(control_allocation_size); - for (int i = 0; i < control_allocation_size; i += page_size) - control_allocation[i] = (char)((i / page_size) + 1); + unsigned int nr_pages = control_allocation_size/page_size; + for (int i = 0; i < nr_pages; i++) { + unsigned long off = (unsigned long)i * page_size; + memset(&control_allocation[off], 0, page_size); + getrandom(&control_allocation[off], nr_pages/2, 0); + } if (cg_read_key_long(control_group, "memory.stat", "zswapped") < 1) goto out; Even I tried to set random data for all of the pages, they still not works (zstd). But it can be worked on lzo compressor, I don't know if the zstd have any addtional configures or I missed anything there. My current thought is just to satisfy the lzo (default) compressor in this patch series, and leave the zstd for additional work. What do you think? any better idea? -- Regards, Li Wang