All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Minchan Kim <minchan@kernel.org>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Ganesh Mahendran <opensource.ganesh@gmail.com>,
	Jerome Marchand <jmarchan@redhat.com>,
	Nitin Gupta <ngupta@vflare.org>,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
	linux-kernel@vger.kernel.org, nefelim4ag@gmail.com,
	eternaleye@gmail.com
Subject: Re: [PATCH] zram: rework reset and destroy path
Date: Wed, 4 Feb 2015 09:24:51 +0900	[thread overview]
Message-ID: <20150204002450.GA527@swordfish> (raw)
In-Reply-To: <20150203234201.GA3583@blaptop>

Hello Minchan,

On (02/04/15 08:42), Minchan Kim wrote:
> > +	kfree(zram_devices);
> > +	unregister_blkdev(zram_major, "zram");
> > +	pr_debug("Destroyed %u device(s)\n", nr);
> 
> Create_device just shows the number of created device so I think
> no worth to emit per-device information in destroy_devices.
> Let's just emit clean up done like old in zram_exit but
> use pr_info instead of pr_debug.

not critical let's keep it as is (it just mirrors the message from init()),
and I wouldn't say it's totally useless now. we allocate space for devices,
disk, queue, etc. and we destroy it here.

please see below.

> Another concern is I'd like to keep per-device interface(e,g.
> create_device, destroy_device) because there was requirement
> to add new zram device dynamically. I guess you could remember
> that. Although I didn't have a enough time to response,
> Alex finally convinced me so I hope a contributor who have time
> will do it if he has an interest about that.

yes, I was going to tell you that perhaps I'll do that. I had several
discussions on google+ and it seems that people want to see this
feature. so I was going to ask your opinion.

the solution I'm thinking about now is to replace zram devices fixed
size array with a list, protected by mutex or spin lock (doesn't
matter at this point). this will change destroy_devices() from array
iteration to destroy each list entry.

so:
a)	pr_debug("Destroyed %u device(s)\n", nr)
it will show the actual number of active devices by that time.

b) I'll refactor destroy_devices().

this rework will not make it into the upcoming merge window, so we'll
have enough time.

I haven't decided yet, if I wan't to keep released zram devices in the
list (idle zram devices list, picking up the first available device
when user requests new zram device) or I will destroy abondoned devices
and , thus, the list will represent only active devices.


I tend to select the latter one -- destroy unused zram devices. I don't
want to give additional sysfs knob to limit the number of idle devices,
waste memory for idle devices, etc. We already  have a number of quite
complicated knobs.


	-ss

> For it, per-device creating/destroy interface looks better.
> https://lkml.org/lkml/2014/8/8/142
> Anyway, I cannot expect it happens sooner so I'm not strong
> against your patch(ie, create_device, destroy_devices)
> because I think we could do refactoring it when we need it.
> 

  reply	other threads:[~2015-02-04  0:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-03 16:15 [PATCH] zram: rework reset and destroy path Sergey Senozhatsky
2015-02-03 23:42 ` Minchan Kim
2015-02-04  0:24   ` Sergey Senozhatsky [this message]
2015-02-04  0:35     ` Minchan Kim
2015-02-04  0:45       ` 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=20150204002450.GA527@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=eternaleye@gmail.com \
    --cc=jmarchan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=nefelim4ag@gmail.com \
    --cc=ngupta@vflare.org \
    --cc=opensource.ganesh@gmail.com \
    --cc=sergey.senozhatsky@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.