From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 891703DA7E3 for ; Mon, 27 Jul 2026 22:43:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785192212; cv=none; b=DxTjhqB91EJCMy8+WHyACursWA6EzrGNnfyRVBMoUsKTWwxjee7LHn1W/dvt5GoYzSuPP2tPpeT/QeaipUgQuFKbcCKqvOkVdyrkLMiIrcGo7yp/GxMTfKJThutaF7c8IGtmIx63JMPtxWuel0xY6WZzAc3Qg+fcKVso0htHeVc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785192212; c=relaxed/simple; bh=CYOoYVSum0gE7bps3oB8FVtHgB0bFgXu4gZKWucbwKI=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=uN2pQMOi6U3/iyyCV45JuJw/X3tje7SE9+oZS7tjX0dZWKrpotEA9Tltp6gt95NfCr9Zo9QQD4yjDRaiq+zn5FuBFRD4Lu8GxiFeBJO5gAwovEtS8XGVb1zS8CJT0fKRH6rBnj79A1z4thYImkcgFcsGslcwXbCpMEjTGFxnd7Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=cgbeVCLT; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="cgbeVCLT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD00C1F000E9; Mon, 27 Jul 2026 22:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1785192211; bh=Y3noW5ZYUlE/zDzyfrBegKr4xtPlTc1PQVGAQCuLqpQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=cgbeVCLTSq+7AMno+cyMEI4Wwt72sfI+qGJWUytMOyTKAJSGiGS6VsE8uwInfWs7K ebfFb5OZhctkcRpg3BpCU8yIW8Hmc/qxevBQT8ZPpcyCHqfLK7pNYcpohZAO2uyME4 EV/YOrsSRbZqbsC1Se0YNbxhrbzPFrSRxUsckY/I= Date: Mon, 27 Jul 2026 15:43:30 -0700 From: Andrew Morton To: "Yadav, Arvind" Cc: Balbir Singh , , , , , , , , , , , Subject: Re: [PATCH v3] mm/migrate_device: Clear stale mapping after freeing swapcache Message-Id: <20260727154330.cbe743a0a9518ccfe2437aac@linux-foundation.org> In-Reply-To: <439924d5-b51a-40f7-bd96-42fa43eef0e0@intel.com> References: <20260727053920.3494211-1-arvind.yadav@intel.com> <0ea36640-36bc-47a9-8d57-edc886e13aeb@nvidia.com> <439924d5-b51a-40f7-bd96-42fa43eef0e0@intel.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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 On Mon, 27 Jul 2026 16:28:42 +0530 "Yadav, Arvind" wrote: > >> --- a/mm/migrate_device.c > >> +++ b/mm/migrate_device.c > >> @@ -1182,6 +1182,11 @@ static void __migrate_device_pages(unsigned long *src_pfns, > >> MIGRATE_PFN_COMPOUND); > >> goto next; > >> } > >> + /* > >> + * reset nr so that only first after-split folio > >> + * is processed below > >> + */ > >> + nr = 1; > > We should also add a VM_WARN_ON_ONCE(folio_test_swapcache(folio)) > > > Agreed , but folio_test_swapcache()  is not valid immediately after the > split, as the order-0 folios may still be in swapcache. > I’ll use just before nr = 1 AI review suggest there might be another bug in here: https://sashiko.dev/#/patchset/20260727053920.3494211-1-arvind.yadav@intel.com