LKML Archive on 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.work@gmail.com>,
	Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nitin Gupta <ngupta@vflare.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/8] zram: add dynamic device add/remove functionality
Date: Wed, 4 Mar 2015 17:36:07 +0900	[thread overview]
Message-ID: <20150304083607.GE574@swordfish> (raw)
In-Reply-To: <20150304081951.GD574@swordfish>

On (03/04/15 17:19), Sergey Senozhatsky wrote:
> hm... that actually doesn't look so hard.
> 
> all I need to do is just change zram_add attr to RW (or create a new RO
> attribute `zram_auto_add', or whatever) and treat read access to that
> zram_add_read() or zram_auto_add_read() attr as (atomic operation):
> 	-- generate new device_id X
> 	-- create corresponding zramX device
> 	-- return that X as char *text to user space (or error). the
> 	same way we sprintf() stats.
> 
> what do you think? I'll play with it.
> 

that will do the trick. testing simple patch:

# cat /sys/class/zram-control/zram_add
1
# cat /sys/class/zram-control/zram_add
2
# cat /sys/class/zram-control/zram_add
3
# cat /sys/class/zram-control/zram_add
4
# cat /sys/class/zram-control/zram_add
5

dmesg:
[14339.063075] zram: Added device: zram1
[14339.972633] zram: Added device: zram2
[14340.626564] zram: Added device: zram3
[14341.242134] zram: Added device: zram4
[14341.850853] zram: Added device: zram5


try to add already existing device_id

# echo 3 > /sys/class/zram-control/zram_add
-bash: echo: write error: File exists


zram_add() error propogation to user space (-ENOMEM in this case)

# cat /sys/class/zram-control/zram_add
cat: /sys/class/zram-control/zram_add: Cannot allocate memory


will send out new patch set later today.

	-ss

  reply	other threads:[~2015-03-04  8:36 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 12:49 [PATCHv3 0/8] introduce dynamic device creation/removal Sergey Senozhatsky
2015-03-03 12:49 ` [PATCH 1/8] zram: cosmetic ZRAM_ATTR_RO code formatting tweak Sergey Senozhatsky
2015-03-03 12:49 ` [PATCH 2/8] zram: use idr instead of `zram_devices' array Sergey Senozhatsky
2015-03-03 22:01   ` Andrew Morton
2015-03-04  0:21     ` Sergey Senozhatsky
2015-03-04  7:06   ` Minchan Kim
2015-03-04  7:34     ` Sergey Senozhatsky
2015-03-04  7:49     ` Sergey Senozhatsky
2015-03-05  0:59       ` Minchan Kim
2015-03-03 12:49 ` [PATCH 3/8] zram: factor out device reset from reset_store() Sergey Senozhatsky
2015-03-05  2:28   ` Minchan Kim
2015-03-03 12:49 ` [PATCH 4/8] zram: reorganize code layout Sergey Senozhatsky
2015-03-03 12:49 ` [PATCH 5/8] zram: add dynamic device add/remove functionality Sergey Senozhatsky
2015-03-03 22:01   ` Andrew Morton
2015-03-04  0:18     ` Sergey Senozhatsky
2015-03-04  7:10   ` Minchan Kim
2015-03-04  7:29     ` Sergey Senozhatsky
2015-03-04  8:19       ` Sergey Senozhatsky
2015-03-04  8:36         ` Sergey Senozhatsky [this message]
2015-03-03 12:49 ` [PATCH 6/8] zram: remove max_num_devices limitation Sergey Senozhatsky
2015-03-03 12:49 ` [PATCH 7/8] zram: report every added and removed device Sergey Senozhatsky
2015-03-03 12:49 ` [PATCH 8/8] zram: trivial: correct flag operations comment Sergey Senozhatsky
2015-04-15 21:37 ` [PATCHv3 0/8] introduce dynamic device creation/removal Andrew Morton
2015-04-15 23:40   ` Minchan Kim
2015-04-16  0:30     ` Sergey Senozhatsky
2015-04-16  0:47   ` 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=20150304083607.GE574@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky@gmail.com \
    --subject='Re: [PATCH 5/8] zram: add dynamic device add/remove functionality' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).