From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932145AbbCJTsd (ORCPT ); Tue, 10 Mar 2015 15:48:33 -0400 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:58992 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932091AbbCJTsY (ORCPT ); Tue, 10 Mar 2015 15:48:24 -0400 From: Josef Bacik To: , , , , Subject: [PATCH 9/9] inode: don't softlockup when evicting inodes Date: Tue, 10 Mar 2015 15:45:24 -0400 Message-ID: <1426016724-23912-10-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1426016724-23912-1-git-send-email-jbacik@fb.com> References: <1426016724-23912-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.54.13] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-03-10_07:2015-03-10,2015-03-10,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=0 compositescore=0.925924926977281 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 rbsscore=0.925924926977281 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=0 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.925924926977281 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1503100201 X-FB-Internal: deliver Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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