From patchwork Tue Oct 15 12:07:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13836272 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 557C8CFC29A for ; Tue, 15 Oct 2024 12:08:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B59BD6B0088; Tue, 15 Oct 2024 08:08:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B0A616B008A; Tue, 15 Oct 2024 08:08:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9AAF46B008C; Tue, 15 Oct 2024 08:08:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7A51E6B0088 for ; Tue, 15 Oct 2024 08:08:26 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 1C67012153F for ; Tue, 15 Oct 2024 12:08:18 +0000 (UTC) X-FDA: 82675713876.07.DDE5354 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by imf15.hostedemail.com (Postfix) with ESMTP id EDFD2A002B for ; Tue, 15 Oct 2024 12:08:16 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=nSlcjNnj; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.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=1728993999; a=rsa-sha256; cv=none; b=DvXglg3AvN1uq5StV2K+8MN0QiNOoSWuvdTRj0KGGgskE0PazRK23jEktZsWaWfkiT8ZLA cbxbgV8XWpmsv8GIK6XWxPd00ua1/vHoQ29W34w9/haCkE2+fUwok/x/otQdjiRGOwoUjV /uCuKBXIOJG/Jqq0uUZMaUfAuXXKJsk= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=nSlcjNnj; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.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=1728993999; 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=fxoY7C4VGYq16+sAQnODAKHP8M41ALGIoN3BFVWo/Vg=; b=n3HhvWMJRqfq4uFD+GAj77Nex7wSPJ5NQqKUS5X6aMDP6q6ZHh2W472fApygUHoMOcB33/ X4L3993njo3BYcxev38dtjRX7lNQ3MNx8eluoIwXtTPsokxyMLFPBofZwl+TS9p/4exVQ2 RlC4t+ie58X/aNHQPbwsLg4pM1Ic34Q= Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a99b1f43aceso765114466b.0 for ; Tue, 15 Oct 2024 05:08:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728994102; x=1729598902; 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=fxoY7C4VGYq16+sAQnODAKHP8M41ALGIoN3BFVWo/Vg=; b=nSlcjNnjDPuIbhfDNI+WUAmUvxTuoIDxsYVFgOOL6aFA9WB++6gsJMKuO5w/k2AbZv SzFWtZg5pinZAmerAyNCT7XK3UByhigSSHDKOysku9zIlkcy0HHnwNTtzi6t8BhvZNu1 FsOpTPR/e7mCrPqHWdCu0J5TFTOz6iG5NC1zaSFsxnCqToPEBopKPosAMCne9OZjY3cm JHdkGLjStR6VmrTXSc0fDYRzFTZzel/oQDrf63fWG0SSwGS0vSBflMCf50aP1jGnfXVK d55/fwqrGf42z4BLl9mIUL333ctFqp98egZhWYmjsMI6cWzTpHuE5wgF6dscepEUpMjd HVTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728994102; x=1729598902; 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=fxoY7C4VGYq16+sAQnODAKHP8M41ALGIoN3BFVWo/Vg=; b=SbTQZl+mqEqH5YnefyXur+ZZAZtp+5ijINoPa7dC9y1cs2aBUlGHUDt7Fsw68my82A cpDLJCQaUWPUwVx6rUM3hL+2vSbmMHKD5VNqow510261Zbc8gqQm7Ya+/gKLruxv/mww 8JwOkyhNDEECZx0lGOyz9ZMiwkKpvRP4Bi2VBlJe56dY7vWlb/d8EMSLc0wbcGnmSLaa ymFIniRmqp5xMVXIdmY9fPGUHDGtVFG/j1eE83PXuiiKUh8sEkRGbqInRQbfgzqtkPYP g3dd3NS3UzGHYSWkp4pFcS/c/utiDjNlgFCeW0oL6OTKzdyzA113/RVecHQwn/dWIhAh 9u5g== X-Forwarded-Encrypted: i=1; AJvYcCWp5PJJKo38I9lHeHeZ5t7O4X3GU2Y8kwW5MbmKT464Et8bFgJGsTz3joho1D4ddNtt3fn3L+D8wA==@kvack.org X-Gm-Message-State: AOJu0YwHCOFhbK0Gn+XjInKIXtjzMUEln7NYtz/NQyPessXgFkqXQVSr OqFPFzNWKh6/t+4Ba12XZ7v6gWsI69EVWSv95aF+unw7OeXjPBF5 X-Google-Smtp-Source: AGHT+IEDUsZrHeJZIcuEtncoF1MfpXbAXYhA0FlJPUDCtvdMGPhPUHPSXpLS4NnQoIJEQYjfJEoqtw== X-Received: by 2002:a17:907:1c0a:b0:a77:ab9e:9202 with SMTP id a640c23a62f3a-a9a33572723mr27345066b.4.1728994102272; Tue, 15 Oct 2024 05:08:22 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a29817f60sm65039766b.140.2024.10.15.05.08.21 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Oct 2024 05:08:21 -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 , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 1/3] maple_tree: clear request_count for new allocated one Date: Tue, 15 Oct 2024 12:07:44 +0000 Message-Id: <20241015120746.15850-2-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241015120746.15850-1-richard.weiyang@gmail.com> References: <20241015120746.15850-1-richard.weiyang@gmail.com> X-Rspamd-Queue-Id: EDFD2A002B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: bauizrmkbkgaa5airr6p69f7a3yxh9wn X-HE-Tag: 1728994096-54487 X-HE-Meta: U2FsdGVkX18hjW54okzFJ+QveC5vJ9kQU5/1PyUf5Var25v9cqnWWZXYWm1cvrDhgWDqE+jocymkZ8620dRV8fcsIzIn7tl4xFzBUbfxTaNbIqusAKKcXa56yaz5sDx6hh5zPLaLA5Belsbbml34/oLbBhWbWUYbRm58zrEmQaJJRatodzq3jZ6kOm9a7xTy+RFdhkZvefJYTSxG71cxA/Ny+byVXYJ1cXn+PWtkUmwjH72VQTkG1sWtnFRrw/O9s52K4oqG6hu1+OKt7o0W/2wJQWiCeRlvvUxViEcTRweidHGBkzA/j+ALjz/lc/hp/ZGrzzplBJZHGzCbvSs68C/XRKTZw5lSUDZT6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YWufs1ha4j+wcr2bbclz3q/9Y5Kycx0ieINYVjkqmU4jAe+2nX9doe9Z3OsEWL/8RtQf7NbBNlbDBTGJceXMSjx5snIA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.010203, 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 this is not a new allocated one, the request_count has already been cleared in mas_set_alloc_req(). Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes Reviewed-by: Liam R. Howlett --- lib/maple_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 6047c74c5a31..31899e853c1e 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1250,11 +1250,11 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp) mas->alloc = node; node->total = ++allocated; + node->request_count = 0; requested--; } node = mas->alloc; - node->request_count = 0; while (requested) { max_req = MAPLE_ALLOC_SLOTS - node->node_count; slots = (void **)&node->slot[node->node_count]; From patchwork Tue Oct 15 12:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13836273 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 D63D2CFC293 for ; Tue, 15 Oct 2024 12:08:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D563C6B008A; Tue, 15 Oct 2024 08:08:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D06F36B0093; Tue, 15 Oct 2024 08:08:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B31BB6B0095; Tue, 15 Oct 2024 08:08:27 -0400 (EDT) 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 8FDCC6B008A for ; Tue, 15 Oct 2024 08:08:27 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7F2781C1C1C for ; Tue, 15 Oct 2024 12:08:17 +0000 (UTC) X-FDA: 82675713918.01.4EF21F1 Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf18.hostedemail.com (Postfix) with ESMTP id 777A81C000F for ; Tue, 15 Oct 2024 12:08:22 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SR64SlAA; spf=pass (imf18.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.46 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=1728994032; a=rsa-sha256; cv=none; b=GSpRIOHocinaMGldEXqeNrPOBmMUfckHmOdxkNjinkUl1ldogNjzwH0a/FoWP81PMjiXNh 0dltOThNYUvaCNTu+cVxNWkRNh6q6TPqSKrC+ymcHXjlh+XeMfsBiBTtk+02SzALrRMSPr T65AeGQOOVhft8WcJiqH7CpVlJtucHQ= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SR64SlAA; spf=pass (imf18.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.46 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=1728994032; 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=eOy6sa0JUKy3KlU46mCym0FVccJKf96OTpW1c8cg+ag=; b=cXSSUfj8ET22Xxcu6upC0UOrP/D1tK4a8LDmxbSN2nrg+Ptp8L28RvUVyCY3hHbWpjLuTQ IDeGB9uO3wb3QFND4THrMrIenLee3GDO+8RpcctNkI/wf8jGwE/Zz8eUNx7VudqqAm7aT0 0u11ZMLHfdjIU5VxSoWEReAR49GuNKA= Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a9a0ef5179dso294163766b.1 for ; Tue, 15 Oct 2024 05:08:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728994104; x=1729598904; 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=eOy6sa0JUKy3KlU46mCym0FVccJKf96OTpW1c8cg+ag=; b=SR64SlAA7Tf/d4GUQ1uGVRiB4Kvf7x3SE7pvauxnPrXqRd8rCpm5yq1nqgVXDj7Ao3 4LUMGPIp8mSuM7+1hoWCoJ4SxlBsISR8Jtpajfu6FCE4PFtb6s0AXF2QQKn035sguYQC BOBwVTYiN3lqcS8wSu/ci51p5DL/8RDgthEUkTTtcaBnRC10dZx3xM8fMIs0oYCmdIJg H/gAVzBU6u4Hj/MnUDrAybDlw4Sf450Ezdzk6CfmGtI84vJZp801dmzMKjEnNnLSc1y0 JQ5SpjWfOi8/18Ad3X/XxKmKliNyrxLP0PYs3ND/QjHh8DB9ST6laMo2nuBrKLZCBaJq luxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728994104; x=1729598904; 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=eOy6sa0JUKy3KlU46mCym0FVccJKf96OTpW1c8cg+ag=; b=X5j46qSIZpvCU87pNo7DTQ6F1PsLZwFYQb6AkUL3sNKjjgRJpCgcIrphxuXJLDkdfO wgxgd3aV+6rx8EMXZKVlXNHkA1iEZA7/D00rZjpH0t8q4B+0bRF7HK+EceDnNzteIJLx OldXJwIBWH6Sew2XWr/zU6TfxGh78yChu3LWDTQo21Rfudf6vAmHvSLnO7DsmRgJEVFQ hb3v7FBJd7BF8vtfJm5GWHy0JXOaYOUdhvl9yOr9jxQox5WYR/Jf+5IaZi8khIp4j2BV O6t/Pzuw0AeJVGhF2Wh0G0FwmtsbiCEm4YzY597C1EjgE22Hbvlu3lUbUEdsqIx9iDL4 tjUQ== X-Forwarded-Encrypted: i=1; AJvYcCXGcc0SdM2pwa6dkKxPmUWgUTB5SrGoFlSo6sUzhZC83rlClM6XYrxIqSs0LnvrYYv5cErWaAowFA==@kvack.org X-Gm-Message-State: AOJu0YxWN7vJ4aV3r4gru6yImEq9BosFWXPxEFVuE+rOrD6eEbPZi2Zi HV4Ku0FcABOPNHhxhnKSlfUmo+8f0tazM38SpzxhrdiMIa4FeXD1 X-Google-Smtp-Source: AGHT+IEH9XhQHdJ/krX11vRGwX/SKR+QFZFrFWuZ6at1VFIQb07zwgJ8oLaGlbNm6uGocCe11GtgUA== X-Received: by 2002:a17:907:c14:b0:a99:7539:2458 with SMTP id a640c23a62f3a-a99b95ee9f8mr1035182466b.65.1728994103731; Tue, 15 Oct 2024 05:08:23 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9a297495easm63987566b.59.2024.10.15.05.08.22 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Oct 2024 05:08: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 , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 2/3] maple_tree: total is not changed for nomem_one case Date: Tue, 15 Oct 2024 12:07:45 +0000 Message-Id: <20241015120746.15850-3-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241015120746.15850-1-richard.weiyang@gmail.com> References: <20241015120746.15850-1-richard.weiyang@gmail.com> X-Stat-Signature: m9y31mchittcrpiimmpunhsggy6wyg34 X-Rspamd-Queue-Id: 777A81C000F X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1728994102-593453 X-HE-Meta: U2FsdGVkX1/aYovHLLtS6KjWWGr1cE9CvOuGWhaC1PTlwG0Xu+6mx1oeOR2xa9mP/5gFiBV1MmjVl/S2F4z9vReinZiJwlrBJEBJKXagSgsH7cEbZNsq+VJW99bQRKnuAxPBvYCH7tJql+kkw/oDbA17t/R5I0otSYEkIltstIjjdYv914rTk1UorzCTfQ5+KG1qGR5yp06W57tPREGdgRFUSzQrMVtTOm7HRvEfCI7+SM/P0DrdK8HcKElk67yYRSLBrh6VftIw2ZB+1iicqv+NSfmdhIK6y1iPYpwxgD7AacSj33Fdo6NxiXJj/nz2jndxd06qogvh1BW0wlQshTN2XfKl8ZX0y2WQFHPr/lK3zciohqnt8VpZeQ0boN09/Dm1WSQ6JeLIICsWWzd6zvm/x+M5HMtRA+TXV3u7GODkeodffzEWO6x6HIUKHhBmbTgf9163cmhl6l57ufsPwK+nsQba0hJG7VZ32QdQN/37DHoWSSMK0rj7p1TRMtXjFR6CvWWA3mpf/a3148C6jRwR+z/F6X5MiKh2GykhLeGYDFxkMsje96+NHLDvpSipHss7+qqVN4iAAwDE4DlcrJP5rxNB10BeMoIp3BwB3Plxm1B+eiN0hJfakR2lIaDQoC89QTZTMyP8S6rhCJ6z2nKGrXu9ede6UiDs/NwHg/0D39Xx7AylS/Y3BhERVsrHIcgPNDfhl2mNZsBVkWg8aV33hQpDI2hI3TREvSNYaHRVP1qT/uDYa64h3Z5gySWoZj+p4JxF0jgNArHNr/HfvKaoHePnoAF4fRoT0Hx29TZ+QnUTVMqw/IF5oldfHHAf15yLlYwrSh/qfH9NZrAOvNgagK8fPVoQt57DuecHzONaPCIwmHKxAZJHkF4P5GhbotEq63PhJRgELjGX0nTesiuOxw7zSt1hOmXYeKTv+rVVI8GKJr4f88AjdnpcC/G+u8BjwON0Ehx5O7zSlHo raSI3F1f wFgURHDWK9GtGl3Oidm1yRDs8cCVUz6yPDeqaqEQA6zIj/eeamoU04SP8KEVxDaRITiigUd6Fl00gc+XyqMAUiJhkTVgMmIKd56gkTBmNDaOA9JK9z1s5/0uVXrJZ8C0tV30LDGRWiQHoJCIGy2KVI6LUa6unaejQiX1ARZADl0s6x3XNZpNW3q8L9DrLY9dlFSP+ndlcgP326T/FFTZh0z9lYBiNvVChkpAWVzSTEjYBs7Gffod5HMnFTXV7WzB4cwOlggVpzyOGt/2iHMzUfKzzDt5REAhh/Jzv5R/TwfpK+aNCSyndk7ZZTBxEKGVuAi5UmoOx3kmlK/oFkavmH16EFEB9cjH9AcT94FmG3L6pgAdq5zPtTOK2UUmRXOLCNoCxlUW5OotahZi1Qm/IqVBYwhWkhVnlCYOHw0HkavLSgk0AfuFYGiro8TqKqqJYbQfwvDOtYSTxyR5R3Wd2HxsQKDRg/E2A0oXP+TufV5e2+lQOSSLQCqi2oDhdHVAFS+Mv X-Bogosity: Ham, tests=bogofilter, spamicity=0.000124, 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 it jumps to nomem_one, the total allocated number is not changed. So we don't need to adjust it. For the nomem_bulk case, we know there is a valid mas->alloc. So we don't need to do the check. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes Reviewed-by: Liam R. Howlett --- lib/maple_tree.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index 31899e853c1e..ab398461754b 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1279,10 +1279,9 @@ static inline void mas_alloc_nodes(struct ma_state *mas, gfp_t gfp) nomem_bulk: /* Clean up potential freed allocations on bulk failure */ memset(slots, 0, max_req * sizeof(unsigned long)); + mas->alloc->total = allocated; nomem_one: mas_set_alloc_req(mas, requested); - if (mas->alloc && !(((unsigned long)mas->alloc & 0x1))) - mas->alloc->total = allocated; mas_set_err(mas, -ENOMEM); } From patchwork Tue Oct 15 12:07:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yang X-Patchwork-Id: 13836274 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 61B24CFC29A for ; Tue, 15 Oct 2024 12:08:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D2F5A6B0093; Tue, 15 Oct 2024 08:08:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C91116B0095; Tue, 15 Oct 2024 08:08:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE45E6B0096; Tue, 15 Oct 2024 08:08:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8806E6B0093 for ; Tue, 15 Oct 2024 08:08:29 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 25DBE1201A7 for ; Tue, 15 Oct 2024 12:08:21 +0000 (UTC) X-FDA: 82675714128.22.30CFC0E Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by imf22.hostedemail.com (Postfix) with ESMTP id 82533C0016 for ; Tue, 15 Oct 2024 12:08:18 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="jvKxZl/z"; spf=pass (imf22.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=1728993917; 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=s82n18uX65YlaY3Zrmh/b7hAZA3lY4DlogWu8YT9Tdw=; b=3Ko24cGKZKpMVdzu2cCTSGn1Inzp3mScQ0id7jBWsOFFCHd1pvanXFlaGwRgGUEu9GgtZK tADuTPSq8qvUpQCKntUchGi4UTiFteQLwHQXYrFiYXWUDz5d1eKMYZAFKvkb6jdUhwnSzW cA00Bviy0wiLMgmMWp0CPsGmlxGdC4A= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="jvKxZl/z"; spf=pass (imf22.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=1728993917; a=rsa-sha256; cv=none; b=k9gpp6GuxQOTc9jmSurydsom8w5Ehm5LPTC5X3fh6eIwSEZDH9C9CoshmYFm3sRwgOvS7g 5praj1djxNLIDLUJXswCcxx296OwX3TUoIBaLj6WtogBbFPkD/XR7Lqfyy20jxSCL5sGJO yDruOBJgmFE+kbl3la6YdS1uEVMv3bc= Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-5c9362c26d8so9000655a12.1 for ; Tue, 15 Oct 2024 05:08:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728994106; x=1729598906; 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=s82n18uX65YlaY3Zrmh/b7hAZA3lY4DlogWu8YT9Tdw=; b=jvKxZl/zhlOBVG2e3UxM1ABcsO6i5a3drRCNIXjQCDdoyuCknxdtsmyEPE4o3hN67C HkLa6EbVpckk0RftLFK3juzBCFVHYqmzCJKjdPsADgm5FNdtA3Jd9fyo+FLXMfNmLD0o fJRcedLurKl38ThJs6gNQWWile7iG2HpUD23Orxku03OCPUB4q76E01oCjsqulmeNJUQ ekA7a+IBo7pcT+6+mkWpMnKtbE4CjtSvk2MIsX/cM+p0OOfjNEmJlYea8SvnskTR9Pvi S9e0evOBoKOCmxLltuXRtGrI6raGLgIXKnVdy80sKNCk16cdWeLObx5x8eQyPbZjSzUy Qj/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728994106; x=1729598906; 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=s82n18uX65YlaY3Zrmh/b7hAZA3lY4DlogWu8YT9Tdw=; b=kiWD5Qk2o0SBjJgPJVDgWfuYk+APN5RY9zazv6K2yjgY/glfh0Md+ht7SUwjWkHwet 2NJRY7sSVwJjZmiKhU02Q4OPKDCPx80vTEco9Hwf8fVarBv5/OaB/h16UIogxPf+P0dd R1q9qPuO6a5EoSGWwKe2IvHwWCSgvENCrXOmwAkrI+hogyraijk3DXhGWHHJ1Qqzi0yN d1Jp/fi9Dph27pEeRb9Nl3yxbSbxguSeo2J7CGWjTEQjo7eMzHIvI0ZMrsbnPMOj0Ggo Kf2LPFgb5ip3DYK7ROhgBxU4+ygJCNtHOJ0miBeJrn1t9TdzdVyFUDm2dxcxE/bHPIvY tT+w== X-Forwarded-Encrypted: i=1; AJvYcCXzSTUfLFwEnj0xZFtTazW9+lzox5fIdTR/gfKT9I2QDS+R0ac9KZY8Rv57gLt6nUjk8Ty51/7LFw==@kvack.org X-Gm-Message-State: AOJu0Yz5UPBdRW/TA9wHmkgT7+o6qS3ahIMRJXwKmCwNgwZXQ8ug/Fiz jt5o0I/ClzRKXmDWu5hVTDIsvYEXmzKfMZhSWz4/tmsAVgxOgKROMv9/7T6a X-Google-Smtp-Source: AGHT+IGD9AawcnG2BwKUXycWqcPDeiYkbxKsmoFPiyXS4a5xjMBfbVjb6zXO8qRfR8Ogu3FKl5575Q== X-Received: by 2002:a05:6402:2690:b0:5c9:6c7:8b56 with SMTP id 4fb4d7f45d1cf-5c994817c03mr271257a12.7.1728994105550; Tue, 15 Oct 2024 05:08:25 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c98d4f9519sm631237a12.30.2024.10.15.05.08.24 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 Oct 2024 05:08:24 -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 , "Liam R . Howlett" , Sidhartha Kumar , Lorenzo Stoakes Subject: [PATCH v2 3/3] maple_tree: simplify mas_push_node() Date: Tue, 15 Oct 2024 12:07:46 +0000 Message-Id: <20241015120746.15850-4-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20241015120746.15850-1-richard.weiyang@gmail.com> References: <20241015120746.15850-1-richard.weiyang@gmail.com> X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 82533C0016 X-Stat-Signature: 9yqu9rxm7jtwpwm7pwzzhpew1mc3mq9x X-Rspam-User: X-HE-Tag: 1728994098-940579 X-HE-Meta: U2FsdGVkX1+TyXw5wPYg/eqGQ3P7LOupeyKUcMirhOTVUJ3oxoXrNnKpuKbdgnMVVtexqwgQEUsgv+J7g5m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NYzT7xjYLPRhgkwShGst1QGboQUHvKz1E0ZiFJ1ASgmjzg2cFFrra6iVPBshCXA14zHnYRgsFFzIINT0PAdtUKSSh+AUAYUhcvwuIpDudtmy6nsYwtQnM1oGqHCFSe4x3qq0i82qvdz4EIer52POlU56HSHQ01htwPgaQN6VnBNsQ1GE/DOdBa85I2B47qqiIheeYeZyOdQeQf3kRoIEIp8CNTzXK77vIECS+0zp0qsFkHu4Ow6kiIlGbHySpBslh/QBISYd1aldSrhbVkjtZsDRELtVazzAAOqImK1bPU69+RuAsLbsJl84qd0ZSI2R9FrbPnHGA22M2A8pBbT9uJ0VUgqyag55Rfc X-Bogosity: Ham, tests=bogofilter, spamicity=0.000044, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: When count is not 0, we know head is valid. So we can put the assignment in if (count) instead of checking the head pointer again. Also count represents current total, we can assign the new total by increasing the count by one. Signed-off-by: Wei Yang CC: Liam R. Howlett CC: Sidhartha Kumar CC: Lorenzo Stoakes Reviewed-by: Liam R. Howlett --- v2: refine the change log --- lib/maple_tree.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/maple_tree.c b/lib/maple_tree.c index ab398461754b..afb59bb6a641 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -1192,19 +1192,17 @@ static inline void mas_push_node(struct ma_state *mas, struct maple_node *used) reuse->request_count = 0; reuse->node_count = 0; - if (count && (head->node_count < MAPLE_ALLOC_SLOTS)) { - head->slot[head->node_count++] = reuse; - head->total++; - goto done; - } - - reuse->total = 1; - if ((head) && !((unsigned long)head & 0x1)) { + if (count) { + if (head->node_count < MAPLE_ALLOC_SLOTS) { + head->slot[head->node_count++] = reuse; + head->total++; + goto done; + } reuse->slot[0] = head; reuse->node_count = 1; - reuse->total += head->total; } + reuse->total = count + 1; mas->alloc = reuse; done: if (requested > 1)