From patchwork Wed Oct 9 15:20:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sid Kumar X-Patchwork-Id: 13828638 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 43060CEDDA3 for ; Wed, 9 Oct 2024 15:20:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 722326B0095; Wed, 9 Oct 2024 11:20:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D1D76B00C4; Wed, 9 Oct 2024 11:20:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C0D76B00C5; Wed, 9 Oct 2024 11:20:32 -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 398886B0095 for ; Wed, 9 Oct 2024 11:20:32 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id EFC311A178C for ; Wed, 9 Oct 2024 15:20:27 +0000 (UTC) X-FDA: 82654425462.11.D434C07 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf29.hostedemail.com (Postfix) with ESMTP id 150DB120018 for ; Wed, 9 Oct 2024 15:20:29 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=awaWthG+; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf29.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728487119; a=rsa-sha256; cv=none; b=Bj4bEdaKLy5NhjOAbIOKLlofU/KOIMyK3ATDRao+6TJUkS0dI4kkHGIhRPZcvcucwHl3KX 7MrG1Tt0kvAe8B9EmXuxJyBY+n28cxgZwjgrp5JFJncJH9NGNh4QIA3rTF02O6ivV2LEVy vUfAUG9T3vAy9uOSRF/iPNG6obTLUTE= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=awaWthG+; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf29.hostedemail.com: domain of sidhartha.kumar@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=sidhartha.kumar@oracle.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728487119; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=HlHl6ChjHbnuvgtCTGs0ivDwGXG0cXdbfUONSFCyc5Q=; b=oxeCgDF2ebU1IYizrH14i1xWAZeZimm1tTwS8P9KwcQoSxMsw7lYYZ3RdsT1yQHnEaDR0V /z1bCKu9H1o9vhf5S2InWsDdV9OT2gRPigNCDF4proB2el6tkT/kaO1ELfW+1xMiWALH3M 21PUb1T6K8aUVMSNsqmzSIxZ2GovQWk= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 499Eu9H6015997; Wed, 9 Oct 2024 15:20:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:date:from:message-id:mime-version :subject:to; s=corp-2023-11-20; bh=HlHl6ChjHbnuvgtCTGs0ivDwGXG0c XdbfUONSFCyc5Q=; b=awaWthG+OdkEZPf7DFC/4l36q9PN+ufdPc7Onl4d9X0wh RZxXMW3LQC5cRnKVJ2gY0py60cEW/Mr//DQ7n8t+eAcUCNAAq/zna8Wu5lPOexP+ hNQrkTgYtHP4LXq0PeTvMBPylgTeHvf1Pc7Csr8j/QcDK8CMZ9QsImqsTl9yUSgG BVI07eg2aE5kKbYVmA7gcoiRGqFxd+o3VMYdNTx9LJ1Ypj+SmEnpaV6/FQXO2PdS lVAsayf5t5atJ3XJPPyKx1Xc7kkZbhKVAxF1143XqjYKRvehcrH+jj1EydcdVOnQ 2A3IpdNBPGTlwx4Jo/ddhC3NPPaedYti6p+/68vjw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42300e0n2j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Oct 2024 15:20:14 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 499E1CA3015276; Wed, 9 Oct 2024 15:20:13 GMT Received: from pps.reinject (localhost [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 422uw8rb4h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 09 Oct 2024 15:20:13 +0000 Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 499FKCC1001460; Wed, 9 Oct 2024 15:20:12 GMT Received: from sidkumar-mac.us.oracle.com (dhcp-10-39-198-16.vpn.oracle.com [10.39.198.16]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTP id 422uw8rb23-1; Wed, 09 Oct 2024 15:20:11 +0000 From: Sidhartha Kumar To: linux-kernel@vger.kernel.org, maple-tree@lists.infradead.org Cc: linux-mm@kvack.org, akpm@linux-foundation.org, liam.howlett@oracle.com, willy@infradead.org, richard.weiyang@gmail.com, Sidhartha Subject: [PATCH] maple_tree: remove conditionals to detect wr_node_store Date: Wed, 9 Oct 2024 11:20:07 -0400 Message-ID: <20241009152007.2096-1-sidhartha.kumar@oracle.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-09_14,2024-10-09_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 phishscore=0 mlxscore=0 suspectscore=0 bulkscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410090095 X-Proofpoint-GUID: NyHvPBSqz9i1BDNvvD4hoG0zoFxVMeUa X-Proofpoint-ORIG-GUID: NyHvPBSqz9i1BDNvvD4hoG0zoFxVMeUa X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 150DB120018 X-Stat-Signature: ehfyn9zn9se9eu356ys7erjyit88nc69 X-Rspam-User: X-HE-Tag: 1728487229-602927 X-HE-Meta: U2FsdGVkX1/gto48H9BMj/z91JAUKnsQwm9Nebof9BtZIULIm/S9OHT/vtvVJkJ33pG68Vcp4Pk0laPG347DIuqfRXiPAyOEo/qANIFufkPKOArRx47ZGNx9mZl3EC4Taug/upr+CoaUQvhyz0fn+aBtT6f70VOnrXm5IOSN8YCadfVSLTrssKCc0znbi2kLuYruMGV/GERS/5cAY9+4CqySUPk5cXoIofvu/pr/RC+zth0af0O//CzTMqaJeX0MkU97jnPw4kg26Wu8PFC+UNFkColmkrz6b/wxfRdKnLj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ogofilter, 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: From: Sidhartha In mas_wr_store_type(), we check if new_end < mt_slots[wr_mas->type]. If this check fails, we know that ,after this, new_end is >= mt_min_slots. Checking this again when we detect a wr_node_store later in the function is reduntant. Because this check is part of an OR statement, the statement will always evaluate to true, therefore we can just get rid of it. Suggested-by; Wei Yang Signed-off-by: Sidhartha Kumar --- 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 4b423330d83c..f5a12d37b352 100644 --- a/lib/maple_tree.c +++ b/lib/maple_tree.c @@ -4252,14 +4252,7 @@ static inline void mas_wr_store_type(struct ma_wr_state *wr_mas) return; } - if (mte_is_root(mas->node) || (new_end >= mt_min_slots[wr_mas->type]) || - (mas->mas_flags & MA_STATE_BULK)) { - mas->store_type = wr_node_store; - return; - } - - mas->store_type = wr_invalid; - MAS_WARN_ON(mas, 1); + mas->store_type = wr_node_store; } /**