From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796134767; b=3NMvt5IabzmyfX9Sl76k/2M8obr6zKxB5KcmmmfVVfnlUQgeKn9c/zIVe6+QpLomPU0S K16zUF+Z00OkQag529xk/kHIC3aLp3R4xMs+3bSd8EPP8QOKIt6QERknhll7fMaeRu7XO smLm16Aonrmna05UV5QL1D4h+edcqk7JMWyVQtuSsoPB5yMHpBax64sEUTUOzRlVDvO+2 fYqr5e+1xFfU09ksrzrfRWUfR2Wgzeqb9/prpy5w+MaZlJNAhOogWtWGDdD97p0/exbEB 2b7c+hSBroN2mfD6mBmtmshxcZVFC2uzhGpk7ByX+cCxaKsD7Pq3F3B4GpVP97Gocog== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796134767; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=7TmTME/Yr6PtnNMnt+fWKtYWn7jGGBzuPU8w0bG9wBI=; b=NfGv5BmKU12mvEO2sRz5A0aL+k7hN6zxdYTWaCtsCZkolUsi6cKza3RxzQKLCjMVAB/5 zRg3Po6BV7pQXe5VWJ8brLxv1CqIT4SoRZv4PXh03RJQfk4/85qIHbErTu6J9rEMJlmKO ajnxY8+vBKlK6CyNJ2Cj3pp0b7ZJC/XIVttJrrQCMBxLEqoFMlz9G9YiQWk19YJ31LtUL LzzDli5bJ4dZvi3iG+x4HSyjCtLuRq0fsuD/VqztpjLYeLnjWdafHyepBbLlusXS1SJQ1 /RAkjodOzz1KJEG/D48tm//S054faKJ/+XBybwp014D9y2Fdu7NzTMMHHw41D1HFeqA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=YwmOPny3; arc=none smtp.remote-ip=198.175.65.18 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CA7960A2605; Tue, 1 Dec 2026 14:19:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5CA7960A2605 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.a=rsa-sha256 header.s=Intel header.b=YwmOPny3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796134768; x=1827670768; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=7TmTME/Yr6PtnNMnt+fWKtYWn7jGGBzuPU8w0bG9wBI=; b=YwmOPny3MlC7nuMhehevx8BfaPzjcHv9lwYMIyek8gdCqRUIM1vHtTnx ajX7v4FUScmmDiSpLvtpAJwMJfUHYk0YqBuDSwQovIQnKJ59XJnLa0vFR 9LoILdReyhyyhVVD3XV50xWGCRjymes1WKJgRdXwVZCNzVUfJVlPFRKw5 UcQ01bSvfvGI9r1YJjJkzJxK5+cgYXJ7rp8G5InIM9QSWYkZNPXEZHw9X VBMQ5mY8HffbM5QkVGkCggfV/kCbGUZotWM2AsF+qs8pD9LGJoCAI5Y2P c9TvqXlOQxMzElaAM0kVd53qHTxkSh8mqzccQwoAe6yxMjEYxVW1IJE9l A==; X-CSE-ConnectionGUID: Li3XGMkGRpahAanO9sYa+Q== X-CSE-MsgGUID: XHq9gFPnTLuHfmEO2rIUow== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5019300" X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="5019300" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 06:19:24 -0800 X-CSE-ConnectionGUID: 1Kw56iNqS3y2xML7A1ABDw== X-CSE-MsgGUID: A3vempVWSHugL60R+idvMA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,244,1787036400"; d="scan'208";a="13380745" Received: from jf5300-15a101203tc.jf.intel.com (HELO meta-crater2c.jf.intel.com) ([10.54.113.49]) by fmviesa005.fm.intel.com with ESMTP; 01 Dec 2026 06:19:22 -0800 From: Daniel Byrne To: Shivank Garg , Ravi Jonnalagadda Cc: Andrew Morton , David Hildenbrand , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Karim Manaouil , Frank van der Linden , Teja Vojjala , Pravin Tamkhane , Kinsey Ho , Wei Xu , Matthew Wilcox , Davidlohr Bueso , Vinod Koul , Bharata B Rao , SeongJae Park , David Rientjes , Xuezheng Chu , Yiannis Nikolakopoulos , Dave Hansen , Johannes Weiner , John Hubbard , Peter Xu , Rik van Riel , Shakeel Butt , Tejun Heo , Fan Ni , Jonathan Cameron , "Aneesh Kumar K.V" , Nathan Lynch , Frank Li , Dan Williams , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Day , dmaengine@vger.kernel.org, Vinicius Costa Gomes , Frank Li , Dave Jiang , Daniel Byrne Subject: [RFC PATCH 07/10] mm/migrate: no filesystem reclaim under the batch's folio locks Date: Tue, 1 Dec 2026 06:12:56 -0800 Message-ID: <20261201141259.2124188-8-daniel1.byrne@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261201141259.2124188-1-daniel1.byrne@intel.com> References: <20261201141259.2124188-1-daniel1.byrne@intel.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit migrate_offload_batch_copy() calls the provider with the folios of the batch locked. A provider may allocate there. An allocation that enters filesystem reclaim can prune an inode whose truncate then waits for one of those folios, and the migration waits for the allocation. Call the provider in a memalloc_nofs_save() scope. This is a fix to "mm/migrate: add copy offload registration infrastructure" and is meant to be folded into it. Signed-off-by: Daniel Byrne --- A fix to patch 3. For folding into v7. mm/migrate_copy_offload.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/migrate_copy_offload.c b/mm/migrate_copy_offload.c index 335db8e80556..3d0784a8f047 100644 --- a/mm/migrate_copy_offload.c +++ b/mm/migrate_copy_offload.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -121,11 +122,19 @@ EXPORT_SYMBOL_GPL(migrate_offload_reason_mask_format); int migrate_offload_batch_copy(struct list_head *dst_batch, struct list_head *src_batch, unsigned int nr_batch) { + unsigned int nofs; int idx, rc; + /* + * The batch's folios are locked. An allocation of the provider's + * that reclaims could prune an inode whose truncate then waits for + * one of them: no filesystem reclaim from here. + */ + nofs = memalloc_nofs_save(); idx = srcu_read_lock(&migrate_offload_srcu); rc = static_call(migrate_offload_batch_copy_fn)(dst_batch, src_batch, nr_batch); srcu_read_unlock(&migrate_offload_srcu, idx); + memalloc_nofs_restore(nofs); return rc; } -- 2.43.0