From patchwork Thu Oct 31 23:16:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13858435 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 0493AE6748C for ; Thu, 31 Oct 2024 23:16:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 42AD96B0096; Thu, 31 Oct 2024 19:16:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3DA486B0098; Thu, 31 Oct 2024 19:16:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2A3796B0099; Thu, 31 Oct 2024 19:16:53 -0400 (EDT) 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 084D06B0096 for ; Thu, 31 Oct 2024 19:16:53 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A92F7121677 for ; Thu, 31 Oct 2024 23:16:52 +0000 (UTC) X-FDA: 82735458246.08.AD77905 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by imf30.hostedemail.com (Postfix) with ESMTP id 037DA8001D for ; Thu, 31 Oct 2024 23:15:58 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=E8xOw4Oy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.43 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=1730416449; 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=5awDldLJv0Mt4xN3toreWbJxu/89ckuzVXBtMkocXU4=; b=IgJSFEkKxsUhnnWW4FnpGvMTZGoPmsJTPLueQBP4KItHvGj6BndD421tn9hO9v33lYbOVX iyKZxP7x2+KrLWH6Bj9cZaRfcegByVxhhGO2sg80QZD7UbwhweEPM47e/7wK+J9Pu1OkCI q23v08wO3Yzhf4IdBwaOAPFOimesROA= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=E8xOw4Oy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.43 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1730416449; a=rsa-sha256; cv=none; b=L91YkmlUPbS2yiyhiFgix3WsufSd3XOBzI6vcjUz2zRnsHKXwVsbDoX6zszsqwETkuCUIl lId0sZoi20bv5xRBdDqvB+3dYxoSqVS0DprHocZ/aZSTe1ZPAyfI+iXEp4dlkEvCgTTDy7 Y5iNgWYE/v8AdIyPJDFTCkTwe9CUVZY= Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a9abe139088so215944266b.1 for ; Thu, 31 Oct 2024 16:16:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730416609; x=1731021409; darn=kvack.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5awDldLJv0Mt4xN3toreWbJxu/89ckuzVXBtMkocXU4=; b=E8xOw4OyGiVnNhfQcrqmJ9EMgUYSQnHxupJBqr1jSMzM4Gdo0i0ti90CLMl7hFMORV wPH6oHPJ+EU2BeGJ+tiCH7Rj9bg0MSLQIfAgHifcJtnWkaB34gVBPeIe9gC/iRxw2kcw F84D3OQwCid/zc3zkALtTxnP/2xLOHKjYVRJNNUB38yTEV1AAQX2zqmnLjGszBuR//2G qUEMwytv89U6a0z79DrQ6au5+/LIQVjDbPSuCNAMcly2tKShqPfzFeEX2FEYKBixiSCU 7vDMaL1UCSFiK5RR2rJA6imT0/RVgoRxBONAfTEZ1eyNH4WQhLARN91e9c1BBrzYpPaB 1KVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730416609; x=1731021409; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5awDldLJv0Mt4xN3toreWbJxu/89ckuzVXBtMkocXU4=; b=msi4O3SxRhYYz3ptEwLaBDJQEMDIq9L66v/TTPb9QbB4a1Zcf+cAQsZVmRAy2bWSCY haCgSE3gdifvVBMsuQ+cokWtnVC1lF4c6Xa+VFIsR6kmgJVycOzBoCBHzETOn3kGf33y H2x77GiX5oRsqfE2AuIKqRtRoOeaHqREbjtrn7UmucoJWRzSrsJrl8zG/99LLKDhd9MQ O4wkvb1Xxuznp9mhjyua6d3CF+wwcRaFOewlgCitAnsCXfN8gHl6qrGxpObJuYGXo6zR yRdLv42VLnWdn6s2w/ojA/N9fMQGDQfklHim4aVDzKUDPFM4YWBfKsCMIJf/gwQRkIY2 08ew== X-Forwarded-Encrypted: i=1; AJvYcCVJRu6KKBCZc9tZJ3PbK3aEVgSNjTrSiuwkux2PHAidJCpXesXOJvUfHCuSOVvMq7vO2bFZosFy6A==@kvack.org X-Gm-Message-State: AOJu0YxWDE6S1dUBNztV3twJbeTXuJEvmL1Z5kcWvwDQZ/damUegJY2V SohTyCVwuMFrgQnHLURr/5ySt7CNo2klx+CtC2HjxoPGpasi+aSqfmR4vA== X-Google-Smtp-Source: AGHT+IF9/mZgLvRMIx1xRe8jxfGskCDI9e7R+oHLkKRAMJ2D533nipkG79NmrCfnY7AbFoBMloeSlg== X-Received: by 2002:a17:906:c156:b0:a99:f4fd:31c8 with SMTP id a640c23a62f3a-a9de5d65a4fmr2172241066b.22.1730416609251; Thu, 31 Oct 2024 16:16:49 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9e564961adsm115607366b.34.2024.10.31.16.16.47 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 31 Oct 2024 16:16:47 -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 v5 0/5] refine storing null Date: Thu, 31 Oct 2024 23:16:22 +0000 Message-Id: <20241031231627.14316-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 037DA8001D X-Stat-Signature: pa353awpbrktsx7yk919i3gmfdb89zez X-Rspam-User: X-HE-Tag: 1730416558-914787 X-HE-Meta: U2FsdGVkX1/GvcfD8SMTuR+pLxt7UpAfZImDsKeMjz7cNxuV5w1uIh5o7GWUTFV/0L8MvQY65ylzukTcPHXyogFXKVrecuQ1gYC+05cAm9uZp8iKVbl+fSLICTGpMydnVOj5kGPKrEcj83pbXS3enLS0AeOGr4ITqDwmqrxuXKRNqeRPcEQ8xpBz3rcsiVnbDPW3RuxzHJool+miWKYrR5FsKv0dHb04G5jk5PXpJmEABhKIGfcSoMEQcK/ZcjM1WiMnvVSyk0JniEDZbrFlaxFtlSYaar83cklRq1X9eGTQOLDsOmFt2xqiIN5iLtZxSsxYUu/NDSjVyQXDYFOs67ECeC/dCIfEnVHICUWlDgBgpFafYEMu9LegTuSeKsyHnVmD858D1QviJPR0xhFqX5YwwVZrUepzGHjiYbT38UbyvXNzbXmtwkuFyTg29o4p899vxpcMoM0eorngpl7kpXW204UNF08M37Z/3DwfXqWHOgXxMmAopDEqhxuWwTwCsyAZ7k43gkakFKeJizVodED9LR6WOuw2+UOGJp7Z6kKdvkhtyoJWyRfJchRLukX6NNvT+9VcEZFZB0XgjZE6qdMzuBgrhKYwxIo/kqWRtqy+q5vsoCk7mLVMyU3ThTHoyRP90s65Zg5Incw7clEetRxrihDmf/FoCDVUqz0NH7ezsdniCUe5khDb+dgj0dH95IfSW6MIe6fxB6fsf5mS53jpMNqZOWgQbzN2kT5+gXw+6uOD5RH7nXCh80irObUNUBaECSsafEoc9AiDAct2aESQHEpXD/XaNfms2VEVsp/44POOk4U4gXWV64VJ/svQthuF442P96fQA88s1KpyswKvyevqrK+GL2YJFsW2ULUt28PbyZDzyvH4vswr7p0YQs0XCpnULUhiHTLsKFkrt16VArAsFFbDSNoD37mxI1qsBHtTAeba7DRtIwGGaARBZ+P8OKhHKYLqSG7KaIT 9Ra77xfh OIdwcDJlZKu9tiUKX4etgsBYWACe9s0dvvIQcqdsQCP1z2NBjKMJUVZXHgcB0VgMTG0vEUX5tnHE8HmfU09C4XhXvLmfJosnascpiukRWoNnJ1O8Bg8NUZ/bJ3TOJ79GkyO0tOsmQt8w5UK25QP6UafwlOTPzLZ/cj94ckpuxKkiP0GbuzTIY2p/wKcQjeNoTupJ0G5rilQ+KqTqW9rpwlnWSvIidcxEdIBsTXvedWWo7uiFtGkwVd30mbJeVlnuyqRPXrYm8ZhxeWCpW1/XTIx15XK1Y7ilnNPAipnaVyQqUxiUmN5Fh/Gq9XGbwvgXIH/85vLvENdiJALyZZoRmXfBAIZpbag8m90f9cTCqTPpOM3ex5n5P0bHRWo9h8WYt86ea0p8oe+moih1nr79Gu9bs/+ZMW71vBYjCeLM8C0SwIWNtPw98VZ9+tISETsbXh3i3g+fAFBOeHq3ZP43NLP2ctQ== 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: 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 v5: rebase on akpm mm-unstable fix a build warning on xa_is_node() in patch 5 v4: patch 3 add a WARN_ON_ONCE() patch 4 add a comment and simplify the logic a little 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 | 29 ++++++++++---- lib/test_maple_tree.c | 90 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 7 deletions(-)