Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1441931rdb; Fri, 16 Feb 2024 16:57:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWmJutsEaWua8i6RF9WQN2jIu1tfGqjs6J7HIo7s6lU6nVz3acBCX2TSCKO1V5thJmAPIAZBdTGXpGGrVAaUuPYYQk7GOifNveOEmEtcw== X-Google-Smtp-Source: AGHT+IEYRLKG48Z581owAMFpNZeSHsYOW/UaMkehuN+OD4bcxqH69jsaYy9Y3AEwdvE7S93M9x+M X-Received: by 2002:a05:6a20:c792:b0:19f:ce3:5aee with SMTP id hk18-20020a056a20c79200b0019f0ce35aeemr7315292pzb.8.1708131426981; Fri, 16 Feb 2024 16:57:06 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708131426; cv=pass; d=google.com; s=arc-20160816; b=G1yxHLeHL/AnM0reoiI2SikAWvj45qZr2CwHunWYFFPcifUZib83z0OLUc2+uFXJhN wMzYgiox5ZT2HY4s9KmXJB+HvL49MIFok64GuFm8GrSzAOA90iADOdUmBKizAjCsTPCi w/FiaGXPdcFFYPsUR7qfJmWZV91PU3tIjD+lp5jGHCWSS1xXCc6TjMn05c/PCunmVM6z ivPxgHl0XpaY4dXqrp+0i4OUCI81Bmnz15/5kivKRj/klRHiM6dZCQ+gCl6pUwQUP+dx pnULv0GXWacauV2gHHPy2wbi7Ze11NE0gcoiln3y2rHNPJzaMNt4ow9o/GCCNhwZstVk MztQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=lkVDxIavKk9VGMg/gSf81GfZVUhmleFm6YT7D/wt+Qw=; fh=dWiF9yA75H1aqs9gWsUd3EBPP3Gm973tCc8eTJiqNVE=; b=tTBqDOi5eyiG2p3FdVrQ8kj0GQwqdhRGHEM9tZWwy5mtXDoqp14Uau3n4EoG3JuoYz sVSUQ9PbyG/GcES7qiWi/7AYv32PorLEJF1fumgBsgfMDSNqhZQr45JpNIMDHEDKXqr3 D8AOr6C2dY/McDDg7aAPE7umV8FKXnLAkQC6MfjDw8YSMPHYipk0mxH0RHAlbvEjYu5g 8BoWuyJgA0iBNp7Cih7KaT3t3xvcQsdnQhnQmpvfkaoVCYcmaolMvY4dDlVru+zVFh4B N8cgHbm/aYP/4Sv2UzdDXhKTpXLeGP2nWl8s/5+qOMxcn3psWd5O752J6adzN66welSY 2IDQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=AD2Vl+uu; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-69381-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69381-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id y7-20020a17090a600700b0029956b3f5basi194971pji.189.2024.02.16.16.57.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 16:57:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69381-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=AD2Vl+uu; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-69381-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69381-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7D24AB242DB for ; Fri, 16 Feb 2024 21:55:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E07D91482E3; Fri, 16 Feb 2024 21:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="AD2Vl+uu" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 9B9091420B8 for ; Fri, 16 Feb 2024 21:55:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708120539; cv=none; b=smZ/4nEekxao1SWU03I6aFSeFQer6/IchuszmGx6DcxWdpC1/idI2SBUSvntG17yN7Tz3xCEBD6EXKkbLoPfDDVooZP8xpT9XyIozMLvg0DhvwAui8Aqk3w4SaGiVQso26jIZ5JMXYlKBLLe/GqhAz7eRfvfVApP7UzW3FpgV+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708120539; c=relaxed/simple; bh=LBOYN+JUo3mpvDSAF3GaPjg1nnPQdn6JXlxBmZFGutw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tScdfZIjHA8dIYTxzKHhAU/JN77jkbAuWpQJ08e87sRDlzmOIlVeMeKaCmvTN0ZhAdlWq6mn87qyPSTFAE31ntbN42npdWKDod7CK4obIQgtTId0E4S0SmwXQkD/o87nrIfepRyrDI/AakcSUXw5nnaOCKwfrnHP+/Y6+mwpk28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=AD2Vl+uu; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=lkVDxIavKk9VGMg/gSf81GfZVUhmleFm6YT7D/wt+Qw=; b=AD2Vl+uuXk4j8IOTOfHAYMsr0w BrUnSyJsouCw97OVGrryVtICPc3s+BJw1hUqF0a160QdQpVIxOp6fP/CldTIpmc+t8d0/w3r9B9Lf RRq6pwv7jQUX0IMurQg3kPhb+JYBL1jipyZu+BcCJUoqXWhShhVw2GHlHARvJW5cUx7IE4Vwhc4xg u6dEFg61a0PDo1tcS5IeckYL3UszgpC5fUXoYQJlVp7meq39FxLmGe6+2j0Ecbn3aROvysFSYnDRf VB6H/0TJFVkJGLL2jCfAIwvYs4pv8f0Gx7IaIs8s+JpJEchyvGAJ76lvQfoWRcTfUfkjSXy3BvOi2 JiqqW+iw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rb6BA-00000005ko1-3kDg; Fri, 16 Feb 2024 21:55:32 +0000 Date: Fri, 16 Feb 2024 21:55:32 +0000 From: Matthew Wilcox To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, apopple@nvidia.com Subject: Re: [PATCH v2 4/6] mm/migrate_device: convert __migrate_device_pages() to folios Message-ID: References: <20240216211320.222431-1-sidhartha.kumar@oracle.com> <20240216211320.222431-4-sidhartha.kumar@oracle.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=us-ascii Content-Disposition: inline In-Reply-To: <20240216211320.222431-4-sidhartha.kumar@oracle.com> On Fri, Feb 16, 2024 at 01:13:18PM -0800, Sidhartha Kumar wrote: > Use migrate_pfn_to_folio() so we can work with folios directly in > __migrate_device_pages(). i don't understand why this would be correct if we have multipage folios. > @@ -719,33 +719,29 @@ static void __migrate_device_pages(unsigned long *src_pfns, > migrate->pgmap_owner); > mmu_notifier_invalidate_range_start(&range); > } > - migrate_vma_insert_page(migrate, addr, newpage, > + migrate_vma_insert_page(migrate, addr, &dst->page, seems to me that a migration pfn is going to refer to a precise page. now you're telling it to insert the head page of the folio. isn't this wrong? > @@ -753,13 +749,11 @@ static void __migrate_device_pages(unsigned long *src_pfns, > continue; > } > > - if (migrate && migrate->fault_page == page) > - r = migrate_folio_extra(mapping, page_folio(newpage), > - page_folio(page), > - MIGRATE_SYNC_NO_COPY, 1); > + if (migrate && migrate->fault_page == &src->page) shouldn't this rather be "page_folio(migrate->fault_page) == src"? ie we're looking for two pages from the same folio, rather than the page being the same as the head page of the folio?