From: Jan Kara <jack@suse.cz>
To: Josef Bacik <jbacik@fb.com>
Cc: linux-fsdevel@vger.kernel.org, kernel-team@fb.com,
viro@ZenIV.linux.org.uk, hch@infradead.org, jack@suse.cz,
david@fromorbit.com
Subject: Re: [PATCH 8/8] inode: don't softlockup when evicting inodes
Date: Mon, 15 Jun 2015 16:16:28 +0200 [thread overview]
Message-ID: <20150615141628.GI4368@quack.suse.cz> (raw)
In-Reply-To: <1434051673-13838-9-git-send-email-jbacik@fb.com>
On Thu 11-06-15 15:41:13, 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 if we need a resched when processing the s_inodes list do
> that and run dispose_list() on what we've currently culled. Thanks,
>
> Signed-off-by: Josef Bacik <jbacik@fb.com>
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/inode.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/fs/inode.c b/fs/inode.c
> index d1e6598..53a1224 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();
> }
> }
>
> @@ -591,6 +592,7 @@ void evict_inodes(struct super_block *sb)
> struct inode *inode, *next;
> LIST_HEAD(dispose);
>
> +again:
> spin_lock(&sb->s_inode_list_lock);
> list_for_each_entry_safe(inode, next, &sb->s_inodes, i_sb_list) {
> if (atomic_read(&inode->i_count))
> @@ -606,6 +608,18 @@ 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 (need_resched()) {
> + spin_unlock(&sb->s_inode_list_lock);
> + cond_resched();
> + dispose_list(&dispose);
> + goto again;
> + }
> }
> spin_unlock(&sb->s_inode_list_lock);
>
> --
> 2.1.0
>
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2015-06-15 14:16 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-11 19:41 [PATCH 0/7] super block scalabilit patches V3 Josef Bacik
2015-06-11 19:41 ` [PATCH 1/8] writeback: plug writeback at a high level Josef Bacik
2015-06-17 12:03 ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 2/8] inode: add hlist_fake to avoid the inode hash lock in evict Josef Bacik
2015-06-17 12:03 ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 3/8] inode: convert inode_sb_list_lock to per-sb Josef Bacik
2015-06-17 12:06 ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 4/8] sync: serialise per-superblock sync operations Josef Bacik
2015-06-17 12:06 ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 5/8] inode: rename i_wb_list to i_io_list Josef Bacik
2015-06-17 12:06 ` Christoph Hellwig
2015-06-11 19:41 ` [PATCH 6/8] bdi: add a new writeback list for sync Josef Bacik
2015-06-15 14:12 ` Jan Kara
2015-06-16 15:42 ` Josef Bacik
2015-06-17 10:34 ` Jan Kara
2015-06-17 17:55 ` Josef Bacik
2015-06-18 9:28 ` Jan Kara
2015-06-18 22:18 ` [PATCH 6/8 V4] " Josef Bacik
2015-06-19 8:38 ` Jan Kara
2015-06-11 19:41 ` [PATCH 7/8] writeback: periodically trim the writeback list Josef Bacik
2015-06-11 19:41 ` [PATCH 8/8] inode: don't softlockup when evicting inodes Josef Bacik
2015-06-15 14:16 ` Jan Kara [this message]
2015-06-11 20:50 ` [PATCH 0/7] super block scalabilit patches V3 Tejun Heo
2015-06-15 21:34 ` Dave Chinner
2015-06-22 2:26 ` [PATCH] sync: wait_sb_inodes() calls iput() with spinlock held (was Re: [PATCH 0/7] super block scalabilit patches V3) Dave Chinner
2015-06-22 16:21 ` Josef Bacik
2015-06-23 23:14 ` Josef Bacik
2015-06-24 0:35 ` Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2015-06-24 3:23 [PATCH 0/8] super block scalability patches V4 Josef Bacik
2015-06-24 3:24 ` [PATCH 8/8] inode: don't softlockup when evicting inodes Josef Bacik
2015-03-20 17:14 [PATCH 0/8] Sync and VFS scalability improvements V2 Josef Bacik
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
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=20150615141628.GI4368@quack.suse.cz \
--to=jack@suse.cz \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=jbacik@fb.com \
--cc=kernel-team@fb.com \
--cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).