From patchwork Wed Nov 27 01:27:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13886479 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 E647DD66BA3 for ; Wed, 27 Nov 2024 01:28:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C5E4A6B009A; Tue, 26 Nov 2024 20:28:46 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE2E26B009B; Tue, 26 Nov 2024 20:28:46 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A35236B009C; Tue, 26 Nov 2024 20:28:46 -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 780966B009A for ; Tue, 26 Nov 2024 20:28:46 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 35BA9A0EE3 for ; Wed, 27 Nov 2024 01:28:46 +0000 (UTC) X-FDA: 82830140526.15.FAAAAAD Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf06.hostedemail.com (Postfix) with ESMTP id 12741180008 for ; Wed, 27 Nov 2024 01:28:39 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KT0+aZeI; spf=pass (imf06.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1732670918; 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=by+9CkJ703rfzNoHr7wn+H+Sz8l5WyDKOh1JoZA2o6g=; b=XO4jmsvkAJeX0ABzBIFux2Jg10/4Sd7hJ2F/kOMjcHd1mJFEdrrcTcOIhkhkENbcAKemX1 8CgRQOePSZOCTA/vnu8NlhFt/ovT7EJAd9Q71ZVVpmX9Lp3xDadC4JvpbiuPnJPxFtDLkm /bAuu0WJa5tbkun+Cl+T5/0WQybTKrY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732670918; a=rsa-sha256; cv=none; b=IzucL7XlytqbI/VVHPNcoogLSUlNx+mS+F+L/oPTsMR2tDi8zIXN+2ZcBxppGNvujER4np 6ADptrMcH+vBDN6gWf78OhZkm8xYdZpSYlBWmbT24+OFEgH0/VeQ8j1I6/Bq6CUZ7R/4kr cpEMS6+OdKlzGakbiuT7zaFGxLI9/Ww= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KT0+aZeI; spf=pass (imf06.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-aa5325af6a0so548486666b.2 for ; Tue, 26 Nov 2024 17:28:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732670922; x=1733275722; 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=by+9CkJ703rfzNoHr7wn+H+Sz8l5WyDKOh1JoZA2o6g=; b=KT0+aZeI/2txAon9fl6/eK5CT+03mToRx/lSmPkAM4a3mDoDmsTBINvuQu0LYPdwmz VzrXaE+XhraI9Q92DEADYWLXER+i2KfAyChak1a2CL6GSE224elS5Ql9HyRhte603Uox OueVqxhG18t0frc6o/5lIOGgSWYsXb9UxrJS/NQxVZgfBgy0rK5pCA4Hq3gGW/TpSlrL CYAKp5Uyre6DmCiV4COF59KfHgPm5VOdH/t/JWrA/d+Bu7PqKWOFSlm4cUoHh8mHXYCq KLMccl0xGBjfcZBjc5sa4akldgV8k62inR73ILVjpuQ8ZZBcUCI4U1Z4bMjQvfaprEva OOZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732670922; x=1733275722; 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=by+9CkJ703rfzNoHr7wn+H+Sz8l5WyDKOh1JoZA2o6g=; b=DvTi7xgbrPB0BCiNJ2VDk6zpiZDNBWNIMF+XgqjPUAxbP13Z94dPM01e8HoCZMZVw8 9j7rW9hIamobOGro6DCANDhYfhzqcc4Gfc87bGf+aHJrN/g28xHYbRLebOwbyl/sC7/H IpP8PwBf+Pj8Wy49EPbtg4QrlkQEwbyQC3VxrvBiJlDb8LzG1ozw5qv5BUato+Ntn+mc 2T4ul5UV/fWKhqsn9rBNbfmNSUljRt6lT7L06tGPSXu9AtdArzmk9WOyESFHPcYvDZrm 2HYizwNVLkIJ9xg4C240nGWF9hLteWSTpwCE2QQ7kXRo38Ts+SibzGzAb4kDrJ6xd+KB Tk4w== X-Forwarded-Encrypted: i=1; AJvYcCWqB4295IZGp4e82TbCXj+i22GeGroNfKQLeTI/TPfEMstCE1MKJi09DvhwWYkVQ77ifho/kH0b6Q==@kvack.org X-Gm-Message-State: AOJu0YwUmKOn0gQ8lA2IV/XGx+XPdp6aReUStoXmRACkTRQTobwzCxhg vHI0JBg6XllMg32kqMgyBif/z12oBU8dmcG73UNOxtPSiHT75hMc X-Gm-Gg: ASbGncsX6f+Cu1fJGERDl49s7aVVbUhimE/ddfZKbdfMdwGC/ztpI16tob0ICikpNjD MgeLxfvEMmvZVSZzR4KC4KNde8GxaPGfnr+Ob1VLgJP5RqAsDLxrhRDWADJ6A+KVkrNOpcheQMx JQEC94Mvtzg980fon+Jn8Zj/hEsyf23T99hrwpIY6JVKG3sC5FdjxwuFwf5CT6As066JDJEk1u2 RMQ/xD9tX6FquC4+7VJ+lTmzw4+FZpcxc/89GQA+u/GcvwAjA== X-Google-Smtp-Source: AGHT+IE/7GRuE5VUZ6rocYF3rbZboxODh/IiUnp4SLWb4G6dHviCoZxRuJWTgJ3S46jDcfI949DnzA== X-Received: by 2002:a17:906:3152:b0:aa5:3663:64bf with SMTP id a640c23a62f3a-aa580edf9cdmr63669466b.12.1732670922160; Tue, 26 Nov 2024 17:28:42 -0800 (PST) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa54bedfdb0sm358896066b.113.2024.11.26.17.28.39 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 26 Nov 2024 17:28:40 -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 6/7] maple_tree: always need to update max of new left node Date: Wed, 27 Nov 2024 01:27:52 +0000 Message-Id: <20241127012753.3393-7-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-Rspamd-Queue-Id: 12741180008 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: ooodfbjjgz5wo63iew7166ed4i53cqs4 X-HE-Tag: 1732670919-858549 X-HE-Meta: U2FsdGVkX1/wTpkdhxmgXAEocOjTY58rNKjP/ndtg/IVzyXHULbWgtcl0sRoOi767jvJMeGbWwxvjgUu42caN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pA6CplpA3GiM+IST5lpkUz/Yl5aipbruZHw0GI+5mFPnnCv196+VgEHulfDQpXfq2tNDn5OAvK8vTUOJxiqd3GF7OMW4XmpXGjPEwGTfbjqZF8FOVDpIY8P/xAMczvu2Am91Y+YndCewhLj952/Cndu9Gn4h0Zlve99Fo5ilpOUC0l1wAaVtiK9Cim8nlaur9sKxQ7+/k8IRCh8O0FU2ek/aFMAzOYsWqFgVBBJJpCXigHmXZgyhp6tSwqL9Yttw6GxO2DcF8wWZeWUccdNW44FzNVvaxNxAKVDVzc2SmYD+om+5WaG88F/QcpZJuODGxHs6FqhM7HIbNjUKH/NqFrr X-Bogosity: Ham, tests=bogofilter, spamicity=0.000006, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If (split == mast->bn->b_end), this means we would put all data from bnode to new left. And the original data source of bnode is orig_l + orig_r, whose range is [orig_l->min, orig_r->max] So we can always update max of new left node. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes --- lib/maple_tree.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 56e9857ce681..4ba9ae68c0a9 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -2664,19 +2664,12 @@ static inline void mast_cp_to_nodes(struct maple_subtree_state *mast, struct maple_enode *left, struct maple_enode *middle, struct maple_enode *right, unsigned char split, unsigned char mid_split) { - bool new_lmax = true; - mas_node_or_none(mast->l, left); mas_node_or_none(mast->m, middle); mas_node_or_none(mast->r, right); mast->l->min = mast->orig_l->min; - if (split == mast->bn->b_end) { - mast->l->max = mast->orig_r->max; - new_lmax = false; - } - - mab_mas_cp(mast->bn, 0, split, mast->l, new_lmax); + mab_mas_cp(mast->bn, 0, split, mast->l, true); if (middle) { mab_mas_cp(mast->bn, 1 + split, mid_split, mast->m, true);