Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp115387rdh; Mon, 30 Oct 2023 16:02:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE9/BHyu06hzxePE2REKCfxVZzyFS11+FXKsvkVNS+Wew5T2MwXBztHpoO9Hq2tBrfYVVVO X-Received: by 2002:a17:902:d502:b0:1cc:924:e0b5 with SMTP id b2-20020a170902d50200b001cc0924e0b5mr10115134plg.50.1698706948716; Mon, 30 Oct 2023 16:02:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698706948; cv=none; d=google.com; s=arc-20160816; b=JLqSDbL2HOPQJmoaFYBmdLsIvlw0utefCNg2wAkWcfBHEOy1eBSEske/AkRyuZ3TRn VFsHMcD7hHejjmDT70//cXMk1Nm3pMBrxgdpu0n4DANtD/C094nOOMML+/TL1GJCCdBy IMeVmrqcrM1569++GIMQxzaCjH3kBagAagZUwLzzpLjk+cH3SzoGYTlRB86e7wIsAo7s YMw/9L3zmwL7Z3UnNePYQqUK4rrhmdiXRKVxVlWY7OqBo9i5h9ZZHOLTBVul2B76PtNo q8mFsGU0YOW1b0YmIAnhluot6UEdIqeeY2Uc+KyhbGs486pzesk+2MYKMUTO79KbYUx6 TNBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=8SC4KqwkBKXYWEMzT9ecbst7jHDUDYIv9zgc2NQp0cI=; fh=DLCYOhG5zRcBW1Cp1txuzsrnLFUce6lRkmUVu0e8M04=; b=IaUbSd5e4jzMORs/zOPkncNzXsCIi5S0K9Lu5UBaUzQkK+STEDueiRgQCL0elpQVZL M2QDXMAszzUedrbZkXSzpMfaYZLPUly7YG9Qu+7Vo4owzhN1UJPhT4WBF2UjGRR0P489 hi6acEe4UbgtJTj5Ucv+ozWvrdgPU8wKKudPbIewCRIjOTJDwsF9u0rzhknICPRGL7SD 5KPsw1UFT4pRLOWpDJ8paEb/edvbCAS808NJLyqu0wR1o9ugtoTjytq/XRB3oHqtYnRw p2cD6pI7IgX8d0pX3uzVLe4Ef2syCP1AqvLSgE2tQfmXF2BrTrZcbo6gaEQYS5qZQnQ/ aemQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id lo8-20020a170903434800b001ca7308e442si61615plb.639.2023.10.30.16.02.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 16:02:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 9DC7E8073DD3; Mon, 30 Oct 2023 16:02:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231205AbjJ3W4D (ORCPT + 99 others); Mon, 30 Oct 2023 18:56:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230472AbjJ3W4C (ORCPT ); Mon, 30 Oct 2023 18:56:02 -0400 Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9CDA6E4 for ; Mon, 30 Oct 2023 15:55:54 -0700 (PDT) X-AuditID: a67dfc5b-d6dff70000001748-81-654034790898 Date: Tue, 31 Oct 2023 07:55:48 +0900 From: Byungchul Park To: Dave Hansen Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, akpm@linux-foundation.org, ying.huang@intel.com, namit@vmware.com, xhao@linux.alibaba.com, mgorman@techsingularity.net, hughd@google.com, willy@infradead.org, david@redhat.com, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com Subject: Re: [v3 0/3] Reduce TLB flushes under some specific conditions Message-ID: <20231030225548.GB900@system.software.com> References: <20231030072540.38631-1-byungchul@sk.com> <08c82a91-87d1-42c7-93c4-4028f3725340@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <08c82a91-87d1-42c7-93c4-4028f3725340@intel.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrAIsWRmVeSWpSXmKPExsXC9ZZnoW6liUOqwZ42S4s569ewWXze8I/N 4tPLB4wWLza0M1p8Xf+L2eLppz4Wi8u75rBZ3Fvzn9Xi/K61rBY7lu5jsrh0YAGTxfVdDxkt jvceYLLYvGkqs8XvH0B1c6ZYWZycNZnFQdDje2sfi8eCTaUem1doeSze85LJY9OqTjaPTZ8m sXu8O3eO3ePEjN8sHjsfWnrMOxno8X7fVTaPrb/sPD5vkvN4N/8tWwBfFJdNSmpOZllqkb5d AlfGztd9TAX/uCuWzLrP3sC4mrOLkZNDQsBEYuHkG6ww9o3Zt1lAbBYBVYlbu+6C2WwC6hI3 bvxkBrFFgOxTK5ezdzFycTALNDFLXFu/GaxZWMBd4mXHFkYQm1fATOLJq5tgDUICGRJfmjuZ IOKCEidnPgEbyiygJXHj30ugOAeQLS2x/B8HSJhTwFbiYe9vsBJRAWWJA9uOM4HskhBYxy5x 4/5ZJohDJSUOrrjBMoF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JMnFwSjUwZj9WLH/JlG787BR7fO7J8JldizYUdk19YrJe6FaczJ6N lxkvPvjqbqhQHrIq/8cKwQL/67yr3bo0z4Xp6jSoLMjYU2WxPEKq9meOsPfMu1lbpp56dOn4 /TCb/U6VxkW6RQvMTmwMV87p+/5y+e/ZT7OveR+I+Mgr1Hdnhdnfs0HlTwpU7BxKlViKMxIN tZiLihMB1bFmnqoCAAA= X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 30 Oct 2023 16:02:25 -0700 (PDT) On Mon, Oct 30, 2023 at 10:55:07AM -0700, Dave Hansen wrote: > On 10/30/23 00:25, Byungchul Park wrote: > > I'm suggesting a mechanism to reduce TLB flushes by keeping source and > > destination of folios participated in the migrations until all TLB > > flushes required are done, only if those folios are not mapped with > > write permission PTE entries at all. I worked Based on v6.6-rc5. > > There's a lot of common overhead here, on top of the complexity in general: > > * A new page flag > * A new cpumask_t in task_struct > * A new zone list > * Extra (temporary) memory consumption > > and the benefits are ... "performance improved a little bit" on one > workload. That doesn't seem like a good overall tradeoff to me. > > There will certainly be workloads that, before this patch, would have > little or no memory pressure and after this patch would need to do reclaim. 'if (gain - cost) > 0 ?'" is a difficult problem. I think the followings are already big benefit in general: 1. big reduction of IPIs # 2. big reduction of TLB flushes # 3. big reduction of TLB misses # Of course, I or we need to keep trying to see a better number in end-to-end performance. > Also, looking with my arch/x86 hat on, there's really nothing > arch-specific here. Please try to keep stuff out of arch/x86 unless > it's very much arch-specific. Okay. I will try to keep it out of arch code. I should give up an optimization that can be achieved by working on arch code tho. Byungchul