From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 132B4C433EF for ; Fri, 27 May 2022 16:10:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 62C138D0002; Fri, 27 May 2022 12:10:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5DBE48D0001; Fri, 27 May 2022 12:10:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4C92A8D0002; Fri, 27 May 2022 12:10:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 3FCBE8D0001 for ; Fri, 27 May 2022 12:10:50 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 1CF1D60C71 for ; Fri, 27 May 2022 16:10:50 +0000 (UTC) X-FDA: 79512011460.05.55C7C0E Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf27.hostedemail.com (Postfix) with ESMTP id CCD2A4004A for ; Fri, 27 May 2022 16:10:45 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5B99FB82173; Fri, 27 May 2022 16:10:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25BE4C385B8; Fri, 27 May 2022 16:10:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653667846; bh=itJVIn2kS9CTYYtN7F5XJg9N57RQi68GqnXIyBbsDbA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=joYS+nl4UxW45XHGqcuafMlcSrRrjugnBPqgF3oBzTltLYf6wHBeAkim+u/T4/cPR W/qqKoC6iLaQHzv+o9CcPfJ503d5zdPR/rKQvMbLaf4ZlTAapRUohLV6eRTtSrrGCs gZ82TjggIc4JwT/TUmp7C99vDIpSuaihpeqHFPzmeLtt7InLkZZh42ZPgcQxianCz9 D7JdlFSX+RDGT2b7ySgpalSsy0YtLlgOmTA/tTBna/S5VZxdxKDhtuVfVVpjaKikLR hDHMPHCg61mRSEfWeF5L4hrkA3h+f3TepE8nKnCqQotBzsMmUZ4JXXp/ZtG1tMlFcw sww9DCcnADGvw== Date: Fri, 27 May 2022 09:10:45 -0700 From: "Darrick J. Wong" To: Mel Gorman Cc: Andrew Morton , Dave Chinner , Jan Kara , Vlastimil Babka , Jesper Dangaard Brouer , Chuck Lever , Linux-NFS , Linux-MM , Linux-XFS , LKML Subject: Re: [PATCH] mm/page_alloc: Always attempt to allocate at least one page during bulk allocation Message-ID: References: <20220526091210.GC3441@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220526091210.GC3441@techsingularity.net> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: CCD2A4004A X-Stat-Signature: 5cj8wac6znwjpiytcyei6cdi8cr1m3qc X-Rspam-User: Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=joYS+nl4; spf=pass (imf27.hostedemail.com: domain of djwong@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=djwong@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-HE-Tag: 1653667845-958355 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, May 26, 2022 at 10:12:10AM +0100, Mel Gorman wrote: > Peter Pavlisko reported the following problem on kernel bugzilla 216007. > > When I try to extract an uncompressed tar archive (2.6 milion > files, 760.3 GiB in size) on newly created (empty) XFS file system, > after first low tens of gigabytes extracted the process hangs in > iowait indefinitely. One CPU core is 100% occupied with iowait, > the other CPU core is idle (on 2-core Intel Celeron G1610T). > > It was bisected to c9fa563072e1 ("xfs: use alloc_pages_bulk_array() for > buffers") but XFS is only the messenger. The problem is that nothing > is waking kswapd to reclaim some pages at a time the PCP lists cannot > be refilled until some reclaim happens. The bulk allocator checks that > there are some pages in the array and the original intent was that a bulk > allocator did not necessarily need all the requested pages and it was > best to return as quickly as possible. This was fine for the first user > of the API but both NFS and XFS require the requested number of pages > be available before making progress. Both could be adjusted to call the > page allocator directly if a bulk allocation fails but it puts a burden on > users of the API. Adjust the semantics to attempt at least one allocation > via __alloc_pages() before returning so kswapd is woken if necessary. > > It was reported via bugzilla that the patch addressed the problem and > that the tar extraction completed successfully. This may also address > bug 215975 but has yet to be confirmed. > > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=216007 > BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215975 > Fixes: 387ba26fb1cb ("mm/page_alloc: add a bulk page allocator") > Signed-off-by: Mel Gorman > Cc: # v5.13+ Seems to have survived overnight fstests on XFS, so... Reviewed-by: Darrick J. Wong --D > --- > mm/page_alloc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 0e42038382c1..5ced6cb260ed 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -5324,8 +5324,8 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, > page = __rmqueue_pcplist(zone, 0, ac.migratetype, alloc_flags, > pcp, pcp_list); > if (unlikely(!page)) { > - /* Try and get at least one page */ > - if (!nr_populated) > + /* Try and allocate at least one page */ > + if (!nr_account) > goto failed_irq; > break; > }