From patchwork Sat Nov 16 01:48:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13877452 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F683D68BDA for ; Sat, 16 Nov 2024 01:48:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 18C639C001F; Fri, 15 Nov 2024 20:48:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 13CFD9C0018; Fri, 15 Nov 2024 20:48:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E83039C001F; Fri, 15 Nov 2024 20:48:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C4B4E9C0018 for ; Fri, 15 Nov 2024 20:48:28 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 3D94A80BFB for ; Sat, 16 Nov 2024 01:48:28 +0000 (UTC) X-FDA: 82790270304.20.62B2DD8 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) by imf24.hostedemail.com (Postfix) with ESMTP id 73CD9180013 for ; Sat, 16 Nov 2024 01:48:20 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SD8Ae34f; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1731721527; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references:dkim-signature; bh=BNDgC68v8sJKVQZrvcjoA6ZrF1/Wfw50bmTVtryDY/U=; b=EEzltPpFpX9WD9GcvwSpVa4mMcvZAsvSPRggUxd5If3f+U6EsMCTZuQkAyzOgjAgOfXc40 SMsMzkZeolwVSe2BsGPRc4h6e8a49ZLTsUYpuA1OjVkl9S6QR9UFc3qw86em8DD1QKgas7 zd9pShSC/AeaOaofsKfTrdxD8jp0kDo= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SD8Ae34f; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.45 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1731721527; a=rsa-sha256; cv=none; b=uMhehVLfoUk///8G2m8N/UkV1e9GrILxpptTze6Y8S0GxkIP9EmDE5F5KBNO366pzicmtP H4tQ9RL0kWE6xO+Wxge0dK46bvmZLsERRNrNZIqk6UGazZ32M8lpcOMlk7QZBrc67mdswI T6E21d47RrXVuVUrre1nh8lgXbHlSQ0= Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a9ed49ec0f1so405712766b.1 for ; Fri, 15 Nov 2024 17:48:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731721705; x=1732326505; darn=kvack.org; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=BNDgC68v8sJKVQZrvcjoA6ZrF1/Wfw50bmTVtryDY/U=; b=SD8Ae34fLAmKzRCv1bLhwBzbwRvne9dNLtDtuwY604FSF6mJYcWFSOp6sDr8iJkSCS 7N3xKcB8Xcds+x6+va4r9yBUqDVN1d0nS5hIsSsN5v9O+WUEirXAUOXLXNn7cMmWbH5N Gr4PVAVNAyB0mF6nvqcNWRpcUQPn+sPiHVgNBIDl7v18mfEdDVLx/Ewq5p/HF8022xly z4Fq7L9qQqhnwCjbkcXV2b+tiS0mf1JBGfLQDRgnaKITZm5XwCdlwBQX+ZpSIq8o9VYY eYOPBdY1/q8faVYGQ2GdSISv4cXojqYyv52VrXZv9BME4BZhxiOvDyRwZGdtG8sJaxW6 WFoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731721705; x=1732326505; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BNDgC68v8sJKVQZrvcjoA6ZrF1/Wfw50bmTVtryDY/U=; b=IL6BEOYyodva23OH5O2Kr812AMPULkQo3zmvuUjf0gTDlX4db/HVx83StGfziNxjhV N4Euj1CGeflEmdDQSh8F870d1OynN0Nfdu0piaXSEX99C9WBU697dO8ygtwMfMutfPsd vHzfx9LuUqLy7EeQWJy9ynoSboTmzOUx6YP8BFsLSTyNUbH849G8/d4rJf++0BVdJWJJ 7WAYxWXQ9DgmNELhfkkO2fT2HMybEIaZI58eySSlyjFUE3uYQrhX52B6PSbFP1Pp2Qad ewfk2Bqkfp8IR2OgvpRxktMFZwY5SePfTaxyh8SRWBAABAHkNc+Il0x5OkMnJXl1cYqY m1bg== X-Forwarded-Encrypted: i=1; AJvYcCUscViD5hIPGtyoi0To4qaJ7LZBoxVF8JSWXR7aZ3gX15hcBmaUNpMuQ8bDbJJZsxsSioszaMfFag==@kvack.org X-Gm-Message-State: AOJu0YzfDQfHAjJdk12zRweiTS75nIQZ1MCsSXK2OAGKSwrJqraOTTSK gsCfb/C1D4t9DzYLxfpSWNgiS+hqEAK+L4t/zIwGgNDF+RdhH32e X-Google-Smtp-Source: AGHT+IEVKWZ/iq3gc3tHNSgdopeDJYKBCaC9RVkFMhUDCZ/KP+MPgkGlIQnQHCyO/L2VU+jeuebyXw== X-Received: by 2002:a17:907:7ea5:b0:a9a:1918:c6c6 with SMTP id a640c23a62f3a-aa4833e8b76mr355096566b.8.1731721704864; Fri, 15 Nov 2024 17:48:24 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa20e086ad4sm238501866b.199.2024.11.15.17.48.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Nov 2024 17:48:23 -0800 (PST) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang , "Liam R . Howlett" , Lorenzo Stoakes , Sidhartha Kumar Subject: [PATCH 3/3] maple_tree: we don't set offset to MAPLE_NODE_SLOTS on error Date: Sat, 16 Nov 2024 01:48:05 +0000 Message-Id: <20241116014805.11547-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241116014805.11547-1-richard.weiyang@gmail.com> References: <20241116014805.11547-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 73CD9180013 X-Stat-Signature: b67hpj78z3jxttfqw7r5nt96j8fy1w36 X-Rspam-User: X-HE-Tag: 1731721700-169751 X-HE-Meta: U2FsdGVkX1/Lml2hxlvt+qlHC4UrN/HN5prDvHIIMVrcGRoLZVp07UDOLn/t2M25/Tr6kHRiAOPVnhy0orCpZGwChgOR7G7fnXK1JOZDQVXXWyjYMofV+KslbdMoEAfhKDb/KetuxPwosdBGSVxDOF6wXNOWJ61XMudpIXnaJgrYnpq1KqS7m7bRLipgmN6o0KmgFQClwPjEM5TEGCzeRmaSgVguVcJpWMecbd/R5F43uyC7Tk3YuR7qXNl27EpWhOpPmz7MFV5suLmvfcmtngTgMivgbxlOwDeNgK6964gGZCjqn6/Gkk8pPIAxIik2HU4Brl3X1nhRVDQAmuD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AOd7JIv+rI4W8RqddBtN80TS70oMrXVLIEdsXGWdzbscTNVLyYnRjApKBkkXpEVVV5Q15ks9/w7N2S3kA 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: List-Subscribe: List-Unsubscribe: When mas_anode_descend() not find gap, it sets -EBUSY instead of setting offset to MAPLE_NODE_SLOTS. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Lorenzo Stoakes CC: Sidhartha Kumar --- lib/maple_tree.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ab235d0194f7..b67dae356182 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -5011,8 +5011,8 @@ static inline void mas_awalk(struct ma_state *mas, unsigned long size) * There are 4 options: * go to child (descend) * go back to parent (ascend) - * no gap found. (return, slot == MAPLE_NODE_SLOTS) - * found the gap. (return, slot != MAPLE_NODE_SLOTS) + * no gap found. (return, error == -EBUSY) + * found the gap. (return) */ while (!mas_is_err(mas) && !mas_anode_descend(mas, size)) { if (last == mas->node) @@ -5097,9 +5097,6 @@ int mas_empty_area(struct ma_state *mas, unsigned long min, return xa_err(mas->node); offset = mas->offset; - if (unlikely(offset == MAPLE_NODE_SLOTS)) - return -EBUSY; - node = mas_mn(mas); mt = mte_node_type(mas->node); pivots = ma_pivots(node, mt);