From: Josef Bacik <jbacik@fb.com>
To: Jan Kara <jack@suse.cz>
Cc: <linux-fsdevel@vger.kernel.org>, <david@fromorbit.com>,
<viro@zeniv.linux.org.uk>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 8/8] inode: don't softlockup when evicting inodes
Date: Tue, 7 Apr 2015 11:03:46 -0400 [thread overview]
Message-ID: <5523F1D2.4080000@fb.com> (raw)
In-Reply-To: <20150401080527.GC26339@quack.suse.cz>
On 04/01/2015 04:05 AM, Jan Kara wrote:
> Sorry for a late reply. I was ill last week...
>
That's ok, I was on vacation for the last two weeks ;).
> On Fri 20-03-15 13:14:16, Josef Bacik wrote:
>> On a box with a lot of ram (148gb) I can make the box softlockup after running
>> an fs_mark job that creates hundreds of millions of empty files. This is
>> because we never generate enough memory pressure to keep the number of inodes on
>> our unused list low, so when we go to unmount we have to evict ~100 million
>> inodes. This makes one processor a very unhappy person, so add a cond_resched()
>> in dispose_list() and cond_resched_lock() in the eviction isolation function to
>> combat this. Thanks,
>>
>> Signed-off-by: Josef Bacik <jbacik@fb.com>
>> ---
>> fs/inode.c | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/fs/inode.c b/fs/inode.c
>> index b961e5a..c58dbd3 100644
>> --- a/fs/inode.c
>> +++ b/fs/inode.c
>> @@ -574,6 +574,7 @@ static void dispose_list(struct list_head *head)
>> list_del_init(&inode->i_lru);
>>
>> evict(inode);
>> + cond_resched();
> Fine.
>
>> }
>> }
>>
>> @@ -592,6 +593,7 @@ void evict_inodes(struct super_block *sb)
>> LIST_HEAD(dispose);
>>
>> spin_lock(&sb->s_inode_list_lock);
>> +again:
>> list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
>> if (atomic_read(&inode->i_count))
>> continue;
>> @@ -606,6 +608,14 @@ void evict_inodes(struct super_block *sb)
>> inode_lru_list_del(inode);
>> spin_unlock(&inode->i_lock);
>> list_add(&inode->i_lru, &dispose);
>> +
>> + /*
>> + * We can have a ton of inodes to evict at unmount time given
>> + * enough memory, check to see if we need to go to sleep for a
>> + * bit so we don't livelock.
>> + */
>> + if (cond_resched_lock(&sb->s_inode_list_lock))
>> + goto again;
> Not so fine. How this is ever guaranteed to finish? We don't move inodes
> from the i_sb_list in this loop so if we ever take 'goto again' we just
> start doing all the work from the beginning...
>
> What needs to happen is that if we need to resched, we drop
> sb->s_inode_list_lock, call dispose_list(&dispose) and *then* restart from
> the beginning since we have freed all the inodes that we isolated...
>
Ooops, good point. I'll get this fixed up, thanks,
Josef
prev parent reply other threads:[~2015-04-07 15:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-20 17:14 [PATCH 0/8] Sync and VFS scalability improvements V2 Josef Bacik
2015-03-20 17:14 ` [PATCH 1/8] writeback: plug writeback at a high level Josef Bacik
2015-03-20 17:14 ` [PATCH 2/8] inode: add hlist_fake to avoid the inode hash lock in evict Josef Bacik
2015-03-20 17:14 ` [PATCH 3/8] inode: convert inode_sb_list_lock to per-sb Josef Bacik
2015-03-20 17:14 ` [PATCH 4/8] sync: serialise per-superblock sync operations Josef Bacik
2015-03-20 17:14 ` [PATCH 5/8] inode: rename i_wb_list to i_io_list Josef Bacik
2015-03-20 17:14 ` [PATCH 6/8] bdi: add a new writeback list for sync Josef Bacik
2015-03-20 17:14 ` [PATCH 7/8] writeback: periodically trim the writeback list Josef Bacik
2015-03-20 18:49 ` [PATCH 7/8] bdi: add a new writeback list for sync V3 Josef Bacik
2015-04-01 8:44 ` Jan Kara
2015-04-01 8:46 ` Jan Kara
2015-03-20 17:14 ` [PATCH 8/8] inode: don't softlockup when evicting inodes Josef Bacik
2015-04-01 8:05 ` Jan Kara
2015-04-07 15:03 ` Josef Bacik [this message]
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=5523F1D2.4080000@fb.com \
--to=jbacik@fb.com \
--cc=david@fromorbit.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox