Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp4516944pxv; Tue, 29 Jun 2021 08:49:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUJXdCrX3X2nVNxosV8VnKh1kJ/S+8EjnKp1aBdb1+h1A2S4iFeI1Fq1nkmHcYe1oMnM86 X-Received: by 2002:a05:6402:1c8e:: with SMTP id cy14mr42125790edb.271.1624981744352; Tue, 29 Jun 2021 08:49:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624981744; cv=none; d=google.com; s=arc-20160816; b=gT95f/yWHwv03f45WrSclT4184/F3c/lT0f0Gl31nuvEzuU22kRVaffCRC7pBuCWMM 6lmXM4CVxaUIrFofa4AwD1GMolVJh0AAqYFus41mJdZg8eUgLlptF/17KjGl/XY7Ci0B FdYJ+83PHuG+pZr1/Q939Qbf1wbzjM8E+bs6HrbLM6uKRFJ3LCfodx646jJN3+HYHipS TNUJYp5qbAimE7ugZ2PVNfL18O3NWugw1eU9cGNS47sSLQKO6hRU7oHxMosX/leBOECU cBOun86ldb1GPVa7F7ujcf8qk3cnNnBpV4kC4FygSyxc5jsxb0kK3HIFrla4hqJi3SIK StmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4eDMnbkbY0fbPCtaAJ7YK5WLsDuZqq7OGBdKNMjNZSA=; b=ysJVhjuLpbn+87e7buGnbglI1g3SbDUjkKXpkzDjIcDMx+gaUs/8qMvwgfwZEhK4gW VRrFGcwT8hSJRX1mT3hMrDiXjY1me1p0fE1JV3boCZqtBW11v5gqxKpXcWs1oEngePh4 9Q8nzziLsC6mjGONdpdoi2cq9gURZn2yUiLem4J1uvTPotMKhaCrkPzwSdSLUEVScOCB /TlbK17u5P26zB0jabNglE8cpdytrTty3suHE1BcJ6ahSNXwoEDb/wutWHopZL7t1n0s FsGonxC3gy15zDwLN6azN9M9B8ee068qWINS2JFB7GOG07ne/DfTOYxdG/F6JcA22BQ9 nANA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-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 w13si8440723edx.361.2021.06.29.08.48.35; Tue, 29 Jun 2021 08:49:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232288AbhF2Pnp (ORCPT + 99 others); Tue, 29 Jun 2021 11:43:45 -0400 Received: from outbound-smtp29.blacknight.com ([81.17.249.32]:60549 "EHLO outbound-smtp29.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232469AbhF2Pnp (ORCPT ); Tue, 29 Jun 2021 11:43:45 -0400 X-Greylist: delayed 445 seconds by postgrey-1.27 at vger.kernel.org; Tue, 29 Jun 2021 11:43:44 EDT Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp29.blacknight.com (Postfix) with ESMTPS id 58D8C18E06A for ; Tue, 29 Jun 2021 16:33:51 +0100 (IST) Received: (qmail 9884 invoked from network); 29 Jun 2021 15:33:51 -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); 29 Jun 2021 15:33:51 -0000 Date: Tue, 29 Jun 2021 16:33:49 +0100 From: Mel Gorman To: Chuck Lever Cc: linux-nfs@vger.kernel.org, linux-mm@kvack.org, brouer@redhat.com Subject: Re: [PATCH v3] mm/page_alloc: Further fix __alloc_pages_bulk() return value Message-ID: <20210629153349.GG3840@techsingularity.net> References: <162497449506.16614.7781489905877008435.stgit@klimt.1015granger.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <162497449506.16614.7781489905877008435.stgit@klimt.1015granger.net> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Jun 29, 2021 at 09:48:15AM -0400, Chuck Lever wrote: > The author of commit b3b64ebd3822 ("mm/page_alloc: do bulk array > bounds check after checking populated elements") was possibly > confused by the mixture of return values throughout the function. > > The API contract is clear that the function "Returns the number of > pages on the list or array." It does not list zero as a unique > return value with a special meaning. Therefore zero is a plausible > return value only if @nr_pages is zero or less. > > Clean up the return logic to make it clear that the returned value > is always the total number of pages in the array/list, not the > number of pages that were allocated during this call. > > The only change in behavior with this patch is the value returned > if prepare_alloc_pages() fails. To match the API contract, the > number of pages currently in the array/list is returned in this > case. > > The call site in __page_pool_alloc_pages_slow() also seems to be > confused on this matter. It should be attended to by someone who > is familiar with that code. > > Signed-off-by: Chuck Lever Acked-by: Mel Gorman -- Mel Gorman SUSE Labs