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 7E875409E12 for ; Fri, 21 Aug 2026 19:26:53 +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=1787340414; cv=none; b=YppCxay1vb6z8oFLTYfEJRiwcxEysXU4iBrBGIJhXL10R0O2RmyKh+P42bXbFTveouaifdaPGdis1HajPRvWGoXp2Oz9sCiSfP+hLTIxHrnKFcwsThHMDiiA5p4PUVu8LNrGUY2i8vK5ijb0yJtD1e22OteckxMok6JqXPrf6SM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787340414; c=relaxed/simple; bh=ZmAonhA48maLYRhwuDHuIV9qft9BSevY8h1eNTYeXXg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RN1GD0TgtngBbQvjlMVdXsZu4OlsmMk562CkaJz5DV0ZdeMimHiM6nqNeTx5N/eUAINVP906ffguCY5Mp/z1KWpEIGZSoDch35KzfU0w59ZBZzbj7typi7iMQjCOgFns2KutX7Btv4/Dsz59PFdopPg7ebRZkHqQgMEj0DZx4WU= 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=LybhbZbV; 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="LybhbZbV" 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=pk599fpJe4g3OOOhG/1qwXP3ndv15oabFg8bnXYjU1g=; b=LybhbZbVSG4/L63q4HPXuHeFdO B2SOynWj41QtQnJ4vx923V8FDq4p/VL9FoQzwUxQ+5RmWL+yhKCqMvg6J8iH19dfN4gR/nYTqbQa5 iKw3xmRtu1KjgVaXQCVBrOdg/SJIP1R+FnAUPy8MF6it6Sxff6uRAigRUIEP882ZsMTqAX1v01dpP nKhKqqvyqtlayWJ5g7WdAUUgmvU7dlbRQa9tY8HsCo1fIcVLpc03XtLUNrhUe5aH7sALsxeQhgDES oZHLgiiMyZGbd7JuzSNFSVM92m9Ci5y+a3gzjpABq1famvZsD8uZe71AGbp53Yu1sswBBoVmKlSQO ITfAz3kg==; Received: from [38.23.173.23] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1wxUt9-0000000E0jm-0fLj; Fri, 21 Aug 2026 19:26:51 +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 v3 07/19] maple_tree: Clarify comments on mas_nomem() Date: Fri, 21 Aug 2026 15:26:15 -0400 Message-ID: <20260821192627.4085470-8-liam@infradead.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260821192627.4085470-1-liam@infradead.org> References: <20260821192627.4085470-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 3509e293c84f9..baaaa128594c2 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5677,10 +5677,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) @@ -5696,6 +5697,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