diff mbox

[9/9] inode: don't softlockup when evicting inodes

Message ID 1426016724-23912-10-git-send-email-jbacik@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Josef Bacik March 10, 2015, 7:45 p.m. UTC
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 | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Jan Kara March 16, 2015, 12:31 p.m. UTC | #1
On Tue 10-03-15 15:45:24, 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>
  The patch looks good. I even have a vague memory that we did something
like this in out SLES kernels but I'm not sure where the patch got lost.
Anyway it should be possible to rebase this so that it doesn't need the
list_lru conversion...

								Honza
> ---
>  fs/inode.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/fs/inode.c b/fs/inode.c
> index 17da8801..2191a3ce 100644
> --- a/fs/inode.c
> +++ b/fs/inode.c
> @@ -569,6 +569,7 @@ static void dispose_list(struct list_head *head)
>  		list_del_init(&inode->i_lru);
>  
>  		evict(inode);
> +		cond_resched();
>  	}
>  }
>  
> @@ -599,6 +600,13 @@ __evict_inodes_isolate(struct list_head *item, struct list_lru_one *lru,
>  
>  	list_lru_isolate(lru, item);
>  	spin_unlock(&inode->i_lock);
> +
> +	/*
> +	 * We can have a ton of inodes to evict at unmount time, check to see if
> +	 * we need to go to sleep for a bit so we don't livelock.
> +	 */
> +	if (cond_resched_lock(lock))
> +		return LRU_REMOVED_RETRY;
>  	return LRU_REMOVED;
>  }
> -- 
> 1.9.3
>
diff mbox

Patch

diff --git a/fs/inode.c b/fs/inode.c
index 17da8801..2191a3ce 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -569,6 +569,7 @@  static void dispose_list(struct list_head *head)
 		list_del_init(&inode->i_lru);
 
 		evict(inode);
+		cond_resched();
 	}
 }
 
@@ -599,6 +600,13 @@  __evict_inodes_isolate(struct list_head *item, struct list_lru_one *lru,
 
 	list_lru_isolate(lru, item);
 	spin_unlock(&inode->i_lock);
+
+	/*
+	 * We can have a ton of inodes to evict at unmount time, check to see if
+	 * we need to go to sleep for a bit so we don't livelock.
+	 */
+	if (cond_resched_lock(lock))
+		return LRU_REMOVED_RETRY;
 	return LRU_REMOVED;
 }