Re: [PATCH 2/2] kcompressd: Add Kcompressd for accelerated zram compression
From: Qun-wei Lin (林群崴)
Date: Mon Mar 10 2025 - 09:24:20 EST
On Sun, 2025-03-09 at 15:20 -0700, Nhat Pham wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On Sun, Mar 9, 2025 at 1:44 PM Barry Song <21cnbao@xxxxxxxxx> wrote:
> >
> > On Mon, Mar 10, 2025 at 8:56 AM Nhat Pham <nphamcs@xxxxxxxxx>
> > wrote:
> > >
> > > On Sat, Mar 8, 2025 at 5:05 PM Hillf Danton <hdanton@xxxxxxxx>
> > > wrote:
> > > >
> > > > Could you explain what nr_kcompressd means, Qun-Wei, to quiesce
> > > > barking lads?
> > >
> > > Who's the "barking lads" you are referring to? Please mind your
> > > language.
> >
> > I also feel extremely uncomfortable. In Eastern culture, this is an
> > extremely
> > vulgar word, more offensive than any others.
> >
> > I strongly feel that this violates the mutual respect within the
> > Linux
> > community. This is a serious case of verbal abuse.
> >
> > Regardless of the existence of nr_kcompressd, it is still
> > unacceptable to
> > invent an interface that requires users to figure out how to set it
> > up, while
> > kswapd can launch threads based on NUMA nodes.
> > This should be transparent to users, just as kswapd does.
> >
> > void __meminit kswapd_run(int nid)
> >
> > {
> > ...
> > if (!pgdat->kswapd) {
> > pgdat->kswapd = kthread_create_on_node(kswapd,
> > pgdat,
> > nid, "kswapd%d", nid);
> > ...
> > }
> > pgdat_kswapd_unlock(pgdat);
> > }
> >
> > On the other hand, no one will know how to set up the proper number
> > of
> > threads, while direct reclaim can utilize each CPU.
>
> Agree - how are users supposed to set this? The default puzzles me
> too. Why 4? Does it work across architectures? Across workloads?
>
> This makes no sense to me. Can we scale the number of threads in
> proportion to the number of CPUs? Per-cpu kcompressd?
The default value is actually designed to be the maximum number of
kcompressd that can run simultaneously. The current design is to create
the next kcompressd thread when all kfifos are full, and the number 4
is just a temporary setting.
You are right, changing it to match the number of CPUs might be better
to avoid confusion on how to set it up.
Best Regards,
Qun-wei