Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp189240rdh; Mon, 30 Oct 2023 19:37:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGWReU80BWwXr7WnsHI/59qd7TflK/H8lXMrOwjislfR1dh3mNjBMq59GN4ilK3xWW8A5Qn X-Received: by 2002:a17:902:d505:b0:1cc:5ce4:f64d with SMTP id b5-20020a170902d50500b001cc5ce4f64dmr2766491plg.15.1698719873942; Mon, 30 Oct 2023 19:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698719873; cv=none; d=google.com; s=arc-20160816; b=ioVQ8N9aCTJ8r5AhRyZXcY1/PzNCUGw0METDDnFTIW1GbrzCaowQGFe98UgDOWgEus vlhLU6jfvI9fnKk0a8nx8PVuydGMRbkYcqygqBNSuoIEdpfGjW5qkAA3nFFW7std8EWh yoVVtZby3Zwl5Sg8y72EWunlcfnnOv5WTi6lqusoL+MOSmGa71RQ/nSMTmWdgWbi2osJ t0udt/nhtTUjrLRGGmOkDdKMo+JtxPzkn7XXfX4kowDsZwoZm/wBmLjTymnY4Qgnfko7 JXjXNsr44eB7uoJeFBcxJQpKDC8huiaebgjaguUn9Wb1GZyuD5ZlZd7btyNHT0nBxjOV 4rEw== 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=v3HlygCiVyFpQULJfH53MK7DznVddFWhPtsWEoe7UkQ=; fh=DLCYOhG5zRcBW1Cp1txuzsrnLFUce6lRkmUVu0e8M04=; b=OKsbu6upc2HtGkaqiwE/rmtTwEMbata3DO6oR5r+x9bXLPQ2T4pnwZyKH1K/5xe5EV dzUOoSCJ5spgYrNDCAH2APbfHCkGVcTlq3RcYVFIcvCPTGQclEX3azWNXljAGbMZzDGi ERSWaToi4CJB0cNGfl+SAxre394l3NW9tlzLhXUSYhILWZVsFMVD2lKXUhDuOrtQIPTb frZEeMjxHq9sch2I1cUeNH6a1fXfw1o5GI/jkEsWmLOViM6OazPgQAqrMVDpGVMpJ4eI MjSrgAwG8uLefCWyL5lQcCtaiqjg7fsTkqgi3YAJN2b4na5dBvoYXzoJaknyfeb0f85W +lPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id v8-20020a170902b7c800b001cc4689a51esi320590plz.37.2023.10.30.19.37.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 19:37:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 7E80780401D5; Mon, 30 Oct 2023 19:37:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234770AbjJaChh (ORCPT + 99 others); Mon, 30 Oct 2023 22:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235994AbjJaCh3 (ORCPT ); Mon, 30 Oct 2023 22:37:29 -0400 Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4F7A6126 for ; Mon, 30 Oct 2023 19:37:13 -0700 (PDT) X-AuditID: a67dfc5b-d6dff70000001748-98-654068553d78 Date: Tue, 31 Oct 2023 11:37:04 +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: <20231031023704.GA39338@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+NgFtrAIsWRmVeSWpSXmKPExsXC9ZZnoW5ohkOqwf5GFYs569ewWXze8I/N 4tPLB4wWLza0M1p8Xf+L2eLppz4Wi8u75rBZ3Fvzn9Xi/K61rBY7lu5jsrh0YAGTxfVdDxkt jvceYLLYvGkqs8XvH0B1c6ZYWZycNZnFQdDje2sfi8eCTaUem1doeSze85LJY9OqTjaPTZ8m sXu8O3eO3ePEjN8sHjsfWnrMOxno8X7fVTaPrb/sPD5vkvN4N/8tWwBfFJdNSmpOZllqkb5d AlfGinWbWQpWS1Xse7iatYGxW6iLkZNDQsBEYuKJJyww9pEHE5hAbBYBVYn+jr9gNpuAusSN Gz+ZQWwRIPvUyuXsXYxcHMwCTcwS19ZvZgVJCAu4S7zs2MIIYvMKWEhc+bQMzBYSyJD40tzJ BBEXlDg5E2IZs4CWxI1/L4HiHEC2tMTyfxwgYU4BW4mHvb/BSkQFlCUObDvOBLJLQmAdu8SD Ny/ZIA6VlDi44gbLBEaBWUjGzkIydhbC2AW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/270ni+w2Mq/wWciqEHKw9fvp GYrXQjbdn7uIeeXd8p7Zqg/XPzUsqEkNq+b4fqFxEteeG7P3v56yhzuixrHkxvKWo+oPbhyu envR/4M+Q/O87T6WD/ZOuP5GiM/7TiKnfeLGnLqL9W2bDOLEP2y8+jmneeqZOY5blFiKMxIN tZiLihMBaA/TCaoCAAA= 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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 30 Oct 2023 19:37:51 -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. I tested it under limited conditions to get stable results e.g. not to use hyper-thread, dedicate cpu times to the test and so on. However, I'm conviced that this patch set is more worth developing than you think it is. Lemme share the results I've just got after changing # of CPUs participated in the test, 16 -> 80, in the system with 80 CPUs. This is just for your information - not that stable tho. Byungchul --- Architecture - x86_64 QEMU - kvm enabled, host cpu Numa - 2 nodes (80 CPUs 1GB, no CPUs 8GB) Linux Kernel - v6.6-rc5, numa balancing tiering on, demotion enabled Benchmark - XSBench -p 50000000 (-p option makes the runtime longer) mainline kernel =============== The 1st try) ===================================== Threads: 64 Runtime: 233.118 seconds ===================================== numa_pages_migrated 758334 pgmigrate_success 1724964 nr_tlb_remote_flush 305706 nr_tlb_remote_flush_received 18598543 nr_tlb_local_flush_all 19092 nr_tlb_local_flush_one 4518717 The 2nd try) ===================================== Threads: 64 Runtime: 221.725 seconds ===================================== numa_pages_migrated 633209 pgmigrate_success 2156509 nr_tlb_remote_flush 261977 nr_tlb_remote_flush_received 14289256 nr_tlb_local_flush_all 11738 nr_tlb_local_flush_one 4520317 mainline kernel + migrc ======================= The 1st try) ===================================== Threads: 64 Runtime: 212.522 seconds ==================================== numa_pages_migrated 901264 pgmigrate_success 1990814 nr_tlb_remote_flush 151280 nr_tlb_remote_flush_received 9031376 nr_tlb_local_flush_all 21208 nr_tlb_local_flush_one 4519595 The 2nd try) ===================================== Threads: 64 Runtime: 204.410 seconds ==================================== numa_pages_migrated 929260 pgmigrate_success 2729868 nr_tlb_remote_flush 166722 nr_tlb_remote_flush_received 8238273 nr_tlb_local_flush_all 13717 nr_tlb_local_flush_one 4519582