From mboxrd@z Thu Jan 1 00:00:00 1970 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 59F22C4332F for ; Tue, 12 Dec 2023 20:58:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E29826B03A4; Tue, 12 Dec 2023 15:57:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DD91C6B03A5; Tue, 12 Dec 2023 15:57:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C79926B03A6; Tue, 12 Dec 2023 15:57:59 -0500 (EST) 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 B49F56B03A4 for ; Tue, 12 Dec 2023 15:57:59 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 7F01680616 for ; Tue, 12 Dec 2023 20:57:59 +0000 (UTC) X-FDA: 81559378278.11.E5540D6 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf30.hostedemail.com (Postfix) with ESMTP id 3F07780019 for ; Tue, 12 Dec 2023 20:57:56 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=JCJxZjqq; dmarc=none; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1702414677; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=uITo0Guj0fvGl1HiaxKOp67qOA6E5V8qn2kdwMvT6sI=; b=GUaDvK8ULO5O6CRxv9taYVr6UTjd/D6AUJeUerljMMHIW0XRUC0gLP07LUSwZxriJE8phF uXg85dipcZ1HrlU1Qh5IOS9JgP4yXKYCB/N84mmNZiLK000uaEPbagoYiX0R347ivrOxhI lFk8oxiJkvysBtSvFAVaxcuQns4KkB0= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=JCJxZjqq; dmarc=none; spf=none (imf30.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1702414677; a=rsa-sha256; cv=none; b=ykTcdJYwV+KLFIannlDoVj/LxDU4XbCavXfKJbpqJ/xQM5JebnOLQd6fiNMOCc60OsQ9P4 1Lh0xSPe5VniEgwQBjV5Bz7sfJC3RibxllsNaQ5he9dCkvkkjRp041j4ox0DRLoUnaZGS4 3mq2alCHmBerTcEsuXhfimUwgB6kLjg= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uITo0Guj0fvGl1HiaxKOp67qOA6E5V8qn2kdwMvT6sI=; b=JCJxZjqqjUowDP4pNyoBpmBOIu ECYAvUk8kQTATukZso13qhi/8JOSGmjS5263QfDm47xDoR8+6LXRDgQz3kFVVh+YiGHCAfbLje9JY rNp0AE1M6F0GfSYqxtQTxOofQhn4XNw8AvV8JGV0bBko4bNyRNAQK9VBBOGJ9BFZp+nsOizGm608f 1xi5KupnhwRLgwKKSGqJsM3mVamf3OTQWtdtbt8Rm3n87urVek7fuPLFbDXZ2BLqv+n406P4XmOz1 t65/177xyXmgwjnF3wkOdOK/ba/g2oMP7HwzDLdy0p3dhJmx0gaHKUIlja6YLej+S8jFgFM4xa5C/ bxON2U3w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1rD9p6-00BBis-OI; Tue, 12 Dec 2023 20:57:48 +0000 Date: Tue, 12 Dec 2023 20:57:48 +0000 From: Matthew Wilcox To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, maple-tree@lists.infradead.org, akpm@linux-foundation.org, liam.howlett@oracle.com, zhangpeng.00@bytedance.com Subject: Re: [PATCH] maple_tree: do not preallocate nodes for slot stores Message-ID: References: <20231212194640.217966-1-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231212194640.217966-1-sidhartha.kumar@oracle.com> X-Rspamd-Queue-Id: 3F07780019 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: 1w5xqk6wxfgfc3kxmfoyetu3ztch4n8a X-HE-Tag: 1702414676-139253 X-HE-Meta: U2FsdGVkX1/IygdNR0aNmzbv4sL/m8c5ceq0d+5L6rez2oiQ8aVqmM5SKSixkKAGGut6o05cJk3i6VCyC2ivhImLBiY+e130aO9PmbbQDtxZ1Pis3WCCAbb2fTLsHR198oJV1XWymCHtrZqqjkEsBxz+ntmMOo5pRkFATOrwwuaJeN7QVGZfZbH2FdyN1g5yhNfnHW/8oj6mFsExqPVMnMbP9pGuHR4/RoLcs7dHYy6Mjye05wI+cpLftInaCxHn02AhkVwFof2v9GDYyKMfBfYrI4hW03cQsUQjhPHufJRKtnuxIvMTYtzt5xFvTc1RsmFBQYazXNB+6jYnTv8vk7gXwFA+dBIom8CWUAOR+GyvfxjHQxMPI0iKLDjuwoEnuWv3Q89aayiJ1dXTItn5EQzmGcr9wu+qAVkSxsAVkvsy09AEz1rHbAo6B60B/PiDBa6W8XWSb7dYflY38vze82dOPblRcs9As9visSUQyuaxhf5ppt4VnWG6G8tCISMmgqE63I/g9HVvaUQFbIaMLyqzHYAiSMgni8J6a52cGHkkFlRcwsEoe+9PIXGgVw6rovaGdqNnSWfyI5zlyb3cxrWD9r5snWIDpeUADII3qx7ZMtBSDn5GbiiiJLNFaoIIte2gP82IrECv7hqUGqTIGc/iEN0nrslUoJxaFYTLrtuqEA0d4iGR1ddtDV5YhIgt0RJc7fjlp4TfFi2xNXou/oqI7sHsC7tiODvqbI9edGwPdVQxJqtphSzjiy8CC+gNJBz+BZXPZ2OXAdXqkk4Xfjx05mki3ygDmD2KkGz2EHNb2Ekb/Qa/MWle4ddlz+fRoo1VE1oRfGmISy1NbUi+MMnkMlIah3gICFGCTDwM6ay+qNDDnFayii6xsv41O2clHFzdNH5BKGob2Q2dNom0jLLTg9x+sToSjtyp9HHMGSLfGSLJ0+NgKZ7dIodyJIHuQERqD/mGkIGo6rYIFEe qrcdXUIY TzmTxfhKy2PH1RZ+CHzcfIaWb5vjYUsoMIpK80niWEIs73bDvpK/9bPJpLU5hTrj4xG+D0mCGyXde0qGvOdJ2dxu3SDph73iDQmn43h3J1TSsZvB997PrT6vyPMAUzdOLgnOmAA5jvAxOBY3uyIMgr0OwDbJxFHT0sce0umYJSc+UKUunSNXyZdbdjw== 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: On Tue, Dec 12, 2023 at 11:46:40AM -0800, Sidhartha Kumar wrote: > + /* Slot store, does not require additional nodes */ > + if ((node_size == mas->end) && ((!mt_in_rcu(mas->tree)) > + || (wr_mas.offset_end - mas->offset == 1))) > + return 0; Should we refactor this into a mas_is_slot_store() predicate? A few coding-style problems with it as it's currently written: 1. The indentation on the second line is wrong. It makes the continuation of the condition look like part of the statement. Use extra whitespace to indent. eg: if ((node_size == mas->end) && ((!mt_in_rcu(mas->tree)) || (wr_mas.offset_end - mas->offset == 1))) return 0; 2. The operator goes last on the line, not at the beginning of the continuation line. ie: if ((node_size == mas->end) && ((!mt_in_rcu(mas->tree)) || (wr_mas.offset_end - mas->offset == 1))) return 0; 3. You don't need parens around the !mt_in_rcu(mas->tree). There's no ambiguity to solve here: if ((node_size == mas->end) && (!mt_in_rcu(mas->tree) || (wr_mas.offset_end - mas->offset == 1))) return 0; But I'd write it as: if ((node_size == mas->end) && (!mt_in_rcu(mas->tree) || (wr_mas.offset_end - mas->offset == 1))) return 0; because then the whitespace matches how you're supposed to parse the condition, and so the next person to read this code will have an easier time of it.