[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170402135659.GA10812@bombadil.infradead.org>
Date: Sun, 2 Apr 2017 06:56:59 -0700
From: Matthew Wilcox <willy@...radead.org>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [RFC] mm/crypto: add tunable compression algorithm for zswap
On Sat, Apr 01, 2017 at 11:18:13PM +0200, Vlastimil Babka wrote:
> In this prototype patch, it offers three predefined ratios, but nothing
> prevents more fine-grained settings, except the current crypto API (or my
> limited knowledge of it, but I'm guessing nobody really expected the
> compression ratio to be tunable). So by doing
>
> echo tco50 > /sys/module/zswap/parameters/compressor
>
> you get 50% compression ratio, guaranteed! This setting and zbud are just the
> perfect buddies, if you prefer the nice and simple allocator. Zero internal
> fragmentation!
[...]
> +struct tco_ctx {
> + char ratio;
> +};
You say this is a ratio, but it's a plain char. Clearly it should be
a floating point number; what if I want to achieve 2/3 compression?
Or if I'm a disgruntled sysadmin wanting to show how much more Linux
suxks than BSD, I might want to expand memory when it goes to swap,
perhaps taking up an extra 25%.
Maybe we could get away with char numerator; char denominator to allow
for the most common rationals, but a floating point ratio would be easier
to program with and allow for maximum flexibility. I don't think we
need to have as much precision as a double; a plain float should suffice.
Powered by blists - more mailing lists