From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4416D45349D for ; Thu, 26 Feb 2026 20:41:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772138464; cv=none; b=CZWmr6TYuT1mLZfdnVbUc7529mnw4RN4rAL52os+AKypgPjDCIo/boZncjorE8wNI9lPvIe6ODRxlHUeHoseRNSVeLlzaUJIBw2xUVOgn2iQSgQZxhd0YMHr0vKaD01IS+V731mtn82x10ZXBbNIDsN/rcshGtc0mDMCkLI6xlM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772138464; c=relaxed/simple; bh=nrcnZO7w+R/oKY3rucS5GmEBHWKM+d4Pdun6tWcv4BQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SL9SNEmtnF2yPi/mBe8w76wg3q6mdceV4QeWbMLOk6VtNSdR3mpaQA/AQTXuNVJ6VBu7MSNqVI/EE8bwCf0zfk84F2/TRQjfFv2KHzj9EcRhXJ09TMN4mGhA98ra53dGn2Z+sjVCLylcA5ivFYAcj35M94luGC6UUZlEvojbWcM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Wi6f2thX; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Wi6f2thX" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7d55b97f358so1036568a34.3 for ; Thu, 26 Feb 2026 12:41:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772138462; x=1772743262; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NguBUFNmUMF9el0MqWxRk1yX+e6cF7VtARIl6RrUMW8=; b=Wi6f2thXQJsSXvMJrZGGgtkullPEcJxqGsM/S6h1ZWIw//6OKl5Cl7xziHal3EWP9O yzsL9JBmVvP7MmA6egGZwyPZYSMpQXgg2b5TW9ZWFf7s/G0a9txwzjwX4TCYbcbJWYLa 0OdONpCDHO/s2vt9VrEFxeemDIQ+260v/dO2Wr00/eQNNNHuZPpRkYILhZL15cmlW3yV LcUvEUVZKJ1lwY2ihC6DEArSjDJigJHRiQcZP3SkSf8/rYq9S81MRc7Ev+epxFFGX6U0 zYdBPYjdyuk42oeL2s0Fp1+qyfjWjI6ttgULUe0MPjDCuvmBDa/jaxh23ZMvh4G2JjKr C/8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772138462; x=1772743262; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=NguBUFNmUMF9el0MqWxRk1yX+e6cF7VtARIl6RrUMW8=; b=k5w0xvaEnK9DfRZA9M7yUEbp5i5OBhDaBsMOOn3ubQG/agwovunWCs2RPIlY1v7Iv3 fV/jxAezc6D25WP7VFp7UzvivzSxWMcbClMqplVNpugb3O6vUrpXwA/Uh3F9U1XQw/36 uT/C0aLdivk0gAi0Kj9mrrERtr4BxjYd4JO3YnyNWDDFKbkNhQesJ4i50fxpUIyKGizU C5mLZF2+ovLb78lPvhK+I8uyPF6nNzmgtg95bEbu0HCyJ+1fPsTdM4eWdh9hEBBRwAtz ATVOngWGpPudKzzbgCCSkkehTpwgsNVfvZj3jrAz/XzP/gW4q4PNkRJs+De3GtewigYn Vp7A== X-Gm-Message-State: AOJu0Yzv9uF9YSMtVCO7SS/TgqNWvefvkGAlJbajeA5M/d3XcQSAs4+I XixLGDI0ur7NsP/HnhOU8aVOFmv+Zx01ngPYnDqD8kUlxjE0UHWcKxCa X-Gm-Gg: ATEYQzyNZ5hpCbXTlhK+NlcZkGZuZdejJrJpdFuWJApVW49it8R491globcX2KwKTKx G/WMfsJVd6AXu/3wQX60PO9iSdOgSY/8+JGmyq9mgqYJvCf8dNsa2YZtji2OL15EGd5HKmv1Jvx 5oPATCI9bTAOhg5393j9Hlzzo4Ip6Tyya5kd3k228Be24eNJcIIDFb+Xx4NTx0ydljBDAXQ7REp IgQC5k22IW1aokcs6TNWNmcERHnEofXPGRUex9+PG7gOTl/D6TYF34/aTCriPgkQ5QZf2fprWay 2D5UBkdXs1HYbaWMjXtnHE64xWrLBaSEMBrES7VU/aIw401CG2+r06rjOrNkg0AeHsgu6chRf8G SGkK25W6M93GqzHVjLjxmxLgEZieRfh/Y4tTX+7mhAvBJDaeHCJweqFddAkJqykwTYyd9cm5kTf DcOWMTzEENk0iM35MnC1Ciug== X-Received: by 2002:a05:6870:70a0:b0:409:5241:8abc with SMTP id 586e51a60fabf-41626ddf8bfmr404506fac.20.1772138462037; Thu, 26 Feb 2026 12:41:02 -0800 (PST) Received: from localhost ([2a03:2880:10ff:73::]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4160cf239e0sm2967025fac.1.2026.02.26.12.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Feb 2026 12:41:01 -0800 (PST) From: Joshua Hahn To: Bharata B Rao Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Jonathan.Cameron@huawei.com, dave.hansen@intel.com, gourry@gourry.net, mgorman@techsingularity.net, mingo@redhat.com, peterz@infradead.org, raghavendra.kt@amd.com, riel@surriel.com, rientjes@google.com, sj@kernel.org, weixugc@google.com, willy@infradead.org, ying.huang@linux.alibaba.com, ziy@nvidia.com, dave@stgolabs.net, nifan.cxl@gmail.com, xuezhengchu@huawei.com, yiannis@zptcorp.com, akpm@linux-foundation.org, david@redhat.com, byungchul@sk.com, kinseyho@google.com, joshua.hahnjy@gmail.com, yuanchu@google.com, balbirs@nvidia.com, alok.rathore@samsung.com, shivankg@amd.com Subject: Re: [RFC PATCH v5 02/10] migrate: Add migrate_misplaced_folios_batch() Date: Thu, 26 Feb 2026 12:40:59 -0800 Message-ID: <20260226204059.481964-1-joshua.hahnjy@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260129144043.231636-3-bharata@amd.com> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Thu, 29 Jan 2026 20:10:35 +0530 Bharata B Rao wrote: > From: Gregory Price > > Tiered memory systems often require migrating multiple folios at once. > Currently, migrate_misplaced_folio() handles only one folio per call, > which is inefficient for batch operations. This patch introduces > migrate_misplaced_folios_batch(), a batch variant that leverages > migrate_pages() internally for improved performance. > > The caller must isolate folios beforehand using > migrate_misplaced_folio_prepare(). On return, the folio list will be > empty regardless of success or failure. > > This function will be used by pghot kmigrated thread. > > Signed-off-by: Gregory Price > [Rewrote commit description] > Signed-off-by: Bharata B Rao > --- [...snip...] > + if (nr_remaining) > + putback_movable_pages(folio_list); Hello Bharata, I hope you are doing well! Thank you for the series. I saw the numbers and they look great. I'm hoping to do some more testing myself as well : -) I'm also going through the series as well!! > + if (nr_succeeded) { The single-folio case, migrate_misplaced_folio, has a guard here to check that the function performs more than just a migration, but a promotion. Specifically, it checks that the folio's node is not toptier, and the destination node is toptier. Should that also be included here? When this is called in kmigrated_walk_zone in the next patch, there is no check to make sure that the folios are actually on a lower tier, and the destination is on a higher tier. Maybe I'm missing something? But it wasn't entirely obvious to me that the migration is always a promotion. I want to note that we're also skipping the count_memcg_events, which I understand is much harder to do here becuase each folio might belong to a different memcg. Ying also noted this in his reply from v1 [1] but I don't think it ever got addressed. Anyways, thank you! I hope you have a great day! Joshua > + count_vm_numa_events(NUMA_PAGE_MIGRATE, nr_succeeded); > + mod_node_page_state(pgdat, PGPROMOTE_SUCCESS, nr_succeeded); > + } > + WARN_ON(!list_empty(folio_list)); > + return nr_remaining ? -EAGAIN : 0; > +} > #endif /* CONFIG_NUMA_BALANCING */ > #endif /* CONFIG_NUMA */ > -- > 2.34.1 > [1] https://lore.kernel.org/linux-mm/87a541e51s.fsf@DESKTOP-5N7EMDA/