From patchwork Thu Oct 17 13:46:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13840065 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 2D065D37491 for ; Thu, 17 Oct 2024 13:46:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 547046B007B; Thu, 17 Oct 2024 09:46:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F71A6B0082; Thu, 17 Oct 2024 09:46:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3BE7B6B0083; Thu, 17 Oct 2024 09:46:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1E7A16B007B for ; Thu, 17 Oct 2024 09:46:27 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B4E7A121518 for ; Thu, 17 Oct 2024 13:46:16 +0000 (UTC) X-FDA: 82683218688.14.9EDADFE Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by imf07.hostedemail.com (Postfix) with ESMTP id 24F6240016 for ; Thu, 17 Oct 2024 13:46:10 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=JydfKGEh; spf=pass (imf07.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.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=1729172711; 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:references:dkim-signature; bh=etI7P/G1TkrnunV0PJtD9Gf7qCxsqEIQV4Ac1St7g40=; b=BjUqIismTjKEGNWKvL1aGe3laxs/QR1QKmcblFg6NtMJ3lmGUoFlbYP+Go+VFPe6Doxo2L SV191WlvhRLb5CxVDGtqJfEZ6X00RfKb28atm7OrS2PehJWPr2MuCRxR4dDEmUqC4gyoby JGuRNYKV8eLOKgwLN6GuV6uuIta1X8Y= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=JydfKGEh; spf=pass (imf07.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.208.41 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729172711; a=rsa-sha256; cv=none; b=DOh3NeQoDgzT6E9uv0T48leY4dcHinn1qzsLeFE/HBNaHrgglyAUIYQfztkPKhBnbgnPVj /8TPyXGMuUGAiXTvlg5kglv6mpTfvQMW1zdeD1sM7RNsJavZIV0i4xCTDCNpvLbBoyJzJr 0UHxB0zmzZgbvMidnoZbKjouLqEaniE= Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5c97c7852e8so1408984a12.1 for ; Thu, 17 Oct 2024 06:46:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729172783; x=1729777583; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=etI7P/G1TkrnunV0PJtD9Gf7qCxsqEIQV4Ac1St7g40=; b=JydfKGEhWbn8GMK6xKA6F+tMVMtrPt9jd8xTJ8fgedq6DueRe7bUHbNjTW0SYMsIfU BXQD+f6r1LdZe4ae4nikNcr7QK/7tS4SCP/DscaYTa21z09Co/Zvr+fJ4cspTpny+2SP nRvPg/2H2zrDDqWT9YranBzQjI3Lw6j3ILpCtu70HovfkYLfMMPgEzV6LEl2HLmWPpTN dFqOO6COlJ8cRoKhOE0sytgHY+vG4DyufGLB9ygamzy1E0UZfcr+pXJ6duneosQOPPZ2 op+ClGxmWpQE1pzsKmxS3cQka3eqUMwM3YEszeWw+6Jg2bruMP65wQBT9GLFB7gj0kxN WGqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729172783; x=1729777583; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=etI7P/G1TkrnunV0PJtD9Gf7qCxsqEIQV4Ac1St7g40=; b=rqeALvJ8QnO6SysgGIR5Z1CSr1hnSAwIbr1M7iLMd1UemboLlivA77zbx2HsYhFn1U GoMxTjlvBJHXt9BIoDLdjgRA1SLvuUWBrpk687MWX7Z+ve/Zu0ALX8r5RS5LWYbAMQlk ScCSbDhtz/EWoAz7WqKoUBj1wS/0yN559ReWgzSpeUEyHXGzz13viFP+WT5x9/wDtcUC x2hk2x5HWTA/aMAc3wMYLPIFf1nYNmfZVzepTYPDUzdlH2jQibLQaNVoB8iYGeQwUI8J RxXv7QLiqwNjFqEUuFEUgZe3SUOyouGWbWyqsmCQ4WCqArUK04JcmCqAsKH+jIdWlvLy KS/Q== X-Forwarded-Encrypted: i=1; AJvYcCVeC/DzRdJFD766VqSA+mrWfdWyJcyyG0csTqjGGRHSQPYt4WaYqdcIXfNV9YegnxAMLBXQTz+eJw==@kvack.org X-Gm-Message-State: AOJu0Yxvr7IzyP/wRCeOzXVxaGoM5JsBGo+QA8xldMxsQv91IRrJ7Quz +/fLRQCtfVh6TOJs61FCZkNtlgc8ayatBuaU7Hc0S24lxAUzmWcoJg4zM2yB X-Google-Smtp-Source: AGHT+IGWdnu7YKiwoqFSrvw8r8aHzRVRkeY2JsOEN7vGCEHWZMcKxB5Jl2cPk2zACCt7pOmPiKZ2Sw== X-Received: by 2002:a05:6402:909:b0:5c9:1d7f:4fd9 with SMTP id 4fb4d7f45d1cf-5c95ac15476mr16529075a12.8.1729172783064; Thu, 17 Oct 2024 06:46:23 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c98d4d693dsm2764070a12.12.2024.10.17.06.46.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 06:46:22 -0700 (PDT) From: Wei Yang To: akpm@linux-foundation.org, Liam.Howlett@oracle.com Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang Subject: [PATCH v2 0/5] refine storing NULL Date: Thu, 17 Oct 2024 13:46:02 +0000 Message-Id: <20241017134607.30206-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspamd-Server: rspam03 X-Rspam-User: X-Rspamd-Queue-Id: 24F6240016 X-Stat-Signature: s8e3xxhriyjc3fbz5mq7iwnq7ymz6pac X-HE-Tag: 1729172770-500284 X-HE-Meta: U2FsdGVkX1/w7olKfcrRwyaRWcsyrA5k/8SMuVeB7pQAzioWiTl7D2gXwPOJVHJQbGADMUIpvojrPYHz3pex7cakRYlllR72hPuu1Ah0ZIBwickmSm3o8V5Tag+NRjK6ZRMfza5Tx2nwWMANvAXtjXtzbuSlydUnbUkktSUQv49ADsGMLCz+Dt6mfEZiI3hjB5CgSR2CgPaRVv5XVLX5YV6/u0tNT8NeftWbLEoG/RsUbIZ6xVUcT41M2lUEXYTrviMDz98J1R075QXRLZ8W+2SySAjD3eDANjppt5jPnn4k+eCURO6Ksu4KhwxBJ1vDjmyCA9BnIy9mBaJiKki/Yzpm1Tcv44Nq6L0gLl2GM7oki8KzXpItCWwePVu35gpmsqaywUHxi/wH7k19mtU3WFeO9sXsTla5AdkkPSq8bRU9n5S0Xe3OIhcaFTsb6XqEq+d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 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The original thread[1] thoughts it is a problem in mas_new_root(). But after discussion, this should be an improvement on storing NULL. Patch 1/2 preparation for refine. Patch 3 remove redundant check in mas_new_root(). Patch 4 refine mas_root_expand() to improve memory efficiency and remove possible consecutive NULL slot. Patch 5 adds a test for storing NULL. [1]: https://lkml.kernel.org/r/20241015233909.23592-1-richard.weiyang@gmail.com Wei Yang (5): maple_tree: print empty for an empty tree on mt_dump() maple_tree: the return value of mas_root_expand() is not used maple_tree: not necessary to check index/last again maple_tree: refine mas_root_expand() on storing NULL maple_tree: add a test checking storing null lib/maple_tree.c | 32 +++++++++++--- tools/testing/radix-tree/maple.c | 73 ++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+), 6 deletions(-)