lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150304083607.GE574@swordfish>
Date:	Wed, 4 Mar 2015 17:36:07 +0900
From:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:	Minchan Kim <minchan@...nel.org>
Cc:	Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
	Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Nitin Gupta <ngupta@...are.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/8] zram: add dynamic device add/remove functionality

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ