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 796BEC5AE59 for ; Wed, 4 Jun 2025 02:42:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E48B46B0545; Tue, 3 Jun 2025 22:42:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF9E86B0546; Tue, 3 Jun 2025 22:42:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0F516B0547; Tue, 3 Jun 2025 22:42:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id B34996B0545 for ; Tue, 3 Jun 2025 22:42:07 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 33DA01D4BC9 for ; Wed, 4 Jun 2025 02:42:07 +0000 (UTC) X-FDA: 83516168694.11.CBBBC85 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by imf24.hostedemail.com (Postfix) with ESMTP id 8314E180003 for ; Wed, 4 Jun 2025 02:42:05 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=TUBRyt1B; spf=pass (imf24.hostedemail.com: domain of rientjes@google.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=rientjes@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749004925; 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: references:dkim-signature; bh=JHB3mOekbx6foeSLwoabBcmN1bK/91u0y3qTVvTAa2Y=; b=XB3Cnd90A1+4HVcGKM4S/5oJGCPUNWgry9WLsZSKNeLlDb1rp8iDiSwocg+d3ndRAV/ub9 RPmv9cxGL8ooVH0SylTFuAOpeUJO7LNWgBsZUDx6dV/+YjSOxmIOV6iC3UHI1ShqYMLH6I Q2xAoAEBwt3OY0Lj6XNlObViYC/1NFU= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=TUBRyt1B; spf=pass (imf24.hostedemail.com: domain of rientjes@google.com designates 209.85.214.174 as permitted sender) smtp.mailfrom=rientjes@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749004925; a=rsa-sha256; cv=none; b=3ElM5/Bhf4sugv08s7YxB/i1tpqKq7xJaKqIpE65fPvIWnXXAbiwn9Lq0T9LHswBgJYGuc mohdNBkA0wyGjuj3XgHJgzZIrRB8irMIzMgH/R0dbgFr7/xKP9Pj1VGCOEbiJgS+GiBRBE HdPLCZ0FWZqB0FkaT6A5n5SqzVn0qeU= Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-235e389599fso11245ad.0 for ; Tue, 03 Jun 2025 19:42:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1749004924; x=1749609724; darn=kvack.org; h=mime-version:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=JHB3mOekbx6foeSLwoabBcmN1bK/91u0y3qTVvTAa2Y=; b=TUBRyt1B6ZA+yUBEqJS+UupaRUmQ+KiZruzyLXgX3WsnUS/N/kUXy8p0i3PB6NgCEw WACKoavs0Mm6WzDej60+us6fcLOjHPxQ8+gsXik8UfIEi1+DYf3Slp97klMmYfw2KN/T QqJF8N7dqiJmRrueECNyJJrY6kONxOpA3cEYrhP0Uy8iR2mbuCis72/6cvZraLYDYeq1 xnzj4rj3bdUOkssQJqfVMoXwyf7/HL5WLslyAi+6mFLVaINklXjNRAT0XcxJ7FbSODts +CMoVwyA7U79t3fUXrMkuAm5GZQvKftOVZDaXOQWbh0aj4O1jOEQEJsLxi7fmx/LXZdQ 70BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749004924; x=1749609724; h=mime-version:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JHB3mOekbx6foeSLwoabBcmN1bK/91u0y3qTVvTAa2Y=; b=qyOLb5cWnxUcTLRUV/i0GsrMD4z+uVDQTrZv8Pgjs7s3nKJ0xXhlvpZtQVW1pYOn+x dAExw0GNK1sFd0wozXVG1nQhtxqKknFUkS0RG6H1P/gsxAf+RSFs9qAlkv5leAAR//Zy 6PXioMaWDfG81cuy8x1drA8TXg1gV9pwuW+D0i2HbDKfvl0bIej54b0wjMWHVOzhLDOB X/7icqgcuaOacQ84PcM9RXwsKisDvHJ0Lh00koaokVP7jjoOKxPueS73SUpo4+kH98C0 QYWVDxp5sQbEGfRUhhO+ubu0pyZ5LugwMmjxuraHU42GMdkl7ymLfft5JkKdsBRH7eYi VOHA== X-Gm-Message-State: AOJu0Yzy+dfM4csAdUQ0fU2nhT9Botp3KG4qE1zV8dl/r/5GfAYcWCog wjsLoaADaeg5cw+77onC13To0Y4BTQ+ePSh6vad6VKbEajtwOGb6l/OkcaMdbONg6w== X-Gm-Gg: ASbGncvsY/yG77QVnC0R/YiLeHo49mcVF5cDkpRY16CLyZNh+NDRJ0kqClnk7wDE5Pi RrU4R/h0bCFygdmMBdiAJILwgEBwQKPBGnaR+8//i8wBJ43Gi7OeJfWVJOEqKyKUfsU5fGcbP85 l73ot3LXpaA8KfqtQySdPbpfsdYFv/oqDCjlX3kxS86tQkyCqVI2Ip6QwaYWu2zHq5EtsdcqK6o NhG4XQKVlJjMCJ5EcCUxHu/HXCrRocqDr3w9gSSy8Zh3bkgJZj12AZ9SD/qtqHn+WRr09fSkLw0 IuiodTET+Qibvwo62zztKkInE4jtE+8AruOjOahQELJMNaW8EQi+iCe+YedCfPVBU7jMzc1Fos8 CGf+2PuibRhzBCHceOxCfiBnJhcIL50omYyHyr9Tg8wiBf5O+qrqrLC7xA2WSTwWuLRI= X-Google-Smtp-Source: AGHT+IEg4sKj+NHDPJ/wiJ69E3kmkF66jNzjvmSGXvX+zKZxv/b4jvQfPeAHKqzRMP7NCNrTWFgvLQ== X-Received: by 2002:a17:903:2452:b0:21f:3c4a:136f with SMTP id d9443c01a7336-235df83f36bmr1683935ad.28.1749004924035; Tue, 03 Jun 2025 19:42:04 -0700 (PDT) Received: from [2a00:79e0:2eb0:8:5ce2:a502:e3a2:a5f2] ([2a00:79e0:2eb0:8:5ce2:a502:e3a2:a5f2]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23506cf5432sm93955165ad.180.2025.06.03.19.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jun 2025 19:42:03 -0700 (PDT) Date: Tue, 3 Jun 2025 19:42:02 -0700 (PDT) From: David Rientjes To: Davidlohr Bueso , Fan Ni , Gregory Price , Jonathan Cameron , Joshua Hahn , Raghavendra K T , "Rao, Bharata Bhasker" , SeongJae Park , Wei Xu , Xuezheng Chu , Yiannis Nikolakopoulos , Zi Yan cc: linux-mm@kvack.org Subject: [Linux Memory Hotness and Promotion] Notes from May 22, 2025 Message-ID: <00b77c99-b2d1-15e6-bcd0-b363f7571d6f@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8314E180003 X-Stat-Signature: 7hyw45r8bukix7sbdzb3gfiki1qch46y X-Rspam-User: X-HE-Tag: 1749004925-278937 X-HE-Meta: U2FsdGVkX1/aFpKGdqMiZrtC++S+zD3QSqcF7jHQvgyVQPfw9+8rNNwqh6CkRq3DPB444Npb6aqeww8daVou5F7Wq/Ss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br5Tx9g8XUqPk2fglMVXr3CpvLSD4sm6YdkXNv9fYkk8Uxzt7ubq01YwsSW8azOREAMhBSbYTv8YEqkGXjfVo7pEYHmCal67w1VkFs1DU05tn5o2xL3tTcHGxFmOn3ir71WWmhAggSmZLxilxorf/GrfivmurWJWZhiIHYC5+KaGLxYueNm95dodsQ5Ri4+XIkX1Tl6MpUDbV2KkgluPa/iq9Z2p1+jwJXKTWzn6iAPXUMkN0uwG+TCi86hiSx1DfWEdT/qYGm0FbHZAIfcv+IOcXXp8XP0= 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: Hi everybody, Here are the notes from the last Linux Memory Hotness and Promotion call that happened on Thursday, May 22. Thanks to everybody who was involved! These notes are intended to bring people up to speed who could not attend the call as well as keep the conversation going in between meetings. ----->o----- Bharata was working on separating out migration from NUMA Balancing[1]. He had posted the patch set on May 21 and received feedback from Gregory Price and others. Gregory said that any concerns could be addressed on the mailing list but also noted that if it's going to go down this route, then having the migration done asynchronously per task was likely not ideal. It would be better to have it done per node or per cpu. This would also help to resolve some issues related to lengthy lists of isolated folios. I asked about the per-task asynchronous migration. Bharata discussed the previous approach of kpromoted that was per-node but was inspired by Gregory's recent work and looking more deeply into NUMA Balancing so there were some advantages to isolating a small number of folios and then ensuring migration within a small period of time. He was not against doing this per node. Bharata discussed two aspects to NUMA Balancing, the locality based balancing and the hot page promotion. For the former, there has been a lot of discussion on a generalized abstraction to describe memory hotness that would then be handed over to the migrator -- this is not needed by traditional NUMA Balancing. Raghavendra suggested a migrate thread that would only do the migration itself. Bharata said this should be independent of the backend that is determining which folios to migrate. Instead of isolating the pages for a per-node migration thread, Bharata suggested tracking the pages by pfn instead. Gregory didn't have a strong opinion on isolation vs pfn tracking; he pushed back on per-task because of the asynchronous migration -- he did not want to leave a ton of memory isolated. I agreed. ----->o----- I discussed the methodology for benchmarking and collecting data for various approaches. Bharata noted that the majority feeling was to move this out of the task_work context so there is no urgency in testing this today. When we have the alternative mechanism, we could collect numbers at that time. Gregory noted that all we have to do with the current patchset is to clean up the task exit putback. He noted that having this done as part of task_work() would cause latencies to show up in weird places that may not be easy to attribute to migration. Davidlohr noted that even with this approach, that the cost of the scheduler aspect of NUMA Balancing is still a burden of the task. Gregory noted that his feel was still that migration should be done by a kthread, but the discussion would be more around where you store the data and how much data you store to track what needs to be migrated. As a simple example, he described a per-node list that would occasionally migrate from that list. This would be possible experiment with and evolve, including potentially for per cpu. Bharata said that he would do this. Raghu noted that the migration thread may also be able to handle both an isolated list of folios *or* pfn tracked memory. ----->o----- Raghavendra discussed feedback from upstream from Davidlohr. He discussed PTE based scanning and its implications on first access, this is something that we would like to filter. He discussed whether the LRU was able to provide insight into whether a folio was active in the N-1 generation; this would allow us to filter as desired. Davidlohr described his idea as when a page fault comes in and we determine that the page is hot, and have decided that we want to migrate, then it gets added to the asynchronous migrating entity described above for processing. Once that entity schedules, it will determine if the memory is still hot by checking the active list and only then do the isolation needed for migration. ----->o----- Next meeting will be on Thursday, June 5 at 8:30am PDT (UTC-7), everybody is welcome: https://meet.google.com/jak-ytdx-hnm Topics for the next meeting: - update on the pivot toward per-node or per-cpu tracking of pages to migrate + decide if pfn based tracking is required instead + update on Bharata's latest proposal that incorporates this feedback, targeting the next meeting if possible - discuss overall testing and benchmarking methodology for various approaches as we go along + minimal viable infrastructure, testing workloads, and metrics of interest to collect - enlightening migrate_pages() for hardware assists and how this work will be charged to userspace Please let me know if you'd like to propose additional topics for discussion, thank you! [1] https://lore.kernel.org/linux-mm/aC6VIG7GPnqr3ug-@gourry-fedora-PF4VCD3F/T/#t