Re: [PATCH v3 RESEND] zram: auto add new devices on demand

From: Alex Elsayed
Date: Fri Aug 08 2014 - 05:14:30 EST


Minchan Kim wrote:

> On Wed, Jul 30, 2014 at 10:58:31PM +0900, Sergey Senozhatsky wrote:
>> Hello,
>>
>> On (07/29/14 12:00), Minchan Kim wrote:
>> > Hello Timofey,
>> >

<snip>

>> > Why do you add new device unconditionally?
>> > Maybe we need new konb on sysfs or ioctl for adding new device?
>> > Any thought, guys?
>>
>>
>> speaking of the patch, frankly, I (almost) see no gain comparing to the
>> existing functionality.
>>
>> speaking of the idea. well, I'm not 100% convinced yet. the use cases I
>> see around do not imply dynamic creation/resizing/etc. that said, I need
>> to think about it.
>
> It didn't persuade me, either.
>
> Normally, distro have some config file for adding param at module loading
> like /etc/modules. So, I think it should be done in there if someone want
> to increase the number of zram devices.

The problem here is that this requires (at least) unloading the module, and
if it was built in requires a reboot (and futzing with the kernel command
line, rather than /etc/modules.d)

If someone's distro already loaded the module with nr_devices=1 (the
default, I remind you), and is using it as swap, then it may well not be a
feasible option for them to swapoff the (potentially large) swap device and
do the modprobe dance.

If they're running off a livecd that's using it in combination with, say,
LVM thin provisioning in order to have a writeable system, then they are
_completely_ screwed because you can't swapoff your rootfs.

If they're using it as a backing store for ephemeral containers or VMs, then
they may hit _any_ static limit, when they just want to start one more
without having to stop the existing bunch.

The swap case might be argued as "deal with it" (despite that swapoff is not
something fun to do on a system under any real-world load, _especially_ if
what you're trying to force off of the swap device won't fit in ram and has
to get pushed down to a different swap device).

But any case where people put filesystems on the device should make the
issues of only supporting the module parameter pretty apparent.

Finally, there's the issue of clutter - I may need 4 zram devices when I'm
experimenting with something, but only the one swap device for daily use.
Having the other three just sitting around permanently is at most an
annoyance, a 'papercut' - but papercuts add up.

>>
>> if we end up adding this functionality I tend to vote for sysfs knob,
>> just because it seems to be more user friendly than writing some magic
>> INTs to ioctl-d fd.

This I agree with wholeheartedly.

<snip>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/