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 26E4A42315B for ; Mon, 29 Jun 2026 14:42:43 +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=1782744165; cv=none; b=OjtqqIy7Ihy+IEjWggC2Zzh/8rZ/dL/+PiXFs4fC5xE9CslG8T+/pKK2MFNGPUv3V6K+LQyNiENV/4Rck+gBU+zIGxsiIg0Z05oEQPNO6faxo79F33aDQM2sUPZG3yHoFL6CAMV4HZ1JAtxE7h+xH2gY6Za5kwPt8/d2P6Yjza0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782744165; c=relaxed/simple; bh=uZRs+mImZmwHNJTtoepxc3sRRV8e0nuegPZp1XH5AzQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g486rRjy5k1QjGgkNCXLCbbYmHD/PdgCdkguzFAUigI9C2bz5hl3gzTTlv8VhdFu4xNSy051T/KOxJDmpQwye/F1VYMZd18yo0xFoKfjdgxg9sDTEDwXWoPIo20K3USKXFhwyAhdIc+mVT+MwrywZk8XAiWnPRZ5e2kSMzCm9Is= 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=ASg6zH6V; 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="ASg6zH6V" 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=TVVMo16TNRm7PRWmHQW6fZz+VCRjTretVoH73fawlt8=; b=ASg6zH6V4HikVZVus2QkfucNtJ h0sAETDT6kI/7Endy+TlipZJr6okkcPDd9OXkpw1YJug/8wLV00IzfOsNhrY8JVQ9uO/CiIX/79ko bk6dNIs45B6hOItHp1nlSwhOuLFFVicZSeru08uTy0UyFIszZUKHV2z4RS3lNQ591mc6ErqbcAFhx pXaIHbE0v9Llrx0dqdTd5d116+iLVYDRU46sK4CXEBMAfDcrahE3cGpLfy5XuU5wvjtmarBIXAWgI ZXxFUrg8nO1lR625WfdqrGR3YgQzM0IZHNVrDIL4XXG5aHfEPaZ1XhUuT+wkkj7xTycs83WrYevjp 2VsaVl1Q==; Received: from [38.23.173.23] (helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.99.1 #2 (Red Hat Linux)) id 1weDC7-0000000EuZq-27Cc; Mon, 29 Jun 2026 14:42:43 +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 07/18] maple_tree: Clarify comments on mas_nomem() Date: Mon, 29 Jun 2026 10:41:34 -0400 Message-ID: <20260629144145.1572283-8-liam@infradead.org> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260629144145.1572283-1-liam@infradead.org> References: <20260629144145.1572283-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 f0aa08902b462..8106eb8bf2eb6 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5672,10 +5672,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) @@ -5691,6 +5692,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