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 X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0756C11F67 for ; Tue, 29 Jun 2021 15:33:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 67E5D613FA for ; Tue, 29 Jun 2021 15:33:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67E5D613FA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 663AF8D0152; Tue, 29 Jun 2021 11:33:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 614F98D00F0; Tue, 29 Jun 2021 11:33:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DB768D0152; Tue, 29 Jun 2021 11:33:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0232.hostedemail.com [216.40.44.232]) by kanga.kvack.org (Postfix) with ESMTP id 26CF58D00F0 for ; Tue, 29 Jun 2021 11:33:54 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 0D03E8249980 for ; Tue, 29 Jun 2021 15:33:54 +0000 (UTC) X-FDA: 78307156788.38.CFE2A0F Received: from outbound-smtp56.blacknight.com (outbound-smtp56.blacknight.com [46.22.136.240]) by imf18.hostedemail.com (Postfix) with ESMTP id 2F4B640022BE for ; Tue, 29 Jun 2021 15:33:53 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp56.blacknight.com (Postfix) with ESMTPS id 5CFBDFAD10 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) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf18.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.240 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Rspamd-Server: rspam02 X-Stat-Signature: hozbfnotn4shn7br87t4a7acedkf4b4q X-Rspamd-Queue-Id: 2F4B640022BE X-HE-Tag: 1624980833-387336 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 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