From patchwork Wed Nov 27 01:27:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886476 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 28F2CD66BA3 for ; Wed, 27 Nov 2024 01:28:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A863D6B0092; Tue, 26 Nov 2024 20:28:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A0FF96B0093; Tue, 26 Nov 2024 20:28:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 862DD6B0095; Tue, 26 Nov 2024 20:28:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 570BC6B0092 for ; Tue, 26 Nov 2024 20:28:38 -0500 (EST) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 0A9A9A0EE3 for ; Wed, 27 Nov 2024 01:28:38 +0000 (UTC) X-FDA: 82830140148.21.0063346 Received: from mail-ed1-f42.google.com (mail-ed1-f42.google.com [209.85.208.42]) by imf04.hostedemail.com (Postfix) with ESMTP id DF0D140018 for ; Wed, 27 Nov 2024 01:28:29 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ir7bNhPc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 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=1732670914; 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=6WlYYag5bl5na17CqFt7RfhdHPEuMZJxwTX6PzBzjEQ=; b=nIw42PQ1hvGxy/v1k/5jTjSsBGQUZvKNEHcO7OxtI2NkGZzR5pa6ZCBg1q7JzRiaP2J5CL TVJRvKbYx1t0tv2jMu2f12ia1ZZJI3p9MluL2lak29wWombtkCtyeUD1hQbCWUf/pPvowY NPeHyzyClbhdQXjNkKH0QNt0sMgANjk= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670914; a=rsa-sha256; cv=none; b=Mu5LrD6/jOWlC7zPs7UZDRRuWVoJYUZnEXOTMKjFYVBdXbf+BFSt7JjTXAsgyf93o8pJG+ MYUahm9E3MNjAjA/8w844eBiVrefuKDcC+4U4Hp/4v31BPiYfwZGyPUIEQiauENPrefiuJ 1HFLulxVGsd72761yfxoxjY96/KHMmo= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=Ir7bNhPc; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf04.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.42 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com Received: by mail-ed1-f42.google.com with SMTP id 4fb4d7f45d1cf-5cefa22e9d5so7349490a12.3 for ; Tue, 26 Nov 2024 17:28:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670915; x=1733275715; 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=6WlYYag5bl5na17CqFt7RfhdHPEuMZJxwTX6PzBzjEQ=; b=Ir7bNhPcMyce8dNCfEynxg1kh+97H2jKP2mXRGiT4ZXYKobaPnfcOCyIMdnD8566dA DJts7OBhEJxhHCDp/E/5vRk33tej6IAq+QS5Y7IP9zotWIMewXZIr9rDlaqOZbXPf0Ey 4comc0Ui+4xHH+s/zFcxGKw1bJqyBpZTj/WvEx0hAWhW9kVqyI92IrUYwIipi4HS7Ytc hNYOAIbJAxWXc2+zb3IbDY8086Xe0VFoWOelx9mAPGcyZBzxisBrzwOyhKyWNNBreQQb /KTRBsWYlV6zT9pUPaKCETuWc2uQAy9RiQk0A6295MoGl0BChaVZmA+k+W05d11tcJOm YVEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670915; x=1733275715; 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=6WlYYag5bl5na17CqFt7RfhdHPEuMZJxwTX6PzBzjEQ=; b=fSAS2EBhlR3euCDg3rCa0g5Fzw9PtpU/znnUBdSfEkVB6i2LpVYk+qDT0+epJDGofd sXJ0mkh972P9KsztdXbxxnArcK90ok+g+wY8vTPsBGhUNp1Kcz0yRyUmC+3Oi4RXwOZC CFVLFvsD458oZ1vJ4ZhnCgB/xuljEitiv8m3ahFPJl5dYhDoDh7cexFldq2r0S+Dj3xt 9UQcDZWmHEgfj5Jn+HedJSG4FG9W7yX9msFkoYh6rPZ3g4ChfKUI3dHiEozetkrKuasv D8gJRjAkT687P2JWbUEzfkGVAfxYXxvD/dyOIhqMKOM0P5xjK/6EKbLgoBAP5dxPJlj3 DRXw== X-Forwarded-Encrypted: i=1; AJvYcCWL3ILb2dnKbgVAg3FfyIkuuvkLL4TW1WIOBOK5q1V8AgI/ChudlVUr8HEz9dyk3iidl5TZK/VGfA==@kvack.org X-Gm-Message-State: AOJu0YyGwNf+EWiDAho9UnXVaBSRA93+N1yaUu6WaMwGUGPjK1rFLw57 Ek2h26WJMTfUAYBchTKdpVaOA/c6OAI5ui1gKgXliCHlkgjmouIwf6rNjwGY X-Gm-Gg: ASbGncuXETWidkGchz8c+dv5gaalFCfoTuSzGhkywXhk4N5LoEU/PcU+MgCtFYrceR1 Mrguq3LuAf6/2OFRzvs0FxM5cCsbjzhkSZ9+lq116q1KtQfd/PMiIJ+7RCYd1fCPdKlsPe/KsL+ ItPD+T5Oi8KA1k+KceXdWp0XSwcyOLxTCinZCqojKzf8CVh7T9ivkc4oLsiNuYsN1BJYBDaingz 7HOhM6hQNw6A4GiBMHkFZ90g11Brh3uyXsO1bkHwicIUEGMVg== X-Google-Smtp-Source: AGHT+IEdp13lrIxwaL3Rejy77vl7pBalJo7v/ja9qVsMrbE7C0fS5nKipAIW+vFMRRhOQILzUBwdVg== X-Received: by 2002:a05:6402:43cd:b0:5d0:7207:319f with SMTP id 4fb4d7f45d1cf-5d080bce68dmr954547a12.19.1732670914520; Tue, 26 Nov 2024 17:28:34 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d01d41ae1fsm5570957a12.79.2024.11.26.17.28.32 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:34 -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" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH 3/7] maple_tree: check mid_split only may have Date: Wed, 27 Nov 2024 01:27:49 +0000 Message-Id: <20241127012753.3393-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241127012753.3393-1-richard.weiyang@gmail.com> References: <20241127012753.3393-1-richard.weiyang@gmail.com> X-Stat-Signature: qeqa95p5dx1rgh83zwgwxhxfoeg7zmkx X-Rspamd-Queue-Id: DF0D140018 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1732670909-61264 X-HE-Meta: U2FsdGVkX1+PNIwVpO5EY8fmZGAvTCE/GMQtdMgRtZ/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TZboodjT7vri/Pjt2COVOX4D8I/wPzi+hB/e67qfojumO3Gorh1rrHg/lrl/CVH5ATRgw2wZJEPEQUa5qbK86OxWdSFXb0TLbKf1v/yVTDh2CHQEj7lk9lOEhuKus1ovw8UVfv/AURMCm+qJaxjcFaYYw4QQhdHG80G0KefNVgU7/j+EwahyAwtOyEE8mKTWrRYfYmKGBsUvx58/u6KftwW0IrWLX49mcIoO0bpewrvdfrt5E9Uxc2LIlYNK1dUZQ1SSmka2qR/Trm6Kp3ZL7Dtah3HyJ2atUyCmNiAhuYsJVNzdvcoObcXer+9x4eBr/NkeJPexHAYm+Fz064CneHPO0c8/1CqMuyjp0jWn3KZklx+EDPuSGRdssjICzZRzd2 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000008, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: We only may set mid_split in the else clause, let's move the check in it. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 2a00441130ee..f5606b4d0dba 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2381,10 +2381,11 @@ static inline unsigned char mas_mab_to_node(struct ma_state *mas, } else { split = mab_calc_split(mas, b_node, mid_split); *right = mas_new_ma_node(mas, b_node); + + if (*mid_split) + *middle = mas_new_ma_node(mas, b_node); } - if (*mid_split) - *middle = mas_new_ma_node(mas, b_node); return split;