Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Longlong Xia <xialonglong2025@163.com>
Cc: minchan@kernel.org, senozhatsky@chromium.org,
	 akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org,
	 Longlong Xia <xialonglong@kylinos.cn>,
	stable@vger.kernel.org
Subject: Re: [PATCH 1/1] zsmalloc: account for handle size in class lookup
Date: Tue, 11 Aug 2026 11:28:15 +0900	[thread overview]
Message-ID: <anqIohlUBvDhlwt-@google.com> (raw)
In-Reply-To: <20260809115518.3791787-1-xialonglong2025@163.com>

On (26/08/09 19:55), Longlong Xia wrote:
> zs_lookup_class_index() lets zram recompression decide whether a newly
> compressed object would use a smaller size class. It currently classifies
> the payload size directly, while zs_malloc() adds ZS_HANDLE_SIZE before
> selecting the class.
> 
> This makes lookup disagree with allocation near size-class boundaries.
> With 4 KiB pages, CONFIG_ZSMALLOC_CHAIN_SIZE=8, and 64-bit handles, a
> 1025-to-1024-byte recompression appears to move from class 64 to class 62
> although both allocations use class 64. Conversely, a 1049-to-1025-byte
> recompression appears to stay in class 64 although the allocations move
> from class 65 to class 64.
> 
> As a result, zram can accept replacements with no allocation benefit or
> reject ones that would save memory, potentially marking the object
> incompressible.
> 
> Factor size-class selection into lookup_size_class(), account for the
> handle there, and use the helper for both lookup and allocation.
> 
> Fixes: 7c2af309abd2 ("zram: add size class equals check into recompression")
> Assisted-by: Codex:gpt-5.6-sol
> Cc: stable@vger.kernel.org
> Signed-off-by: Longlong Xia <xialonglong@kylinos.cn>

Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>


      reply	other threads:[~2026-08-11  2:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-09 11:55 [PATCH 1/1] zsmalloc: account for handle size in class lookup Longlong Xia
2026-08-11  2:28 ` Sergey Senozhatsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=anqIohlUBvDhlwt-@google.com \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=xialonglong2025@163.com \
    --cc=xialonglong@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox