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 CCFA8EE57DC for ; Wed, 11 Sep 2024 23:15:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 387FA6B00BE; Wed, 11 Sep 2024 19:15:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3389F6B00BF; Wed, 11 Sep 2024 19:15:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D7EF6B00C0; Wed, 11 Sep 2024 19:15:07 -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 F38186B00BE for ; Wed, 11 Sep 2024 19:15:06 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9520980EDB for ; Wed, 11 Sep 2024 23:15:06 +0000 (UTC) X-FDA: 82554015012.15.2FDB58D Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf17.hostedemail.com (Postfix) with ESMTP id 8F32040009 for ; Wed, 11 Sep 2024 23:15:04 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TVZmOL6i; spf=pass (imf17.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.47 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=1726096400; h=from:from:sender:reply-to: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=P7OaucElaBJTRTq+ZY54RGJMBEhN0L4ZY4Z4M1BgLJ4=; b=idTF1G0iONj6l6+CxSTlXCZlvcOZF1Nip7UJ50WUY94eHSsMXJq0PR0pd5NtFyNGxTWqar aZwjeAsRBbhJr9zat1LfUojVJChrksTH+k6Jfj3ZmTwscvbw9o+4293491abDTQh4oH//D f1KJ/NSyZmvKxf4MTBuj/Nz98HG6Mb0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726096400; a=rsa-sha256; cv=none; b=1gGdQmY6iWx0S3WDvat2LafLm+aN7PNyaHleyjO5T7dhSBzR0b7WhkbSGrLNUsholif9oo KVRmYrGjIvJi9fJ7SHgBW+luqiP9gSVl6ltH6RDQ2FNmNnyI46NOy16V7UiCheIWrbaabI 592EzaxahsMwFBI+gPUh4u2g5DmT65I= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=TVZmOL6i; spf=pass (imf17.hostedemail.com: domain of richard.weiyang@gmail.com designates 209.85.218.47 as permitted sender) smtp.mailfrom=richard.weiyang@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f47.google.com with SMTP id a640c23a62f3a-a8d0d0aea3cso42787366b.3 for ; Wed, 11 Sep 2024 16:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726096503; x=1726701303; darn=kvack.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=P7OaucElaBJTRTq+ZY54RGJMBEhN0L4ZY4Z4M1BgLJ4=; b=TVZmOL6ikswX0SP/5FKOur0RCoSg4PjirAjyQsiEUcEF4Vg08Lksbd26Dp+fW0BcXG 5Q0I81bxYGnRsTB+jOMIqowBLxisGWVQ9RLi64vlCmMGT2cc5KaENp8yc5kNSjecrX6f kkWmxSO6ZXQqhIyC0XZk3+brBNdvFU3hGfjFpPYs4cHBikVwrE6jwgZSTuGop3Z+eXpE lE67icVyhCrbJ6lJh6WVKfvKIeVrZT537wjBgxVx/shua2oPkzusdVg0pnTowUfRHPRl HV1zuWDLwLbyJaczccSFGMpZyJmWHjRN9MHJgO9xsII4FdD+vjue561CPNoj9d0BMWGS YnSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726096503; x=1726701303; h=user-agent:in-reply-to:content-disposition:mime-version:references :reply-to:message-id:subject:cc:to:from:date:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=P7OaucElaBJTRTq+ZY54RGJMBEhN0L4ZY4Z4M1BgLJ4=; b=Rc8Ynz0PpulwKMS1KCiZ/ttqwgvOAttuHwXYBVl6wITRN7dmxUkHCV0CoeqZNppJJA PL/4pVWHJM0fM8aVMMB82ScB3StblZogGpKz27+QftQSZYBEkdlmFXs7rUl51JeKr0x8 OFBH4PEvzd1IvjbblkHOh53sC8pMgh5ecSUttj99ivv4HI41WbnO6VkM7m4k7qy1TD29 eEf9wHQ6z1McMcYLYengfP1lKEYJVCvlN7o0brelom5nvesVStPVcsMWgZCOm3yOLIl1 ZFooAgoGcJLdZROiIh6eV1ChRKAURuYKAkcxr8GN0inQ81q2xICTVVkGg8SJYIxCRPRD gjWA== X-Forwarded-Encrypted: i=1; AJvYcCXGIml/2ugy37/TmNezuq1kGKqLMtFuNeujmjY69vYx3xFuaswCP52E1OPzCApFkDBNpTkg56iV0Q==@kvack.org X-Gm-Message-State: AOJu0YzHmjbzLzhx9WyhLK2ysS43MAxUFxGNjYYBq7pojrJ1xrmghgFk tuQN0RLPU4eGaRgCr9DoggkJ3piOzlEZehAsgBUmPz0aw0sWZmDk X-Google-Smtp-Source: AGHT+IFx+po9y1E+ZYtXYnjDIAQKG9xcmb0i1wKw94+Y6LLEDjZOWHemezkQTS8cRRO306ieUEnxuA== X-Received: by 2002:a17:907:c1e:b0:a8a:3e73:3316 with SMTP id a640c23a62f3a-a90296783a0mr73826266b.65.1726096502622; Wed, 11 Sep 2024 16:15:02 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d3b47d270sm605195666b.47.2024.09.11.16.15.01 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 11 Sep 2024 16:15:02 -0700 (PDT) Date: Wed, 11 Sep 2024 23:15:01 +0000 From: Wei Yang To: Wei Yang Cc: "Liam R. Howlett" , akpm@linux-foundation.org, maple-tree@lists.infradead.org, linux-mm@kvack.org Subject: Re: [PATCH 1/3] maple_tree: use ma_data_end() in mas_data_end() Message-ID: <20240911231501.vaozsue6viqkyxmp@master> Reply-To: Wei Yang References: <20240831001053.4751-1-richard.weiyang@gmail.com> <20240904001525.5zshbivv7op4ana7@master> <20240904075819.5vgnelkxxj7myyn4@master> <20240904145305.dq7jolrwd6fp6dmf@master> <7lu4ere4h3lmpwxwgyhlymk25bxj3iqisjdzcsyymcxmo74dev@sv76tlhchbee> <20240906034410.zzs4n2acrgkneekr@master> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240906034410.zzs4n2acrgkneekr@master> User-Agent: NeoMutt/20170113 (1.7.2) X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 8F32040009 X-Stat-Signature: js8rg6ys7wt9383u7uafozn8sfs5qrt9 X-HE-Tag: 1726096504-763229 X-HE-Meta: U2FsdGVkX1/lIe3c7Vk2jGg9ELMfUz1PIg6XJbwGHJBS89W7Rk0YHsQ7Ems0UmgRA4memAV6BB+1XFyL0jaI708U011RmBDDb1PcacddSjXMWAtcA24Ff+q0G3ZVMrQDtsiwR3kSCaf4suJLskc/SbxkgWkXPDnMs7ojjjBY0D8M5EsUux50rtHzb/HinJSiq0QV1T19xx/Jthp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aQHYJglIXD2M8wRCGBncObGrAKKz1ZfweNWccFnOKWZi9ZJ2iz7mN/m4U7Hy5rkaioVik8CxP18L4MGZ43oLtGT1yk5m9kJIr2Z96OYQ9DtoIAXB72ntNt2UvaOAb2dmvyNDuLAnZ9DR7/aoJ8KdfI8DSpKPuRs4tpe8pCh0vVtq1x7mAdNNDQVS4GI7j5JOjJGsb83pcqj0eiPTX/4nao4uTwiQKiJon2vvyLSTmzWAQUPlfBhDTMr+emRJvh2Bjip9QIr0Khk4018/Qa23UXMfP2ypM1ukRX9OZW3+F2MIRolWx4mezgeSWn1ZLVBtshjqmH8fUJGykblcMkHvD32F+CRvJEU3fpXo1Ra0sIN+t3KEtDqQ1kwSMWkrHDZHPfWIpsxYuJw/JI8Tlb/TSlOKiy9eNozD7 X-Bogosity: Ham, tests=bogofilter, spamicity=0.045895, 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 Fri, Sep 06, 2024 at 03:44:10AM +0000, Wei Yang wrote: >On Thu, Sep 05, 2024 at 04:13:15PM -0400, Liam R. Howlett wrote: >>* Wei Yang [240904 10:53]: >>> On Wed, Sep 04, 2024 at 07:58:19AM +0000, Wei Yang wrote: >>> [...] >>> >>It is only changing code for the sake of changing code. And it looks >>> >>like it will be slower, or the same speed if we are lucky. I have to >>> >>take time to verify things aren't slower or add subtle issues (maybe an >>> >>RCU race) because the code looked similar. It's just not worth it. >>> >> >>> > >>> >I am trying to make the code more easy to read, but seems not helping. >>> > >>> >BTW, I found in mas_update_gap(), if (p_gap != max_gap), we would access >>> >the first parent, parent's type and its gap twice. Once in mas_update_gap() >>> >and once in mas_parent_gap(). >>> > >>> >Do you think it worth a change to reduce one? >>> > >>> >>> Liam, >>> >>> I am trying to understand what kind code change you don't like. >> >>Any change that cleans things up and verifies the performance would be >>acceptable, but your previous changes didn't do that so the burden is on >>me to verify that your code isn't going to cause a regression. >> > >Thanks for your reply. It contains much information which I am trying to >digest. If I misunderstand, please let me know. > >>> >>> Is the following change worth? >> >>Not like it is right now, but this is worth fixing. >> >>Test using the tools/test/radix-tree/maple.c Look in that file for >>BENCH defines at the top, and examples of the benchmarking. >> > >I guess I could run them by comment out those #define at the beginning of >lib/test_maple_tree.c? > >I have comment out one of it, what I get is: > > TEST STARTING > > maple_tree: 80000597 of 80000597 tests passed > >My question is how we leverage this test case? From the output itself >I just see all passed, but I am not sure it breaks the benchmark or not. > >>Before you submit anything, run the testing to make sure it all passes. >> > >Yes, I make and run ./maple for each change. > >>If you are changing anything for cleanup/optimisation, then write a >>benchmark that will test the runtime, add that before your change and >>run it in both before/after with the results. >> > >I guess is to add a #define BENCH_XXX with related function and call it in >maple_tree_seed(), right? > >>Look also into the perf tool to see what is going on and where your time >>is spent, then you can avoid optimising something that's not worth >>optimising. >> > >This is use the perf tool on the new added benchmark test? > >I am lack of the experience of perf tool. I may need to spend some time to use >it. Usually we begin with 'perf record ./maple', right? > Liam, If you have some time, would you mind telling me the correct way to use the benchmark? So that I can do the correct verification as you expected. -- Wei Yang Help you, Help me