This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Fri Apr 26 08:42:13 2024 >From spaans Wed May 6 06:51:25 2015 Received: from pop.ziggo.nl [212.54.42.19] by squeeze.vs19.net with POP3 (fetchmail-6.3.21) for (single-drop); Wed, 06 May 2015 06:51:25 +0200 (CEST) Received: from md3.tb.mail.iss.local ([212.54.42.149]) by mc5.tb.mail.iss.local (Dovecot) with LMTP id 4/sdI5CcSVWKCQAAh0Kp1A for ; Wed, 06 May 2015 06:48:36 +0200 Received: from mx21.tb.mail.iss.as9143.net ([212.54.42.149]) by md3.tb.mail.iss.local (Dovecot) with LMTP id rnvRPKUmLVUGLwAAGeRBqA ; Wed, 06 May 2015 06:42:09 +0200 Received: from vger.kernel.org ([209.132.180.67]) by mx21.tb.mail.iss.as9143.net with esmtp (Exim 4.82) (envelope-from ) id 1YprG7-0004nH-Vf for bmw12-lkml@ziggo.nl; Wed, 06 May 2015 06:48:36 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752043AbbEFEsa (ORCPT ); Wed, 6 May 2015 00:48:30 -0400 Received: from mail-pa0-f46.google.com ([209.85.220.46]:34618 "EHLO mail-pa0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751489AbbEFEs0 (ORCPT ); Wed, 6 May 2015 00:48:26 -0400 Received: by pacyx8 with SMTP id yx8so215193761pac.1; Tue, 05 May 2015 21:48:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=ltVvJ2oRE+sepMczmIPsXqPE54TPcnFID X-Received: by 10.68.88.33 with SMTP id bd1mr58537137pbb.124.1430887705400; Tue, 05 May 2015 21:48:25 -0700 (PDT) Received: from blaptop ([27.122.242.71]) by mx.google.com with ESMTPSA id ph4sm478533pdb.43.2015.05.05.21.48.22 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 May 2015 21:48:24 -0700 (PDT) Date: Wed, 6 May 2015 13:48:16 +0900 From: Minchan Kim To: akpm@linux-foundation.org, Sergey Senozhatsky Cc: sergey.senozhatsky@gmail.com, ngupta@vflare.org, mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: + zram-add-dynamic-device-add-remove-functionality.patch added to -mm tree Message-Id: <20150506044709.GA17104@blaptop> References: <5547f949.BE1kcafgkv0+NSDE%akpm@linux-foundation.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="WYTEVAkct0FjGQmd" Content-Disposition: inline In-Reply-To: <5547f949.BE1kcafgkv0+NSDE%akpm@linux-foundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-Id: X-Mailing-List: linux-kernel@vger.kernel.org X-Ziggo-spamsetting: Instelling=Gemiddeld Scorelimiet=14 X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.1 cv=GujugBBC c=1 sm=0 tr=0 a=UK1r566ZdBxH71SXbqIOeA==:17 a=yEdEr6MRgwAA:10 a=xJXxBj9MK60A:10 a=VwQbUJbxAAAA:8 a=cIF5Tx0qAAAA:8 a=1XWaLZrsAAAA:8 a=h1PgugrvaO0A:10 a=Z4Rwk6OoAAAA:8 a=voM4FWlXAAAA:8 a=pGLkceISAAAA:8 a=5ERLSQ9GAAAA:8 a=d7 X-Ziggo-Spam-Status: No X-Spam-Status: No X-Spam-Flag: No --WYTEVAkct0FjGQmd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello Sergey, While I test this patch, I got this warning. I used attached script to reproduce it. You should run several copy of script to reproduce it like below. #>./dynamic_remove.sh & #>./dynamic_remove.sh & Hope you investigate the problem. =2E.. =2E.. =0D=1B[74G[ OK ] * Starting MD monitoring service mdadm --monitor =1B[80G =0D=1B[74G[= OK ] * Checking battery state... =1B[80G grep: /sys/power/state: No such = file or directory grep: /sys/power/state: No such file or directory grep: /sys/power/state: No such file or directory =0D=1B[74G[ OK ] [ 10.961394] init: plymouth-stop pre-start process (1441) terminated with= status 1 [ 11.655424] random: nonblocking pool is initialized [ 98.106916] zram: Added device: zram1 [ 98.108124] zram1: detected capacity change from 0 to 20971520 [ 98.111037] zram: Added device: zram2 [ 98.112876] zram2: detected capacity change from 0 to 20971520 [ 98.118034] zram: Added device: zram3 [ 98.119691] zram3: detected capacity change from 0 to 20971520 [ 98.123948] zram: Added device: zram4 [ 98.125205] zram4: detected capacity change from 0 to 20971520 [ 98.129088] zram: Added device: zram5 [ 98.129998] zram5: detected capacity change from 0 to 20971520 [ 98.133486] zram: Added device: zram6 [ 98.134579] zram6: detected capacity change from 0 to 20971520 [ 98.138140] zram: Added device: zram7 [ 98.140175] zram7: detected capacity change from 0 to 20971520 [ 98.143433] zram: Added device: zram8 [ 98.144389] zram8: detected capacity change from 0 to 20971520 [ 98.147172] zram: Added device: zram9 [ 98.148574] zram9: detected capacity change from 0 to 20971520 [ 98.151807] zram: Added device: zram10 [ 98.153247] zram10: detected capacity change from 0 to 20971520 [ 98.158626] zram: Added device: zram11 [ 98.159785] zram11: detected capacity change from 0 to 20971520 [ 98.163183] zram: Added device: zram12 [ 98.165138] zram12: detected capacity change from 0 to 20971520 [ 98.168077] zram: Added device: zram13 [ 98.169060] zram13: detected capacity change from 0 to 20971520 [ 98.172264] zram: Added device: zram14 [ 98.173445] zram14: detected capacity change from 0 to 20971520 [ 98.176820] zram: Added device: zram15 [ 98.177804] zram15: detected capacity change from 0 to 20971520 [ 98.180816] zram: Added device: zram16 [ 98.182020] zram16: detected capacity change from 0 to 20971520 [ 98.185495] zram: Added device: zram17 [ 98.187245] zram17: detected capacity change from 0 to 20971520 [ 98.191791] zram: Added device: zram18 [ 98.192925] zram18: detected capacity change from 0 to 20971520 [ 98.196314] zram: Added device: zram19 [ 98.198937] zram19: detected capacity change from 0 to 20971520 [ 98.202523] zram: Added device: zram20 [ 98.203615] zram20: detected capacity change from 0 to 20971520 [ 98.207473] zram: Added device: zram21 [ 98.208529] zram21: detected capacity change from 0 to 20971520 [ 98.211940] zram: Added device: zram22 [ 98.212839] zram22: detected capacity change from 0 to 20971520 [ 98.216381] zram: Added device: zram23 [ 98.217278] zram23: detected capacity change from 0 to 20971520 [ 98.219953] zram: Added device: zram24 [ 98.222805] zram24: detected capacity change from 0 to 20971520 [ 98.226039] zram: Added device: zram25 [ 98.227008] zram25: detected capacity change from 0 to 20971520 [ 98.246547] zram: Removed device: zram4 [ 98.316665] zram: Removed device: zram8 [ 98.330010] zram: Removed device: zram1 [ 98.364826] zram: Removed device: zram3 [ 98.393897] zram: Removed device: zram5 [ 98.395801] zram: Removed device: zram6 [ 98.399364] zram: Removed device: zram7 [ 98.405376] zram: Removed device: zram11 [ 98.408452] zram: Removed device: zram12 [ 98.420747] zram: Removed device: zram14 [ 98.433739] zram: Removed device: zram15 [ 98.447536] zram: Removed device: zram16 [ 98.450580] zram: Removed device: zram17 [ 98.457826] zram: Removed device: zram18 [ 98.459562] zram: Removed device: zram19 [ 98.461362] zram: Removed device: zram20 [ 98.463272] zram: Removed device: zram21 [ 98.464454] zram: Removed device: zram22 [ 98.465547] zram: Removed device: zram23 [ 98.466794] zram: Removed device: zram24 [ 98.467938] zram: Removed device: zram25 [ 98.470475] zram: Removed device: zram2 [ 98.472080] zram: Removed device: zram9 [ 98.473410] zram: Removed device: zram10 [ 98.474974] zram: Removed device: zram13 [ 98.480408] zram: Added device: zram1 [ 98.481656] zram1: detected capacity change from 0 to 20971520 [ 98.484709] zram: Added device: zram2 [ 98.485533] zram2: detected capacity change from 0 to 20971520 [ 98.490166] zram: Added device: zram3 [ 98.491463] zram3: detected capacity change from 0 to 20971520 [ 98.495471] zram: Added device: zram4 [ 98.496793] zram4: detected capacity change from 0 to 20971520 [ 98.499398] zram: Added device: zram5 [ 98.500522] zram5: detected capacity change from 0 to 20971520 [ 98.507491] zram: Added device: zram6 [ 98.508370] zram6: detected capacity change from 0 to 20971520 [ 98.518639] zram: Added device: zram7 [ 98.519697] zram7: detected capacity change from 0 to 20971520 [ 98.522650] zram: Added device: zram8 [ 98.523507] zram8: detected capacity change from 0 to 20971520 [ 98.525985] zram: Added device: zram9 [ 98.527046] zram9: detected capacity change from 0 to 20971520 [ 98.531154] zram: Added device: zram10 [ 98.532390] zram10: detected capacity change from 0 to 20971520 [ 98.535335] zram: Added device: zram11 [ 98.536179] zram11: detected capacity change from 0 to 20971520 [ 98.538633] zram: Added device: zram12 [ 98.539812] zram12: detected capacity change from 0 to 20971520 [ 98.545105] zram: Added device: zram13 [ 98.546696] zram13: detected capacity change from 0 to 20971520 [ 98.550453] zram: Added device: zram14 [ 98.551394] zram14: detected capacity change from 0 to 20971520 [ 98.556193] zram: Added device: zram15 [ 98.557564] zram15: detected capacity change from 0 to 20971520 [ 98.561741] zram: Added device: zram16 [ 98.562799] zram16: detected capacity change from 0 to 20971520 [ 98.565537] zram: Added device: zram17 [ 98.566344] zram17: detected capacity change from 0 to 20971520 [ 98.569192] zram: Added device: zram18 [ 98.570437] zram18: detected capacity change from 0 to 20971520 [ 98.573588] zram: Added device: zram19 [ 98.574826] zram19: detected capacity change from 0 to 20971520 [ 98.578450] zram: Added device: zram20 [ 98.579623] zram20: detected capacity change from 0 to 20971520 [ 98.582528] zram: Added device: zram21 [ 98.584440] zram21: detected capacity change from 0 to 20971520 [ 98.587922] zram: Added device: zram22 [ 98.589239] zram22: detected capacity change from 0 to 20971520 [ 98.593854] zram: Added device: zram23 [ 98.595130] zram23: detected capacity change from 0 to 20971520 [ 98.598610] zram: Added device: zram24 [ 98.599953] zram24: detected capacity change from 0 to 20971520 [ 98.603456] zram: Added device: zram25 [ 98.604706] zram25: detected capacity change from 0 to 20971520 [ 98.631424] zram: Removed device: zram11 [ 98.639214] zram: Removed device: zram14 [ 98.647116] zram: Removed device: zram15 [ 98.756017] zram: Removed device: zram2 [ 98.757087] ------------[ cut here ]------------ [ 98.758349] WARNING: CPU: 5 PID: 2952 at fs/sysfs/dir.c:31 sysfs_warn_du= p+0x68/0x80() [ 98.760065] sysfs: cannot create duplicate filename '/devices/virtual/bd= i/252:2' [ 98.761061] Modules linked in: [ 98.761530] CPU: 5 PID: 2952 Comm: cat Not tainted 4.1.0-rc2-next-201505= 05+ #1260 [ 98.762682] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = Bochs 01/01/2011 [ 98.764140] ffff88005d40f948 ffff88005d40f948 ffffffff8163d8d8 00000000= 00000000 [ 98.765614] ffff88005d40f998 ffff88005d40f988 ffffffff8105f02a 00000000= 00000000 [ 98.766815] ffff8800653c2000 ffff88007f526210 ffff88004b3aa1c8 ffff8800= 65799360 [ 98.768980] Call Trace: [ 98.769643] [] dump_stack+0x4c/0x65 [ 98.770431] [] warn_slowpath_common+0x8a/0xc0 [ 98.771353] [] warn_slowpath_fmt+0x46/0x50 [ 98.772220] [] ? warn_slowpath_fmt+0x5/0x50 [ 98.773099] [] sysfs_warn_dup+0x68/0x80 [ 98.773903] [] ? sysfs_warn_dup+0x5/0x80 [ 98.774750] [] sysfs_create_dir_ns+0x8e/0xa0 [ 98.775794] [] ? sysfs_create_dir_ns+0x5/0xa0 [ 98.776672] [] kobject_add_internal+0xa5/0x2f0 [ 98.777737] [] ? __mutex_unlock_slowpath+0xb3/0x180 [ 98.778765] [] kobject_add+0x60/0xb0 [ 98.779598] [] ? get_device_parent+0x5/0x200 [ 98.780430] [] device_add+0x102/0x5b0 [ 98.780956] [] ? device_add+0x5/0x5b0 [ 98.781513] [] device_create_groups_vargs+0xd8/0x100 [ 98.782119] [] ? device_create_vargs+0x5/0x20 [ 98.782851] [] device_create_vargs+0x1c/0x20 [ 98.783464] [] bdi_register+0x67/0x2a0 [ 98.784081] [] ? bdi_register_dev+0x5/0x30 [ 98.784609] [] bdi_register_dev+0x27/0x30 [ 98.785139] [] add_disk+0x1b9/0x4e0 [ 98.785844] [] ? snprintf+0x34/0x40 [ 98.786353] [] zram_add+0x1ec/0x2f0 [ 98.786833] [] zram_add_show+0x22/0x60 [ 98.787344] [] class_attr_show+0x1b/0x30 [ 98.787848] [] sysfs_kf_seq_show+0xcf/0x1d0 [ 98.788374] [] kernfs_seq_show+0x26/0x30 [ 98.788880] [] seq_read+0xf5/0x3a0 [ 98.789338] [] ? kernfs_vma_page_mkwrite+0xa0/0xa0 [ 98.789917] [] kernfs_fop_read+0x125/0x180 [ 98.790483] [] __vfs_read+0x28/0xe0 [ 98.790959] [] ? __vfs_read+0x5/0xe0 [ 98.791476] [] ? __vfs_read+0x5/0xe0 [ 98.791952] [] vfs_read+0x86/0x140 [ 98.792418] [] ? __fdget_pos+0x17/0x50 [ 98.792908] [] SyS_read+0x49/0xb0 [ 98.793360] [] system_call_fastpath+0x12/0x6f [ 98.793903] ---[ end trace e1035d8c51ec986c ]--- [ 98.794358] ------------[ cut here ]------------ [ 98.794783] WARNING: CPU: 5 PID: 2952 at lib/kobject.c:240 kobject_add_i= nternal+0x284/0x2f0() [ 98.795999] kobject_add_internal failed for 252:2 with -EEXIST, don't tr= y to register things with the same name in the same directory. [ 98.797097] Modules linked in: [ 98.797396] CPU: 5 PID: 2952 Comm: cat Tainted: G W 4.1.0-r= c2-next-20150505+ #1260 [ 98.798173] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = Bochs 01/01/2011 [ 98.798951] ffff88005d40f9a8 ffff88005d40f9a8 ffffffff8163d8d8 00000000= 00000000 [ 98.799689] ffff88005d40f9f8 ffff88005d40f9e8 ffffffff8105f02a 00000000= 00000000 [ 98.800383] ffff88007f64a410 ffff880065799360 00000000ffffffef ffff8800= 65799360 [ 98.801096] Call Trace: [ 98.801330] [] dump_stack+0x4c/0x65 [ 98.801800] [] warn_slowpath_common+0x8a/0xc0 [ 98.802383] [] warn_slowpath_fmt+0x46/0x50 [ 98.802908] [] ? kobj_kset_leave+0x46/0x60 [ 98.803437] [] ? warn_slowpath_fmt+0x5/0x50 [ 98.803967] [] kobject_add_internal+0x284/0x2f0 [ 98.804662] [] ? __mutex_unlock_slowpath+0xb3/0x180 [ 98.805255] [] kobject_add+0x60/0xb0 [ 98.805734] [] ? get_device_parent+0x5/0x200 [ 98.806273] [] device_add+0x102/0x5b0 [ 98.806790] [] ? device_add+0x5/0x5b0 [ 98.807404] [] device_create_groups_vargs+0xd8/0x100 [ 98.808039] [] ? device_create_vargs+0x5/0x20 [ 98.808595] [] device_create_vargs+0x1c/0x20 [ 98.809120] [] bdi_register+0x67/0x2a0 [ 98.809604] [] ? bdi_register_dev+0x5/0x30 [ 98.810101] [] bdi_register_dev+0x27/0x30 [ 98.810685] [] add_disk+0x1b9/0x4e0 [ 98.811155] [] ? snprintf+0x34/0x40 [ 98.811616] [] zram_add+0x1ec/0x2f0 [ 98.812069] [] zram_add_show+0x22/0x60 [ 98.812550] [] class_attr_show+0x1b/0x30 [ 98.813076] [] sysfs_kf_seq_show+0xcf/0x1d0 [ 98.813592] [] kernfs_seq_show+0x26/0x30 [ 98.814069] [] seq_read+0xf5/0x3a0 [ 98.814599] [] ? kernfs_vma_page_mkwrite+0xa0/0xa0 [ 98.815179] [] kernfs_fop_read+0x125/0x180 [ 98.815716] [] __vfs_read+0x28/0xe0 [ 98.816153] [] ? __vfs_read+0x5/0xe0 [ 98.816601] [] ? __vfs_read+0x5/0xe0 [ 98.817051] [] vfs_read+0x86/0x140 [ 98.817485] [] ? __fdget_pos+0x17/0x50 [ 98.817950] [] SyS_read+0x49/0xb0 [ 98.818455] [] system_call_fastpath+0x12/0x6f [ 98.818985] ---[ end trace e1035d8c51ec986d ]--- [ 98.819810] BUG: unable to handle kernel NULL pointer dereference at 000= 0000000000040 [ 98.820591] IP: [] sysfs_do_create_link_sd.isra.2+0x40= /0xd0 [ 98.821290] PGD 61669067 PUD 61553067 PMD 0=20 [ 98.821709] Oops: 0000 [#1] SMP=20 [ 98.822047] Dumping ftrace buffer: [ 98.822425] (ftrace buffer empty) [ 98.822763] Modules linked in: [ 98.823056] CPU: 5 PID: 2952 Comm: cat Tainted: G W 4.1.0-r= c2-next-20150505+ #1260 [ 98.823663] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = Bochs 01/01/2011 [ 98.823663] task: ffff880056942140 ti: ffff88005d40c000 task.ti: ffff880= 05d40c000 [ 98.823663] RIP: 0010:[] [] sysfs_d= o_create_link_sd.isra.2+0x40/0xd0 [ 98.823663] RSP: 0018:ffff88005d40fc28 EFLAGS: 00010292 [ 98.823663] RAX: ffff880056942140 RBX: 0000000000000040 RCX: 0000000006d= a06d9 [ 98.823663] RDX: 0000000006d906d9 RSI: 1ca0f28c302c6000 RDI: ffffffff81c= 82ca0 [ 98.823663] RBP: ffff88005d40fc58 R08: 0000000000000001 R09: 00000000000= 00000 [ 98.823663] R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff819= f9187 [ 98.823663] R13: ffff880061ca2688 R14: 0000000000000001 R15: ffff88007f6= 4c490 [ 98.823663] FS: 00007f1262ed4700(0000) GS:ffff880068140000(0000) knlGS:= 0000000000000000 [ 98.823663] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [ 98.823663] CR2: 0000000000000040 CR3: 000000005fc77000 CR4: 00000000000= 007e0 [ 98.823663] Stack: [ 98.823663] ffffffff8135931b ffff88007f64c400 ffff88007f64c4a0 ffff8800= 5f889660 [ 98.823663] ffff88007f64c40c ffff88007f64c490 ffff88005d40fc68 ffffffff= 8126db05 [ 98.823663] ffff88005d40fcd8 ffffffff81359fc2 ffff88007f64c400 ffffffff= 8137a9a4 [ 98.823663] Call Trace: [ 98.823663] [] ? disk_part_iter_next+0x2b/0x280 [ 98.823663] [] sysfs_create_link+0x25/0x50 [ 98.823663] [] add_disk+0x252/0x4e0 [ 98.823663] [] ? snprintf+0x34/0x40 [ 98.823663] [] zram_add+0x1ec/0x2f0 [ 98.823663] [] zram_add_show+0x22/0x60 [ 98.823663] [] class_attr_show+0x1b/0x30 [ 98.823663] [] sysfs_kf_seq_show+0xcf/0x1d0 [ 98.823663] [] kernfs_seq_show+0x26/0x30 [ 98.823663] [] seq_read+0xf5/0x3a0 [ 98.823663] [] ? kernfs_vma_page_mkwrite+0xa0/0xa0 [ 98.823663] [] kernfs_fop_read+0x125/0x180 [ 98.823663] [] __vfs_read+0x28/0xe0 [ 98.823663] [] ? __vfs_read+0x5/0xe0 [ 98.823663] [] ? __vfs_read+0x5/0xe0 [ 98.823663] [] vfs_read+0x86/0x140 [ 98.823663] [] ? __fdget_pos+0x17/0x50 [ 98.823663] [] SyS_read+0x49/0xb0 [ 98.823663] [] system_call_fastpath+0x12/0x6f [ 98.823663] Code: 48 83 ec 08 48 85 d2 0f 84 8e 00 00 00 48 85 ff 49 89 = fd 0f 84 82 00 00 00 48 89 f3 48 c7 c7 a0 2c c8 81 41 89 ce e8 f0 89 3d 00 = <48> 8b 1b 48 85 db 74 48 48 89 df e8 c0 bf ff ff 48 c7 c7 a0 2c=20 [ 98.823663] RIP [] sysfs_do_create_link_sd.isra.2+0x4= 0/0xd0 [ 98.823663] RSP [ 98.823663] CR2: 0000000000000040 [ 98.823663] ---[ end trace e1035d8c51ec986e ]--- [ 98.823663] BUG: sleeping function called from invalid context at kernel= /locking/rwsem.c:21 [ 98.823663] in_atomic(): 1, irqs_disabled(): 1, pid: 2952, name: cat [ 98.823663] INFO: lockdep is turned off. [ 98.823663] irq event stamp: 3392 [ 98.823663] hardirqs last enabled at (3391): [] __mut= ex_unlock_slowpath+0xb3/0x180 [ 98.823663] hardirqs last disabled at (3392): [] error= _sti+0x5/0x6 [ 98.823663] softirqs last enabled at (0): [] copy_pro= cess.part.35+0x4d9/0x1ce0 [ 98.823663] softirqs last disabled at (0): [< (null)>] = (null) [ 98.823663] CPU: 5 PID: 2952 Comm: cat Tainted: G D W 4.1.0-r= c2-next-20150505+ #1260 [ 98.823663] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS = Bochs 01/01/2011 [ 98.823663] ffff88005d40f8c8 ffff88005d40f8c8 ffffffff8163d8d8 00000000= 00000000 [ 98.823663] 0000000000000000 ffff88005d40f8f8 ffffffff8108c18e ffffffff= 8108c005 [ 98.823663] ffffffff819ec8b3 0000000000000015 0000000000000000 ffff8800= 5d40f928 [ 98.823663] Call Trace: [ 98.823663] [] dump_stack+0x4c/0x65 [ 98.823663] [] ___might_sleep+0x18e/0x250 [ 98.823663] [] ? ___might_sleep+0x5/0x250 [ 98.823663] [] __might_sleep+0x4d/0x90 [ 98.823663] [] ? __might_sleep+0x5/0x90 [ 98.823663] [] down_read+0x24/0x70 [ 98.823663] [] ? down_read+0x5/0x70 [ 98.823663] [] ? exit_signals+0x24/0x130 [ 98.823663] [] exit_signals+0x24/0x130 [ 98.823663] [] ? exit_signals+0x5/0x130 [ 98.823663] [] ? do_exit+0xb8/0xbc0 [ 98.823663] [] do_exit+0xb8/0xbc0 [ 98.823663] [] ? do_exit+0x5/0xbc0 [ 98.823663] [] ? kmsg_dump+0x119/0x1a0 [ 98.823663] [] ? kmsg_dump+0x25/0x1a0 [ 98.823663] [] oops_end+0x8e/0xd0 [ 98.823663] [] ? oops_end+0x5/0xd0 [ 98.823663] [] no_context+0x2d9/0x33e [ 98.823663] [] ? no_context+0x5/0x33e [ 98.823663] [] __bad_area_nosemaphore+0x78/0x1d1 [ 98.823663] [] ? bad_area_nosemaphore+0x5/0x15 [ 98.823663] [] bad_area_nosemaphore+0x13/0x15 [ 98.823663] [] __do_page_fault+0x9e/0x490 [ 98.823663] [] ? __do_page_fault+0x5/0x490 [ 98.823663] [] do_page_fault+0xc/0x10 [ 98.823663] [] page_fault+0x22/0x30 [ 98.823663] [] ? sysfs_do_create_link_sd.isra.2+0x40/= 0xd0 [ 98.823663] [] ? sysfs_do_create_link_sd.isra.2+0x40/= 0xd0 [ 98.823663] [] ? disk_part_iter_next+0x2b/0x280 [ 98.823663] [] sysfs_create_link+0x25/0x50 [ 98.823663] [] add_disk+0x252/0x4e0 [ 98.823663] [] ? snprintf+0x34/0x40 [ 98.823663] [] zram_add+0x1ec/0x2f0 [ 98.823663] [] zram_add_show+0x22/0x60 [ 98.823663] [] class_attr_show+0x1b/0x30 [ 98.823663] [] sysfs_kf_seq_show+0xcf/0x1d0 [ 98.823663] [] kernfs_seq_show+0x26/0x30 [ 98.823663] [] seq_read+0xf5/0x3a0 [ 98.823663] [] ? kernfs_vma_page_mkwrite+0xa0/0xa0 [ 98.823663] [] kernfs_fop_read+0x125/0x180 [ 98.823663] [] __vfs_read+0x28/0xe0 [ 98.823663] [] ? __vfs_read+0x5/0xe0 [ 98.823663] [] ? __vfs_read+0x5/0xe0 [ 98.823663] [] vfs_read+0x86/0x140 [ 98.823663] [] ? __fdget_pos+0x17/0x50 [ 98.823663] [] SyS_read+0x49/0xb0 [ 98.823663] [] system_call_fastpath+0x12/0x6f [ 98.823663] note: cat[2952] exited with preempt_count 1 On Mon, May 04, 2015 at 03:57:13PM -0700, akpm@linux-foundation.org wrote: >=20 > The patch titled > Subject: zram: add dynamic device add/remove functionality > has been added to the -mm tree. Its filename is > zram-add-dynamic-device-add-remove-functionality.patch >=20 > This patch should soon appear at > http://ozlabs.org/~akpm/mmots/broken-out/zram-add-dynamic-device-add-= remove-functionality.patch > and later at > http://ozlabs.org/~akpm/mmotm/broken-out/zram-add-dynamic-device-add-= remove-functionality.patch >=20 > Before you just go and hit "reply", please: > a) Consider who else should be cc'ed > b) Prefer to cc a suitable mailing list as well > c) Ideally: find the original patch on the mailing list and do a > reply-to-all to that, adding suitable additional cc's >=20 > *** Remember to use Documentation/SubmitChecklist when testing your code = *** >=20 > The -mm tree is included into linux-next and is updated > there every 3-4 working days >=20 > ------------------------------------------------------ > From: Sergey Senozhatsky > Subject: zram: add dynamic device add/remove functionality >=20 > We currently don't support on-demand device creation. The one and only > way to have N zram devices is to specify num_devices module parameter > (default value: 1). IOW if, for some reason, at some point, user wants to > have N + 1 devies he/she must umount all the existing devices, unload the > module, load the module passing num_devices equals to N + 1. And do this > again, if needed. >=20 > This patch introduces zram control sysfs class, which has two sysfs > attrs: > - zram_add -- add a new zram device > - zram_remove -- remove a specific (device_id) zram device >=20 > zram_add sysfs attr is read-only and has only automatic device id > assignment mode (as requested by Minchan Kim). read operation performed > on this attr creates a new zram device and returns back its device_id or > error status. >=20 > Usage example: > # add a new specific zram device > cat /sys/class/zram-control/zram_add > 2 >=20 > # remove a specific zram device > echo 4 > /sys/class/zram-control/zram_remove >=20 > Returning zram_add() error code back to user (-ENOMEM in this case) >=20 > cat /sys/class/zram-control/zram_add > cat: /sys/class/zram-control/zram_add: Cannot allocate memory >=20 > NOTE, there might be users who already depend on the fact that at least > zram0 device gets always created by zram_init(). Preserve this behavior. >=20 > [minchan@kernel.org: use zram->claim to avoid lockdep splat] > Signed-off-by: Sergey Senozhatsky > Cc: Minchan Kim > Cc: Nitin Gupta > Signed-off-by: Andrew Morton > --- >=20 > Documentation/ABI/testing/sysfs-class-zram | 24 ++++ > Documentation/blockdev/zram.txt | 23 +++- > drivers/block/zram/zram_drv.c | 100 ++++++++++++++++++- > 3 files changed, 141 insertions(+), 6 deletions(-) >=20 > diff -puN /dev/null Documentation/ABI/testing/sysfs-class-zram > --- /dev/null > +++ a/Documentation/ABI/testing/sysfs-class-zram > @@ -0,0 +1,24 @@ > +What: /sys/class/zram-control/ > +Date: August 2015 > +KernelVersion: 4.2 > +Contact: Sergey Senozhatsky > +Description: > + The zram-control/ class sub-directory belongs to zram > + device class > + > +What: /sys/class/zram-control/zram_add > +Date: August 2015 > +KernelVersion: 4.2 > +Contact: Sergey Senozhatsky > +Description: > + RO attribute. Read operation will cause zram to add a new > + device and return its device id back to user (so one can > + use /dev/zram), or error code. > + > +What: /sys/class/zram-control/zram_add > +Date: August 2015 > +KernelVersion: 4.2 > +Contact: Sergey Senozhatsky > +Description: > + Remove a specific /dev/zramX device, where X is a device_id > + provided by user > diff -puN Documentation/blockdev/zram.txt~zram-add-dynamic-device-add-rem= ove-functionality Documentation/blockdev/zram.txt > --- a/Documentation/blockdev/zram.txt~zram-add-dynamic-device-add-remove-= functionality > +++ a/Documentation/blockdev/zram.txt > @@ -99,7 +99,24 @@ size of the disk when not in use so a hu > mkfs.ext4 /dev/zram1 > mount /dev/zram1 /tmp > =20 > -7) Stats: > +7) Add/remove zram devices > + > +zram provides a control interface, which enables dynamic (on-demand) dev= ice > +addition and removal. > + > +In order to add a new /dev/zramX device, perform read operation on zram_= add > +attribute. This will return either new device's device id (meaning that = you > +can use /dev/zram) or error code. > + > +Example: > + cat /sys/class/zram-control/zram_add > + 1 > + > +To remove the existing /dev/zramX device (where X is a device id) > +execute > + echo X > /sys/class/zram-control/zram_remove > + > +8) Stats: > Per-device statistics are exported as various nodes under /sys/block/zra= m/ > =20 > A brief description of exported device attritbutes. For more details ple= ase > @@ -174,11 +191,11 @@ line of text and contains the following > zero_pages > num_migrated > =20 > -8) Deactivate: > +9) Deactivate: > swapoff /dev/zram0 > umount /dev/zram1 > =20 > -9) Reset: > +10) Reset: > Write any positive value to 'reset' sysfs node > echo 1 > /sys/block/zram0/reset > echo 1 > /sys/block/zram1/reset > diff -puN drivers/block/zram/zram_drv.c~zram-add-dynamic-device-add-remov= e-functionality drivers/block/zram/zram_drv.c > --- a/drivers/block/zram/zram_drv.c~zram-add-dynamic-device-add-remove-fu= nctionality > +++ a/drivers/block/zram/zram_drv.c > @@ -29,10 +29,14 @@ > #include > #include > #include > +#include > =20 > #include "zram_drv.h" > =20 > static DEFINE_IDR(zram_index_idr); > +/* idr index must be protected */ > +static DEFINE_MUTEX(zram_index_mutex); > + > static int zram_major; > static const char *default_compressor =3D "lzo"; > =20 > @@ -1271,24 +1275,104 @@ out_free_dev: > return ret; > } > =20 > -static void zram_remove(struct zram *zram) > +static int zram_remove(struct zram *zram) > { > - pr_info("Removed device: %s\n", zram->disk->disk_name); > + struct block_device *bdev; > + > + bdev =3D bdget_disk(zram->disk, 0); > + if (!bdev) > + return -ENOMEM; > + > + mutex_lock(&bdev->bd_mutex); > + if (bdev->bd_openers || zram->claim) { > + mutex_unlock(&bdev->bd_mutex); > + bdput(bdev); > + return -EBUSY; > + } > + > + zram->claim =3D true; > + mutex_unlock(&bdev->bd_mutex); > + > /* > * Remove sysfs first, so no one will perform a disksize > - * store while we destroy the devices > + * store while we destroy the devices. This also helps during > + * zram_remove() -- zram_reset_device() is the last holder of > + * ->init_lock, no later/concurrent disksize_store() or any > + * other sysfs handlers are possible. > */ > sysfs_remove_group(&disk_to_dev(zram->disk)->kobj, > &zram_disk_attr_group); > =20 > + /* Make sure all the pending I/O are finished */ > + fsync_bdev(bdev); > zram_reset_device(zram); > + bdput(bdev); > + > + pr_info("Removed device: %s\n", zram->disk->disk_name); > + > idr_remove(&zram_index_idr, zram->disk->first_minor); > blk_cleanup_queue(zram->disk->queue); > del_gendisk(zram->disk); > put_disk(zram->disk); > kfree(zram); > + return 0; > +} > + > +/* zram module control sysfs attributes */ > +static ssize_t zram_add_show(struct class *class, > + struct class_attribute *attr, > + char *buf) > +{ > + int ret; > + > + mutex_lock(&zram_index_mutex); > + ret =3D zram_add(); > + mutex_unlock(&zram_index_mutex); > + > + if (ret < 0) > + return ret; > + return scnprintf(buf, PAGE_SIZE, "%d\n", ret); > +} > + > +static ssize_t zram_remove_store(struct class *class, > + struct class_attribute *attr, > + const char *buf, > + size_t count) > +{ > + struct zram *zram; > + int ret, dev_id; > + > + /* dev_id is gendisk->first_minor, which is `int' */ > + ret =3D kstrtoint(buf, 10, &dev_id); > + if (ret) > + return ret; > + if (dev_id < 0) > + return -EINVAL; > + > + mutex_lock(&zram_index_mutex); > + > + zram =3D idr_find(&zram_index_idr, dev_id); > + if (zram) > + ret =3D zram_remove(zram); > + else > + ret =3D -ENODEV; > + > + mutex_unlock(&zram_index_mutex); > + return ret ? ret : count; > } > =20 > +static struct class_attribute zram_control_class_attrs[] =3D { > + __ATTR_RO(zram_add), > + __ATTR_WO(zram_remove), > + __ATTR_NULL, > +}; > + > +static struct class zram_control_class =3D { > + .name =3D "zram-control", > + .owner =3D THIS_MODULE, > + .class_attrs =3D zram_control_class_attrs, > +}; > + > static int zram_remove_cb(int id, void *ptr, void *data) > { > zram_remove(ptr); > @@ -1297,6 +1381,7 @@ static int zram_remove_cb(int id, void * > =20 > static void destroy_devices(void) > { > + class_unregister(&zram_control_class); > idr_for_each(&zram_index_idr, &zram_remove_cb, NULL); > idr_destroy(&zram_index_idr); > unregister_blkdev(zram_major, "zram"); > @@ -1306,14 +1391,23 @@ static int __init zram_init(void) > { > int ret; > =20 > + ret =3D class_register(&zram_control_class); > + if (ret) { > + pr_warn("Unable to register zram-control class\n"); > + return ret; > + } > + > zram_major =3D register_blkdev(0, "zram"); > if (zram_major <=3D 0) { > pr_warn("Unable to get major number\n"); > + class_unregister(&zram_control_class); > return -EBUSY; > } > =20 > while (num_devices !=3D 0) { > + mutex_lock(&zram_index_mutex); > ret =3D zram_add(); > + mutex_unlock(&zram_index_mutex); > if (ret < 0) > goto out_error; > num_devices--; > _ >=20 > Patches currently in -mm which might be from sergey.senozhatsky@gmail.com= are >=20 > revert-zram-move-compact_store-to-sysfs-functions-area.patch > zram-add-compact-sysfs-entry-to-documentation.patch > zram-cosmetic-zram_attr_ro-code-formatting-tweak.patch > zram-use-idr-instead-of-zram_devices-array.patch > zram-reorganize-code-layout.patch > zram-remove-max_num_devices-limitation.patch > zram-report-every-added-and-removed-device.patch > zram-trivial-correct-flag-operations-comment.patch > zram-return-zram-device_id-from-zram_add.patch > zram-close-race-by-open-overriding.patch > zram-add-dynamic-device-add-remove-functionality.patch >=20 --=20 Kind regards, Minchan Kim --WYTEVAkct0FjGQmd Content-Type: application/x-sh Content-Disposition: attachment; filename="dynamic_remove.sh" Content-Transfer-Encoding: quoted-printable #!/bin/bash=0A=0Aloop=3D1000=0Azram_control=3D"/sys/class/zram-control/"=0A= zram_size=3D$((20<<20))=0Azram_devs=3D0=0Amax_dev=3D25=0A=0Acreate_zram() {= =0A local max_dev=3D$1=0A for (( i=3D0; i < $max_dev; i++))=0A do=0A zram_= id=3D`cat $zram_control/zram_add`=0A if [ $? -lt 0 ]=0A then=0A echo "f= ailed to create zram" $?=0A exit 1=0A fi=0A=0A=0A echo "new zram_id " $= zram_id=0A echo $zram_size > /sys/block/zram$zram_id/disksize=0A zram_dev= s[$i]=3D$zram_id=0A done=0A}=0A=0Adestroy_zram() {=0A local max_dev=3D$1=0A= local loop_exit=3D0=0A while [ $loop_exit -ne 1 ]=0A do=0A loop_exit=3D1= =0A for (( i=3D0; i<$max_dev; i++ ))=0A do=0A local zram_id=3D${zram_de= vs[$i]}=0A if [ $zram_id -eq -1 ]=0A then=0A continue=0A fi=0A=0A = echo "zram_id " $zram_id=0A echo $zram_id > "$zram_control/zram_remove"= =0A if [ $? -eq 0 ]=0A then=0A echo "removed zram_id " $zram_id=0A = zram_devs[$i]=3D-1=0A fi=0A done=0A=0A for (( i=3D0; i<$max_dev; i++ = ))=0A do=0A if [ ${zram_devs[$i]} -ne -1 ]=0A then=0A # there is so= me zram_dev returned EBUSY so retry=0A printf "zram[%d] is busy\n" "${zr= am_devs[$i]}"=0A loop_exit=3D0=0A fi=0A done=0A done=0A}=0A=0Ado_work= () {=0A local max_dev=3D$1=0A =0A for (( i=3D0; i<$max_dev; i++ ))=0A do=0A= zram_id=3D${zram_devs[$i]}=0A if [ $zram_id -ne -1 ]=0A then=0A dd if= =3D/dev/zero of=3D/dev/zram$zram_id bs=3D10M count=3D1 &=0A fi=0A done=0A}= =0A=0Ai=3D0=0Awhile [ $i -lt $loop ]=0Ado=0A printf "=3D=3D=3D=3D=3D=3D ite= ration %d\n" $loop=0A create_zram $max_dev=0A do_work $max_dev=0A destroy_z= ram $max_dev=0A i=3D$((i + 1))=0Adone=0A --WYTEVAkct0FjGQmd-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/