The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Barry Song <baohua@kernel.org>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	 Nhat Pham <nphamcs@gmail.com>, Yosry Ahmed <yosry@kernel.org>,
	 Chris Wiseman <chriswiseman@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	 Minchan Kim <minchan@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 Chengming Zhou <chengming.zhou@linux.dev>,
	Xueyuan Chen <xueyuan.chen21@gmail.com>,
	 Xueyuan Chen <xueyuan.chen@vivo.com>,
	Brian Geffon <bgeffon@google.com>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Nanzhe Zhao <nzzhao@126.com>
Subject: Re: [PATCH] mm/zsmalloc: remove shrinker
Date: Thu, 3 Dec 2026 15:17:40 +0900	[thread overview]
Message-ID: <axEI2AOKkQakQNG7@google.com> (raw)
In-Reply-To: <CAGsJ_4xFZQ1howBA-_GRwTP7n9MYmxObzAEMaTEzEGrK8FuPGg@mail.gmail.com>

Hi Barry,

On (26/12/03 13:10), Barry Song wrote:
> >  static void __init zs_stat_init(void)
> > @@ -1461,6 +1471,7 @@ void zs_free(struct zs_pool *pool, struct zs_handle *handle)
> >         struct size_class *class;
> >         int fullness;
> >         struct zspage *zspage_to_free = NULL;
> > +       bool kick_compact = false;
> >
> >         if (!zs_handle_is_allocated(handle))
> >                 return;
> > @@ -1481,6 +1492,10 @@ void zs_free(struct zs_pool *pool, struct zs_handle *handle)
> >                 } else {
> >                         kick_deferred_free(pool);
> >                 }
> > +       } else if (READ_ONCE(pool->compact_threshold) &&
> > +                  !delayed_work_pending(&pool->compact_work) &&
> > +                  zs_class_can_compact(class)) {
> > +               kick_compact = true;
> >         }
> >
> >         spin_unlock(&class->lock);
> > @@ -1488,6 +1503,8 @@ void zs_free(struct zs_pool *pool, struct zs_handle *handle)
> >         if (zspage_to_free) {
> >                 __free_zspage_lockless(zspage_to_free);
> >                 atomic_long_sub(class->pages_per_zspage, &pool->pages_allocated);
> > +       } else if (kick_compact) {
> > +               kick_deferred_compact(pool);
> >         }
> >  }
> 
> Hi Sergey,
> 
> Thanks very much for the quick patch! I'm always amazed by how
> quickly you come up with patches :-)

:)

> For both zram and zsmalloc deferred compaction, the kick is currently
> in the free path (zs_free() or slot_free()). I wonder whether we
> also need to kick compaction from the allocation path.

So allocation path doesn't create fragmentation.  It adds a new zspage,
but only if other class zspages are full.  And that new zspage with one
active element is the worst case, but there is nothing to compact: we
have all full zspages and one nearly empty zspage.  Am I missing the
point you are trying to make?

      reply	other threads:[~2026-12-03  6:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 15:02 [PATCH] mm/zsmalloc: remove shrinker Chris Wiseman
2026-12-01 16:45 ` Nhat Pham
2026-12-01 16:53 ` Yosry Ahmed
2026-12-02  0:46 ` Xueyuan Chen
2026-12-02  2:09 ` Sergey Senozhatsky
2026-12-02  7:04 ` Barry Song
2026-12-02  8:14   ` Sergey Senozhatsky
2026-12-02 10:21     ` Barry Song
2026-12-03  3:08       ` Sergey Senozhatsky
2026-12-03  3:24         ` Barry Song
2026-12-03  3:37           ` Sergey Senozhatsky
2026-12-03  4:24             ` Sergey Senozhatsky
2026-12-03  4:42               ` Chris Wiseman
2026-12-03  4:58                 ` Sergey Senozhatsky
2026-12-03  4:52               ` Sergey Senozhatsky
2026-12-03  5:10                 ` Barry Song
2026-12-03  6:17                   ` 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=axEI2AOKkQakQNG7@google.com \
    --to=senozhatsky@chromium.org \
    --cc=akpm@linux-foundation.org \
    --cc=baohua@kernel.org \
    --cc=bgeffon@google.com \
    --cc=chengming.zhou@linux.dev \
    --cc=chriswiseman@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=nphamcs@gmail.com \
    --cc=nzzhao@126.com \
    --cc=xueyuan.chen21@gmail.com \
    --cc=xueyuan.chen@vivo.com \
    --cc=yosry@kernel.org \
    /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