Return-Path: Received: from mx2.suse.de ([195.135.220.15]:60553 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750878AbeDNHAd (ORCPT ); Sat, 14 Apr 2018 03:00:33 -0400 Subject: Re: [PATCH] fs/dcache.c: re-add cond_resched() in shrink_dcache_parent() To: Andrew Morton , Khazhismel Kumykov Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, David Rientjes , Alexander Viro , Goldwyn Rodrigues , Jeff Mahoney , Davidlohr Bueso , Linus Torvalds References: <20180413181350.88831-1-khazhy@google.com> <20180413202823.204377-1-khazhy@google.com> <20180413141430.2788e2562e3e24bd273fe78b@linux-foundation.org> From: Nikolay Borisov Message-ID: <3362fb2d-85ff-86af-399f-698c986e46cc@suse.com> Date: Sat, 14 Apr 2018 10:00:29 +0300 MIME-Version: 1.0 In-Reply-To: <20180413141430.2788e2562e3e24bd273fe78b@linux-foundation.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 14.04.2018 00:14, Andrew Morton wrote: > On Fri, 13 Apr 2018 13:28:23 -0700 Khazhismel Kumykov wrote: > >> shrink_dcache_parent may spin waiting for a parallel shrink_dentry_list. >> In this case we may have 0 dentries to dispose, so we will never >> schedule out while waiting for the parallel shrink_dentry_list to >> complete. >> >> Tested that this fixes syzbot reports of stalls in shrink_dcache_parent() > > Well I guess the patch is OK as a stopgap, but things seem fairly > messed up in there. shrink_dcache_parent() shouldn't be doing a > busywait, waiting for the concurrent shrink_dentry_list(). > > Either we should be waiting (sleeping) for the concurrent operation to > complete or we should just bail out of shrink_dcache_parent(), perhaps > with > > if (list_empty(&data.dispose)) > break; > > or similar. Dunno. I agree, however, not being a dcache expert I'd refrain from touching it, since it seems to be rather fragile. Perhaps Al could take a look in there? > > > That block comment over `struct select_data' is not a good one. "It > returns zero iff...". *What* returns zero? select_collect()? No it > doesn't, it returns an `enum d_walk_ret'. Perhaps the comment is > trying to refer to select_data.found. And the real interpretation of > select_data.found is, umm, hard to describe. "Counts the number of > dentries which are on a shrink list or which were moved to the dispose > list". Why? What's that all about? > > This code needs a bit of thought, documentation and perhaps a redo, > I suspect. >