From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 73CE647A0B6 for ; Tue, 30 Jun 2026 19:08:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782846540; cv=none; b=WFq44mxWpAoP6OZhhTUDpo0NVmJbl0ZQu6OBQMmqq2vEyS98zhDc62Pz6QFdacgK8fYShBXBDgj7sZSjmQeFTUH4fp8DCC5Ta+/25xf98sYygUkuvQWcbqcfjjdyn/VvM6zjHc+JFhbcWSFEdNQRWkOpoCIF9iPwJR0tMmlXGUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782846540; c=relaxed/simple; bh=O1wppFCdfu1lm9755SKj5QoPCTj94iqCmSHmo5VrL8I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VuW2cCHYYF8lDMW6HaClS/kgt+tsy2tl/J+YZtiJGX47bC0tcMaYJOWgZjvQ9ZwgLgy0Xf5XST5kzUqPLGCj5XI8i1sDF72pcxln/JUtsGC6FKte7CNKiKnYjyiXERyzNCehnqfy7GQ3dMzyIqZg9Voyz0fI8lH0k7Qxbc/b9hc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=pass smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=Z2x+VgVu; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="Z2x+VgVu" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=Q+gaCNHAQ/zwxessi7PExTqAzXXTvnSqt6SMtkrDO5w=; b=Z2x+VgVuIPZvb5yx1paacQgFau gvViUCsS03jpTeGVhn412PKdCqxRp6EX+huFqr/ejMxX1b1mn9Kh8V9m1GyJ0eBc93od9sdsnoNYQ NkB2JWwq9Xq0Lwk8J5le3q4tsdwg6PAJF+IG6XUlDPoPZ0NR0tO7hkE4B0cQ805QSFGff/PRHaSHh A//4p/OvhaAHctNFSdGIgRdnFP7BNtVvXLG7e/dJnHO/mcW+y7EW0bLvn+qaP0Y7jDRLzo0glD9Tj YRy/DiPeaE8Z3PRF0Wc5b2rqn0tTDXNyoHt2Yd8LJ2lwBooMdObeM5fh53tdpL9DKMMM4Zm1MkRX7 wG1mcZGQ==; Received: from [38.23.173.23] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1wedpK-000000005sp-3ENG; Tue, 30 Jun 2026 19:08:58 +0000 From: "Liam R. Howlett (Oracle)" To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org, "Liam R. Howlett (Oracle)" Subject: [PATCH v2 07/19] maple_tree: Clarify comments on mas_nomem() Date: Tue, 30 Jun 2026 15:08:31 -0400 Message-ID: <20260630190843.3563858-8-liam@infradead.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260630190843.3563858-1-liam@infradead.org> References: <20260630190843.3563858-1-liam@infradead.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When an allocation completely fails, the return is false. If the allocation succeeds or partially succeeds, return true to indicate a retry of the operation. Note that since the lock may have been dropped, the operation is retried from the start - including potentially allocating more memory. Signed-off-by: Liam R. Howlett (Oracle) --- lib/maple_tree.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 97849db132e7a..3886b856d6e3a 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5676,10 +5676,11 @@ EXPORT_SYMBOL_GPL(mas_erase); /** * mas_nomem() - Check if there was an error allocating and do the allocation - * if necessary If there are allocations, then free them. + * if necessary. + * * @mas: The maple state * @gfp: The GFP_FLAGS to use for allocations - * Return: true on allocation, false otherwise. + * Return: False on no memory. True otherwise (partial success as well) */ bool mas_nomem(struct ma_state *mas, gfp_t gfp) __must_hold(mas->tree->ma_lock) @@ -5695,6 +5696,10 @@ bool mas_nomem(struct ma_state *mas, gfp_t gfp) mas_alloc_nodes(mas, gfp); } + /* + * Return false on zero forward progress. Partial allocations are kept + * so the retry path will attempt to get the rest. + */ if (!mas->sheaf && !mas->alloc) return false; -- 2.47.3