Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1593020lqg; Sun, 3 Mar 2024 18:39:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWbsMUGB/gmu1GhRTAzEmyM0TP3CYMwvyeRC3V46O8GqpQ4AuOLEO6xmjPqv0gg1YHDX1kcD/v7IG2lFnpgMy5l8lLyH8UomxGjxq9XjQ== X-Google-Smtp-Source: AGHT+IH6Wi0Zbcc3+Y+m/SzTOV0m/OisuceLUz5SRFYvFtH+G1G19t60quc/ofVxC7O3j6ISLIQ9 X-Received: by 2002:a17:906:4687:b0:a45:5c3a:5c81 with SMTP id a7-20020a170906468700b00a455c3a5c81mr378979ejr.52.1709519997649; Sun, 03 Mar 2024 18:39:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709519997; cv=pass; d=google.com; s=arc-20160816; b=LKTJxEbRhTcgG0kaBjKfgFrNkKrMsx7LWNYeW0wxkE55bozsAP8Kd/TbwMlPliWL34 YjM7zA7NixJbq6xLdGAnO3eF+0nyDGfv3LFOrAn53h1qUo+g3L6lsJPIVDS32cYOu7NF uTIVhEint5MjyRjFB9F69o2DVRanZtW+byW43IH50khSE7E1ubyCyPaWIERAOUCWIpeP YZKNzGlqHgYzhEojnO4EPewz3M4k11t3ugr4diNosxvQkptR547hoqHURXWtkch3u43r 4Yz9AUAqvLXV2SmGnrXKFaov1rJ5fPu32n34BZIa7CQ0lp5lp2C4aYr7ed+XdMVxDzQh Pp4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=UMPwjUrLS3I9dz2fEzg1h5GaMisteGMgmYHsibKgeAA=; fh=gbxqYiP6zeIsZ6c+8HJx0gUlB2v9kjoMNJHbVV2LII8=; b=lxBD709Q+dCY75XzAn/6cxRAW+twyvQw6W3Rfs5RgVNr+bdSRtCEzj9Nmm5UQVpqWm 1cF1Quh49jVKbfsyQMw16+DgDdWYZVMbAp1onjd4mF1k8m6MWc9rJz1WAAST56vPwdOw RbylI4iz7mmZU8Pyb8//8xv6Su1x2ZGPTwe3ZBk5Ft6zdo3DQwouV6+Nd220ZFez+/if DBSONn8ao4iPi2o1++T3fL1m88y3FIfrgVHe7yOVyTwjXDz6td67+w/xmB8oA0ET3cZ0 jLNYpJ+DyLhrqMUb2kNCz7VjiuLjts8Q8IYB10aQK9iaC8envkOTSKSLEJ7hQvnu+ebn 3kmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-89982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89982-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f1-20020a170906494100b00a4427d8ef7dsi3423570ejt.225.2024.03.03.18.39.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Mar 2024 18:39:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-89982-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89982-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 60EAA1F21486 for ; Mon, 4 Mar 2024 02:39:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5EC981FAA; Mon, 4 Mar 2024 02:39:49 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.skhynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 592E419A for ; Mon, 4 Mar 2024 02:39:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709519988; cv=none; b=HTzjNWuDya4R1/Q6HY9gOp9Mn1LdT9DL65uxR2ekotd2mKB/Cn4QivVpzHzED8sQ+ERkhtx6xx+OJsO6F/p+Ryfdv9+3qCfsW0haV3YfJuDIkREoa7yNSEUEoxXquKFrfppAe//CIpbs7IL1dZwMO72SyYPctL2aa+ZPYr3lvBI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709519988; c=relaxed/simple; bh=mzaSVeh4brKuSCIYyR/KgsMXISsvCDhXVxVlfuIfANk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eTR7nFdFjYYydxzRrgm9xr5wBIPOgR1cxA8JLFt2902k4zSBclqRKYdWnwJwKDWkg9NCEDxhw2ePlISlci7ctxhzgybHYfYF90TrFsQaiGncxXLoUo3TWGDu7UhLVIU/pPTiGwO9nkL++xjyngmV5ZkTTTKWp3et8WGsax0u2Bw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d6dff70000001748-2a-65e5346b883a Date: Mon, 4 Mar 2024 11:39:34 +0900 From: Byungchul Park To: David Hildenbrand Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, akpm@linux-foundation.org, ying.huang@intel.com, vernhao@tencent.com, mgorman@techsingularity.net, hughd@google.com, willy@infradead.org, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, rjgolo@gmail.com Subject: Re: [RESEND PATCH v8 0/8] Reduce TLB flushes by 94% by improving folio migration Message-ID: <20240304023934.GA13332@system.software.com> References: <20240226030613.22366-1-byungchul@sk.com> <20240229092810.GC64252@system.software.com> <54053f0d-024b-4064-8d82-235cc71b61f8@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54053f0d-024b-4064-8d82-235cc71b61f8@redhat.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrHIsWRmVeSWpSXmKPExsXC9ZZnoW6OydNUg4NbxC3mrF/DZvF5wz82 ixcb2hktvq7/xWzx9FMfi8XlXXPYLO6t+c9qcX7XWlaLHUv3MVlcOrCAyeJ47wEmi/n3PrNZ bN40ldni+JSpjBa/fwAVn5w1mcVBwON7ax+Lx85Zd9k9Fmwq9di8Qstj8Z6XTB6bVnWyeWz6 NInd4925c+weJ2b8ZvGYdzLQ4/2+q2weW3/ZeTROvcbm8XmTXABfFJdNSmpOZllqkb5dAlfG nb9PGAu+ild8vXOeqYFxiVAXIyeHhICJRPe1M4ww9qennSwgNouAisT/CQvB4mwC6hI3bvxk BrFFBDQkNrVtALK5OJgF3jJJTJnTzAaSEBaIlljWNYUdxOYVsJC41TKDDaRISGAGo8Tq5ivM EAlBiZMzn4BtYBbQkrjx7yVTFyMHkC0tsfwfB0iYU8BO4t+kc2CLRQWU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HgAZUhUjv7MdluSFXHUN byi9bqjQ8UYPiGMolVJ+8TKvUbA3uXK+mOfLeMM/l2AksbXgxey5lsmMLXNV51TAXRC1l0K9 RhqX83jcKVuSN2+kISEA+F0mpzM5q6CtJsXpHW2+Z42/xLWdJ775TROWTHvLu15DzteUxHFZ GROQBpduKedvD6RKnBVD6QV1IadRNqvuS/Y74aP8zj7Zz2saamrsxEZH0J7umlDZcydVlLGI O6kmDUbuDyUPXjKoAgAA X-CFilter-Loop: Reflected On Thu, Feb 29, 2024 at 10:33:44AM +0100, David Hildenbrand wrote: > On 29.02.24 10:28, Byungchul Park wrote: > > On Mon, Feb 26, 2024 at 12:06:05PM +0900, Byungchul Park wrote: > > > Hi everyone, > > > > > > While I'm working with a tiered memory system e.g. CXL memory, I have > > > been facing migration overhead esp. TLB shootdown on promotion or > > > demotion between different tiers. Yeah.. most TLB shootdowns on > > > migration through hinting fault can be avoided thanks to Huang Ying's > > > work, commit 4d4b6d66db ("mm,unmap: avoid flushing TLB in batch if PTE > > > is inaccessible"). See the following link: > > > > > > https://lore.kernel.org/lkml/20231115025755.GA29979@system.software.com/ > > > > > > However, it's only for ones using hinting fault. I thought it'd be much > > > better if we have a general mechanism to reduce the number of TLB > > > flushes and TLB misses, that we can ultimately apply to any type of > > > migration, I tried it only for tiering for now tho. > > > > > > I'm suggesting a mechanism called MIGRC that stands for 'Migration Read > > > Copy', 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. > > > > > > To achieve that: > > > > > > 1. For the folios that map only to non-writable TLB entries, prevent > > > TLB flush at migration by keeping both source and destination > > > folios, which will be handled later at a better time. > > > > > > 2. When any non-writable TLB entry changes to writable e.g. through > > > fault handler, give up migrc mechanism so as to perform TLB flush > > > required right away. > > > > > > I observed a big improvement of TLB flushes # and TLB misses # at the > > > following evaluation using XSBench like: > > > > > > 1. itlb flush was reduced by 93.9%. > > > 2. dtlb thread was reduced by 43.5%. > > > 3. stlb flush was reduced by 24.9%. > > > > Hi guys, > > Hi, > > > > > The TLB flush reduction is 25% ~ 94%, IMO, it's unbelievable. > > Can't we find at least one benchmark that shows an actual improvement on > some system? XSBench is more like a real workload that is used for performance analysis on high performance computing architectrues, not micro benchmark only for testing TLB things. XSBench : https://github.com/ANL-CESAR/XSBench Not to mention TLB numbers, the performance improvement is a little but clearly positive as you can see the result I shared. Byungchul > Staring at the number TLB flushes is nice, but if it does not affect actual > performance of at least one benchmark why do we even care? > > "12 files changed, 597 insertions(+), 59 deletions(-)" > > is not negligible and needs proper review. > > That review needs motivation. The current numbers do not seem to be > motivating enough :) > > -- > Cheers, > > David / dhildenb