From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 59E3B302164 for ; Thu, 20 Nov 2025 23:08:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763680115; cv=none; b=QIAXh63xE0dM3a6k5bOnhVCi4x5vpb3rNQ4k+Nifeo+dfam0HMe7MkoiwwhRQZ9FpQr0QFuvhwtqZqZZK3EFBCm+rzi5YUbXnw247P5XkzYBhRXslffWeq86Y1JXrwjnDEE2Z0PhnM2AViQKBGeslTBUzaGopmBW6p0BrtBqhcQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763680115; c=relaxed/simple; bh=St5MxBUCZJcinOju0ZzS80vPNdzerp0xVZDJj547ddw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=G0uCBjngbpC3rnYVdgbEBnmfkWONZbdlGebT/GOdEa/4zMJQKa+Z2/+iAIUZH163gIDobAQJ+m5yDJQkKa7lLe1ZIfbWlaFu3VPu17Re+idw0YB31d75TXGmxZ3RD0rDwnnI8DIWYpL0BZgsVXpZab6h0No4Rfs8zHtDqDVkBg4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=oCziz253; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="oCziz253" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1763680113; x=1795216113; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=St5MxBUCZJcinOju0ZzS80vPNdzerp0xVZDJj547ddw=; b=oCziz253n0GlWD22JTzEUhgnGrvpeCVKXeKM6VzxuJqII0kXxuk1jGQO rVus5bpdqztLoDeRk32WPnJ+zyEfXE2qRoxO4vQC0cMzqK3aiY8hAP8y5 aRjf6K+sSIW/tl1drxHhX8f+xnSHB80AHGmRcPn/x1aP0BDFAhupni8D0 hX7aBVyT3XdSzZIHuF4IdDgGA1Y4nJcEDMwjgRISC7Y9U9+ERF3JCnYUb hl59OVxpbwjwNPY5QIczedJDl4tM1V3D4fmgB2YTSmHsW4LLFiXmBEALF za8KtF+5oTVZqp9dCIXQZ1rEvfOSamexHu2sgjGppj2WB0XtqAYuUhN5C g==; X-CSE-ConnectionGUID: +9VPzzktRtKYoq1XWoT+zw== X-CSE-MsgGUID: GQmhWqVcRNGzN0cfdHbb7Q== X-IronPort-AV: E=McAfee;i="6800,10657,11619"; a="65699786" X-IronPort-AV: E=Sophos;i="6.20,214,1758610800"; d="scan'208";a="65699786" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2025 15:08:31 -0800 X-CSE-ConnectionGUID: lG0PZyxFTOKLYOhE+/99iw== X-CSE-MsgGUID: MjqUGEr1ROq7Z6UP56tBDQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,214,1758610800"; d="scan'208";a="191364908" Received: from lstrano-desk.jf.intel.com ([10.54.39.91]) by fmviesa006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Nov 2025 15:08:30 -0800 From: Matthew Brost To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org Cc: Andrew Morton , David Hildenbrand , Zi Yan , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Oscar Salvador , Lorenzo Stoakes , Baolin Wang , "Liam R. Howlett" , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lyude Paul , Danilo Krummrich , David Airlie , Simona Vetter , Ralph Campbell , =?UTF-8?q?Mika=20Penttil=C3=A4?= , Francois Dugast , Balbir Singh Subject: [PATCH v2 2/2] fixup: mm/migrate_device: add THP splitting during migration Date: Thu, 20 Nov 2025 15:08:25 -0800 Message-Id: <20251120230825.181072-2-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251120230825.181072-1-matthew.brost@intel.com> References: <20251120230825.181072-1-matthew.brost@intel.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=UTF-8 Content-Transfer-Encoding: 8bit Fix splitting a folio in PMD collection to collect a skip on folio split failure and continue the loop at the current position on success. This fixes an issue where migration entries that had already been collected could accidentally be left behind. Cc: Andrew Morton Cc: David Hildenbrand Cc: Zi Yan Cc: Joshua Hahn Cc: Rakie Kim Cc: Byungchul Park Cc: Gregory Price Cc: Ying Huang Cc: Alistair Popple Cc: Oscar Salvador Cc: Lorenzo Stoakes Cc: Baolin Wang Cc: "Liam R. Howlett" Cc: Nico Pache Cc: Ryan Roberts Cc: Dev Jain Cc: Barry Song Cc: Lyude Paul Cc: Danilo Krummrich Cc: David Airlie Cc: Simona Vetter Cc: Ralph Campbell Cc: Mika Penttilä Cc: Francois Dugast Cc: Balbir Singh Signed-off-by: Matthew Brost --- This fixup should be squashed into the patch "mm/migrate_device: add THP splitting during migration" in mm/mm-unstable --- mm/migrate_device.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mm/migrate_device.c b/mm/migrate_device.c index 4506e96dcd20..ab373fd38961 100644 --- a/mm/migrate_device.c +++ b/mm/migrate_device.c @@ -313,16 +313,18 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, if (folio_test_large(folio)) { int ret; + arch_leave_lazy_mmu_mode(); pte_unmap_unlock(ptep, ptl); ret = migrate_vma_split_folio(folio, migrate->fault_page); if (ret) { - ptep = pte_offset_map_lock(mm, pmdp, addr, &ptl); - goto next; + if (unmapped) + flush_tlb_range(walk->vma, start, end); + + return migrate_vma_collect_skip(addr, end, walk); } - addr = start; goto again; } -- 2.34.1