Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3608862pxv; Mon, 28 Jun 2021 08:29:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3/rhOqdjhlYJIHGH/hve/4Ff4RllP78sY4qv9nsPspOwAMANabXjwbnw++j7/nM04kS2K X-Received: by 2002:a17:906:ce4f:: with SMTP id se15mr25421908ejb.232.1624894196213; Mon, 28 Jun 2021 08:29:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624894196; cv=none; d=google.com; s=arc-20160816; b=NzQVx8IKVqUYaWAT08Gm8q9fzrj5EUL817L5zCJuJ7y7SPErk9nb5v4OgNyTYaWKOj pM9WEKjH0P6vMIBJyIRCAidB9+EB36833tAjKy4FC7PQj2zaQAJUvlTqYaLuMxcwD17R YvbwdoH49X9qSMJ6L5Wx8DiI/X4U37l2L4/HhihSwhAdhMF50Ef0Towvj5u5M/IBnxC9 S3l//Vcfv9zU02+vYVnEpmyU3RDSz9upPqTGjC4RLwgkzCgwtLHV3B1NlU0q1Z3agZkQ v+u6C1Af+GDULy4mnWdBT0X/q4ophUCIruLiCY8YdXbvUdTy2e2UH7Z+vaC3mY0uKnKU jDZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=Lp048TkGVsw1dpHnYD3dLPp7BYtCmNWo+TEA6DFYFGE=; b=Zv58kJ1/798uhXelmlXLWuiqQJ+TvTkPFDi+KkzuGrXKMNqhvTujkae/BpHofz8KaP pzrJaoE3wLqY5USpr4CGgVn5cRBbpE0XSy9eaxmDMI4VbKbll+AK2GuHGaAKdcqHy8Ms BWT+4e1jWwxcx9n7wesVCZwJx5pkExuRBszdTzvmmakUCbWhOArF81iy77aZCVrcExBC UGnIhAh+AZi5uh6MFsHchwtYLVKY0d9RgtCjjEJPPGFZSG90aD0hxP0y8tfoAFw14jlR Xqpa4PQ+eElkJ1Y0TqwIpUlSe5XvxZjf4mk9x12AHyQ5lqpEuRL41VOuXUCx5okBqyfF pk8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si6397659edz.556.2021.06.28.08.29.29; Mon, 28 Jun 2021 08:29:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238499AbhF1P36 (ORCPT + 99 others); Mon, 28 Jun 2021 11:29:58 -0400 Received: from outbound-smtp19.blacknight.com ([46.22.139.246]:45525 "EHLO outbound-smtp19.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237031AbhF1PEs (ORCPT ); Mon, 28 Jun 2021 11:04:48 -0400 Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp19.blacknight.com (Postfix) with ESMTPS id 40B3D1C354A for ; Mon, 28 Jun 2021 16:02:21 +0100 (IST) Received: (qmail 19484 invoked from network); 28 Jun 2021 15:02:20 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.255]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 28 Jun 2021 15:02:20 -0000 Date: Mon, 28 Jun 2021 16:02:19 +0100 From: Mel Gorman To: Andrew Morton Cc: Dave Jones , Dan Carpenter , Jesper Dangaard Brouer , Vlastimil Babka , Linux-MM , LKML , Linus Torvalds Subject: [PATCH] mm/page_alloc: Correct return value of populated elements if bulk array is populated Message-ID: <20210628150219.GC3840@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dave Jones reported the following This made it into 5.13 final, and completely breaks NFSD for me (Serving tcp v3 mounts). Existing mounts on clients hang, as do new mounts from new clients. Rebooting the server back to rc7 everything recovers. The commit b3b64ebd3822 ("mm/page_alloc: do bulk array bounds check after checking populated elements") returns the wrong value if the array is already populated which is interpreted as an allocation failure. Dave reported this fixes his problem and it also passed a test running dbench over NFS. Fixes: b3b64ebd3822 ("mm/page_alloc: do bulk array bounds check after checking populated elements") Reported-and-tested-by: Dave Jones Signed-off-by: Mel Gorman Cc: [5.13+] --- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index ef2265f86b91..04220581579c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -5058,7 +5058,7 @@ unsigned long __alloc_pages_bulk(gfp_t gfp, int preferred_nid, /* Already populated array? */ if (unlikely(page_array && nr_pages - nr_populated == 0)) - return 0; + return nr_populated; /* Use the single page allocator for one page. */ if (nr_pages - nr_populated == 1)