linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Kenny Cheng <chao.shun.cheng.tw@gmail.com>
To: senozhatsky@chromium.org
Cc: akpm@linux-foundation.org, c.s.cheng@realtek.com,
	chao.shun.cheng.tw@gmail.com, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, minchan@kernel.org, yosry.ahmed@linux.dev
Subject: Re: [PATCH v2] zsmalloc: Fix address alignment in zspage for performance improvement
Date: Wed, 29 Jan 2025 21:17:23 +0800	[thread overview]
Message-ID: <20250129131723.3761142-1-chao.shun.cheng.tw@gmail.com> (raw)
In-Reply-To: <mqv5dquv3qud3dqmyxzf2kvq7mydjszg6rja2o2w2oa46uvjm2@mrazizdfg73r>

> Hmm, I don't know.  If we change zsmalloc to make some H/W happy, how
> do we make sure that something that is good for Realtek is not "bad"
> for some other H/W?

No, this patch would not have any impact on other HW. This patch only
changes the position of "link struct" from head to tail in an object.

Example:
A 32-bit system, using a zspage with a class size of 32 bytes and a 4K
page system.

In this case, the address is obtained from zs_map_object if zsmalloc is
used with this zspage.

Without this patch: The address is aligned to 4 bytes.
The alignment size is always the same as the size of the "link struct."
With this patch: The address is aligned to 32 bytes.
The alignment size can be controlled by the class size.

For the SW zram algorithm, this patch has no effect. For the HW zram
algorithm, which requires 4-byte alignment, this patch has no effect
either.

However, for the HW zram algorithm that requires more than 4-byte
alignment, this patch can improve zram performance if the class size is
aligned with the required size.

> I'm very unsure about having "vendor-specific" (by the way, is that
> out-of-tree compression/decompression driver?) changes in zsmalloc.

Yes, it is an out-of-tree driver. It is common compression/decompression
algorithm such as lz4, zstd, and so on. The only difference is that the
implementation is based on in-house designed HW.


      reply	other threads:[~2025-01-29 13:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-29  8:28 Kenny Cheng
2025-01-29 11:45 ` Sergey Senozhatsky
2025-01-29 13:17   ` Kenny Cheng [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=20250129131723.3761142-1-chao.shun.cheng.tw@gmail.com \
    --to=chao.shun.cheng.tw@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=c.s.cheng@realtek.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=senozhatsky@chromium.org \
    --cc=yosry.ahmed@linux.dev \
    /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