From patchwork Fri Oct 18 02:39:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13841024 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 02257D3C53F for ; Fri, 18 Oct 2024 02:40:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 46F1F6B0082; Thu, 17 Oct 2024 22:40:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 429276B0083; Thu, 17 Oct 2024 22:40:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30DF66B0085; Thu, 17 Oct 2024 22:40:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 137E66B0082 for ; Thu, 17 Oct 2024 22:40:00 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 39E19121863 for ; Fri, 18 Oct 2024 02:39:49 +0000 (UTC) X-FDA: 82685167740.06.ECA4EFA Received: from mail-ej1-f51.google.com (mail-ej1-f51.google.com [209.85.218.51]) by imf15.hostedemail.com (Postfix) with ESMTP id 7D703A0003 for ; Fri, 18 Oct 2024 02:39:47 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=MiNoJkAZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.51 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729219164; a=rsa-sha256; cv=none; b=opu/3GSSOSJLc6nTNQiNIKPto3Ng3oVpgK5fAj8orZqw2mHPfZSkskxGXHyDogjqv3//sI 9s66mTcJZxSXdWuC5rzHwarrST/KdhXinaDziNqwUttIyRl/aCgz6MeDZB2+fOUIgbxZBN NrLPgJFyyv+OISB95cisScDmwf3/YEo= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=MiNoJkAZ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.51 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=1729219164; 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=jX0dCeTW34e6KJEBj58GLyjuq0BX1UGHwoQ7l2ngmGI=; b=XESx0WTU2ZVpVkP+mSIvd+Ophif9o5/xh+B7wlyImBniPvRxqoli3UZHrgSd5rhTGADu+S GHMXApcMY/UnOd6fl8PRpRtt8khmkf+sb0qAoFs6APZMKrTZcPgouyyor2ocqKEtrCvZ1Z +ULSyFcbdCVdCFbL8zeh0PH7If/zHHg= Received: by mail-ej1-f51.google.com with SMTP id a640c23a62f3a-a99eb8b607aso160664766b.2 for ; Thu, 17 Oct 2024 19:39:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729219196; x=1729823996; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jX0dCeTW34e6KJEBj58GLyjuq0BX1UGHwoQ7l2ngmGI=; b=MiNoJkAZIQWBLut1RuZPEQbkEmUPjV8LH/I6hibrpVFw3qeXpocJFFPQEpfO5aPuj3 +ifKWUEu0nATEVGghMd4M4oN5KOoYD3CxP4AcCcf7UoEabzmP3olyM5+PAG9jBxIrZPO 1kuUDUCcK3ZnhAABzp6/sSn9QD0MaPjW8z12f2SWuEqcV5ajY0+l6tZwfvW89f+qDWCh wHC8p1Iw9sSM5nW/hyw7+BYMl7NgAWvvFSWOhsyGraye1sFkUdRaNgoncFURhuqFzCq0 i1lpCEMAyMaT6CCJYbcsSIpDUMrdwE/85zFTdWiDw7ElkBZMRvOqAv1DoTWtRgiI8rGH Bu4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729219196; x=1729823996; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jX0dCeTW34e6KJEBj58GLyjuq0BX1UGHwoQ7l2ngmGI=; b=KtbC9drh6Uz9bbpufPrtcOOitkJDh5GytCzP5A9fI5K6AY0undaBs6yMd4ecHAgkJY yzmLGDlb7VlTdK3h28Jrw+z/1RwvW7qXuRrKBccj4YA36nkbjKyNtoD6M2HbYAmKrGo/ vZMmKv+lQhKpjdnXn2HRqFDJ+oVa9DfThbjNxuNFMLg92Vayt5wdg2OOBs7hM3gDETjB Jaz2sU72VIEwZxnfbyjL5TGk2VKnAIJ6lF5iubE1I9fqRFc4qSANl6HoPU2EeaS0Yo0n sbJmKZEZUWbo2VTduqVCeR1dxr8NVLEenDE/C/KmHZpKsUywqbPAG6fBl/koNDoY3iUV rDiA== X-Forwarded-Encrypted: i=1; AJvYcCVrXTYEOf5ByaxUW+xajUfLRI3opg1y3RFHV3wNwb+sRAXh8rMdUZ/llCGCzLqNGx5rtUL3xZ1K5A==@kvack.org X-Gm-Message-State: AOJu0YxZfhNqquFU7Z4UOsBAJcmUZo8jirQii5znUydJeg5FaSTN0Aqj 3XybJrhvqbPp6t8fvwHuH5IGw+YBhJnbo1WYS3obWmiGHhMYXtTX X-Google-Smtp-Source: AGHT+IGOTbF23/VbW/v+MNhz1aziT5jqH5BV+9mSgdLh17fGftNI+hgWDvwZnYVOtj4uGFSoDy9SQg== X-Received: by 2002:a17:907:7f26:b0:a99:43e1:21ad with SMTP id a640c23a62f3a-a9a69c55beamr54019466b.45.1729219196068; Thu, 17 Oct 2024 19:39:56 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a68a8e92dsm34325466b.2.2024.10.17.19.39.53 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 Oct 2024 19:39:54 -0700 (PDT) From: Wei Yang To: Liam.Howlett@oracle.com, akpm@linux-foundation.org Cc: maple-tree@lists.infradead.org, linux-mm@kvack.org, Wei Yang Subject: [PATCH v3 0/5] refine storing NULL Date: Fri, 18 Oct 2024 02:39:38 +0000 Message-Id: <20241018023943.13860-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspam-User: X-Stat-Signature: yssouuhebj7fy8jm9wbepb9iqno4sh7q X-Rspamd-Queue-Id: 7D703A0003 X-Rspamd-Server: rspam02 X-HE-Tag: 1729219187-827257 X-HE-Meta: U2FsdGVkX18ANMNGq761tjefoVoHMhcm0/gDwqMI0TTjK7mRlX4PgbiRNpiLXKfqYa4J5jc+sEKlLJ4a0+9vZrVl5NHWxw6eCuCzGh5aByTPsQdwoFjDijepHXiyDQt49mLD0AJ+zEOl8GrPft1VkscKSWcjQBCHHyN8VVbGoI0ZimnnfzbP6KmteZ0Ne6x8PCHJgyJr3bY1UkP3z+T7e6GmpGK/CDImCWXQqcd/nZNAli8Q2vVG5mT33mDUY/D51eLJu6Cywm9tjObjYY9MZz09WJiGzWUljhokNTLbeBQTh8nGaDR4hx+bq9i4th96cfjT9MV/6eQRrlSrBq2qjyROgZ6mDQRo65LneSNYvE9kYFb3pwvDYTQ/Jb5ErK8ZQx3V3r57SVs2oamkDgyB6fM74EBEFCcy8yBwZAlvsVWhwsa5W+P//oqD018ockhn853sX+kQ1FnzSQ8ZJNlpuUckuZv78kbj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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_store_root() 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 v3: patch 4 move the change into mas_store_root() patch 5 move test into lib/test_maple_tree.c 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_store_root() on storing NULL maple_tree: add a test checking storing null lib/maple_tree.c | 20 ++++++---- lib/test_maple_tree.c | 90 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 7 deletions(-)