From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from twin.jikos.cz ([89.185.236.188]:46086 "EHLO twin.jikos.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753421Ab2JJQxj (ORCPT ); Wed, 10 Oct 2012 12:53:39 -0400 Date: Wed, 10 Oct 2012 18:53:18 +0200 From: David Sterba To: zwu.kernel@gmail.com Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, linuxram@linux.vnet.ibm.com, viro@zeniv.linux.org.uk, david@fromorbit.com, dave@jikos.cz, tytso@mit.edu, cmm@us.ibm.com, Zhi Yong Wu Subject: Re: [RFC v3 12/13] vfs: add debugfs support Message-ID: <20121010165318.GA4405@twin.jikos.cz> Reply-To: dave@jikos.cz References: <1349863655-29320-1-git-send-email-zwu.kernel@gmail.com> <1349863655-29320-13-git-send-email-zwu.kernel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <1349863655-29320-13-git-send-email-zwu.kernel@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org List-ID: On Wed, Oct 10, 2012 at 06:07:34PM +0800, zwu.kernel@gmail.com wrote: > +static int hot_debugfs_log_init(struct debugfs_vol_data *data) > +{ > + int err = 0; > + struct lstring *debugfs_log = data->debugfs_log; > + > + spin_lock(&data->log_lock); > + debugfs_log->str = vmalloc(INIT_LOG_ALLOC_SIZE); vmalloc __might_sleep(), do the allocation outside of the lock and assign the value inside. Also, you may use vzalloc and drop the following memset. dmesg: vfs: turning on hot data tracking BUG: sleeping function called from invalid context at mm/slab.c:3220 in_atomic(): 1, irqs_disabled(): 0, pid: 3103, name: mc 1 lock held by mc/3103: #0: (&(&inode_data->log_lock)->rlock){+.+.+.}, at: [] __hot_debugfs_comm_read+0x216/0x280 Pid: 3103, comm: mc Tainted: G W 3.6.0hottrack-default+ #208 Call Trace: [] __might_sleep+0xfc/0x130 [] kmem_cache_alloc_trace+0xe1/0x270 [] __get_vm_area_node+0x95/0x1a0 [] ? local_clock+0x6f/0x80 [] ? __hot_debugfs_comm_read+0x220/0x280 [] __vmalloc_node_range+0x6d/0x200 [] ? __hot_debugfs_comm_read+0x220/0x280 [] ? hot_debugfs_log+0xe0/0xe0 [] __vmalloc_node+0x35/0x40 [] ? __hot_debugfs_comm_read+0x220/0x280 [] vmalloc+0x2c/0x30 [] __hot_debugfs_comm_read+0x220/0x280 [] ? __do_page_fault+0x238/0x590 [] ? trace_hardirqs_on_caller+0x155/0x1d0 [] ? trace_hardirqs_on_thunk+0x3a/0x3f [] __hot_debugfs_inode_read+0x15/0x20 [] vfs_read+0xcb/0x190 [] sys_read+0x62/0xb0 [] ? trace_hardirqs_on_thunk+0x3a/0x3f [] system_call_fastpath+0x16/0x1b > + if (debugfs_log->str) { > + memset(debugfs_log->str, 0, INIT_LOG_ALLOC_SIZE); > + data->log_alloc_size = INIT_LOG_ALLOC_SIZE; > + } else { > + err = -ENOMEM; > + } > + spin_unlock(&data->log_lock); > + > + return err; > +} I'm now playing with it, and haven't gone through the code yet, david