Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751030AbeABUaP (ORCPT + 1 other); Tue, 2 Jan 2018 15:30:15 -0500 Received: from mout.gmx.net ([212.227.17.22]:51116 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750865AbeABUaN (ORCPT ); Tue, 2 Jan 2018 15:30:13 -0500 Message-ID: <1514924997.6612.6.camel@gmx.de> Subject: [patch] fs/nfs: Add a resched point to nfs_commit_release_pages() From: Mike Galbraith To: Trond Myklebust , "bfields@fieldses.org" Cc: "linux-kernel@vger.kernel.org" , "linux-nfs@vger.kernel.org" , "jlayton@kernel.org" Date: Tue, 02 Jan 2018 21:29:57 +0100 In-Reply-To: <1513617866.4581.6.camel@primarydata.com> References: <1513610231.7998.13.camel@gmx.de> <1513611112.7113.1.camel@gmx.de> <20171218163559.GA11829@fieldses.org> <1513616405.7113.18.camel@gmx.de> <1513617866.4581.6.camel@primarydata.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.20.5 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:hjosppOzAoTAdCjuTP8xJR1O5EqjrAyQ/l61Qb62D6/a6m74xXT HZLiSQDKL5dxK23rrkMp9GHirXHhCftrbL+CxdjpFkAzvcFnLUWMWEFDXVMWHMrJwJngKxc n829fL2LwnYR903sfFY+K+tAiZy8cG9HJ53Fn0eJHNzkCibszYwWmWhYX85qNpaD3J1x2Dp tnBbbcxZq9+N2XBuXcMQg== X-UI-Out-Filterresults: notjunk:1;V01:K0:DBmmZyRAui8=:7r/0A4QC6J6YnwB7njj9zd +F21/zQ8YVOBgCibz3WylYzOTtyOfkl3Z+7oZwjP9fTDZSF82errxPK6b/21awyeGwEw3NHIn 7pwyA3Ti2rA4+cfvf8y4O1nLQIPqEIhHTL9EqKdsDuorQCOKxRusRn1DmRNtcFaUh/8dzSVjB 6JLNi9b0lN/seL27k6b3+drQxhdPyafcNTYDt9znx464AXuB6XMy/SG278+k6ldxsXQhiKrrp sv4Kkwb6d6MKiwEqtnMX7An3cDRT2kYwOIjPbPdHs20yDQe95Dob9JQ+F52zMJnDCAii7/y3t 0VVuI7GH0xlnWqG0tGxbfv/USyCtRR0KxeCDbx8DaxobW320Rv1w8DTGsIcNcnVb8SE/QdTcj aIsFaHyiMZMJCpTAN98jMA3docKlR7OlK+xZAndEsGEMRz8k+DjiE5bNBD9vEheWidTGyMJvv /6sf/iMCNO+E+u5o66aBzRl6OyFVGtGB32D2SvqinXNRTxFy7Tna3ZPfMMU2oJJsKdm21XY82 4UGwBB2z2o4HxtA/bYFNBjjailgypxrGCTRfdNgi2vi+iFveA7RD9zIp3H8pWHU9tA6oT1/V4 0ehJW36sQtByjOKoALHHvmkPzEbaJklTrfXmfLmwgnU3R4N19XHhkR19zlNl5x7q+0v4YRH1h 09YJaFkconUGDQY7xSQDUxNoBlIz5z/crf8EdHljTUEsEI5+bNnKrwZWB11vt4w1wh2oMXtAs GsXHpsQxT8qkDLO0mHWFblNaIZusB7NhKL0nPNhcgL+FkFHQD7iuQDQCRTb1BBPJDN6Il2tw7 TKxNuzL9+zMj61FJIMlbS2+dx0WszVTIK6AegS/t6O7DZtRpoo= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, 2017-12-18 at 17:24 +0000, Trond Myklebust wrote: > On Mon, 2017-12-18 at 18:00 +0100, Mike Galbraith wrote: > > On Mon, 2017-12-18 at 11:35 -0500, J. Bruce Fields wrote: > > > > > > Like I say, I don't really understand the issues here, so it's more > > > a > > > question than an objection.... (I don't know any reason a > > > cond_resched() would be bad there.) > > > > Think of it this way: what all can be queued up behind that kworker > > that is hogging CPU for huge swaths of time? It's not only userspace > > that suffers. > > > > Any cond_sched() belongs in the loop in nfs_commit_release_pages() > (where it can be mitigated) rather than in a function whose purpose is > to free memory. There is no reason to call it from the writeback or > readpages code. Just in case NFS folks are expecting a patchlet, trash otherwise. fs/nfs: Add a resched point to nfs_commit_release_pages() During heavy NFS write, kworkers can do very large amounts of work without scheduling (82ms traced). Add a resched point. Signed-off-by: Mike Galbraith Suggested-by: Trond Myklebust --- fs/nfs/write.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -1837,6 +1837,7 @@ static void nfs_commit_release_pages(str set_bit(NFS_CONTEXT_RESEND_WRITES, &req->wb_context->flags); next: nfs_unlock_and_release_request(req); + cond_resched(); } nfss = NFS_SERVER(data->inode); if (atomic_long_read(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)