linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vitaly Wool <vitaly.wool@konsulko.se>,
	 Igor Belousov <igor.b@beldev.am>,
	linux-mm@kvack.org, akpm@linux-foundation.org,
	 linux-kernel@vger.kernel.org, Nhat Pham <nphamcs@gmail.com>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	Yosry Ahmed <yosry.ahmed@linux.dev>,
	 Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH] mm/zblock: use vmalloc for page allocations
Date: Tue, 6 May 2025 11:13:25 +0900	[thread overview]
Message-ID: <itnqbldahxd46zzwh5gq2iijcfrgyubp626bmr4jezpu43rkui@wal7n6ti6jq7> (raw)
In-Reply-To: <20250505140812.GA30814@cmpxchg.org>

On (25/05/05 10:08), Johannes Weiner wrote:
> I've been using zsmalloc with 16k pages just fine for ~a year,
> currently running it on 6.14.2-asahi. This machine sees a lot of
> memory pressure, too.
> 
> Could this be a more recent regression, maybe in the new obj_write()?

This looks like a recent regression.  In the old code we'd something like

	__zs_map_object(area, zpdescs, off, class->size)

which would use class->size for all memcpy() calculations:

       sizes[0] = PAGE_SIZE - off;
       sizes[1] = size - sizes[0];

       /* copy object to per-cpu buffer */
       memcpy_from_page(buf, zpdesc_page(zpdescs[0]), off, sizes[0]);
       memcpy_from_page(buf + sizes[0], zpdesc_page(zpdescs[1]), 0, sizes[1]);

So we sometimes would memcpy() more than the actual payload (object size
can be smaller than class->size), which would work because compressed
buffer is huge enough.  In the new code we use object size, only for
write() tho.

read_begin()/end() still use class->size, so  I think in some cases we
can "unnecessarily" go into
	"object spans two pages, memcpy() from both pages a local copy"
even if the actual object fits on one page.  We may also want to pass the
object size (which we know) to read_begin()/end(), this potentially can
save some memcpy() calls.


  reply	other threads:[~2025-05-06  2:13 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-02  8:01 Vitaly Wool
2025-05-02  8:07 ` Igor Belousov
2025-05-03 18:46   ` Vitaly Wool
2025-05-04  5:02     ` Sergey Senozhatsky
2025-05-04  6:14       ` Sergey Senozhatsky
2025-05-05 14:08     ` Johannes Weiner
2025-05-06  2:13       ` Sergey Senozhatsky [this message]
2025-05-05 14:29 ` Johannes Weiner
2025-05-06  9:42   ` Uladzislau Rezki
2025-05-06 13:13 ` Yosry Ahmed
2025-05-06 13:27   ` Herbert Xu
2025-05-06 13:37     ` Christoph Hellwig
2025-05-07  5:57   ` Sergey Senozhatsky
2025-05-07  6:08     ` Sergey Senozhatsky
2025-05-07  6:14       ` Sergey Senozhatsky
2025-05-07  6:54       ` Christoph Hellwig
2025-05-08  5:58         ` Sergey Senozhatsky
2025-05-08  6:00           ` Christoph Hellwig
2025-05-08  6:17             ` Sergey Senozhatsky
2025-05-08  6:33               ` Sergey Senozhatsky
2025-05-07  8:50       ` Uladzislau Rezki
2025-05-08  6:07         ` Sergey Senozhatsky

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=itnqbldahxd46zzwh5gq2iijcfrgyubp626bmr4jezpu43rkui@wal7n6ti6jq7 \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=igor.b@beldev.am \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=shakeel.butt@linux.dev \
    --cc=vitaly.wool@konsulko.se \
    --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