Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1374266rdb; Fri, 16 Feb 2024 13:51:42 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUYDa2NUlHR88mtADJBBS2Hdv6G9e1vJeNSG+AooN8NznayK9NeUaEbvxEOklfl8G9HP/L0wm0HB4lEa9Y6B71CXrws+2TnI3Eo8hDEog== X-Google-Smtp-Source: AGHT+IGnXJ2tE6TM163zQWHAbhAhGmx/JSM8ihw2BNTCkMfatwywVS4oTq8Qrc2A9PPU6qP4aRwA X-Received: by 2002:a0c:f38c:0:b0:68f:2e24:6156 with SMTP id i12-20020a0cf38c000000b0068f2e246156mr3575285qvk.16.1708120302606; Fri, 16 Feb 2024 13:51:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708120302; cv=pass; d=google.com; s=arc-20160816; b=tIQWDNkzaf9cxeb2D1fPouXVXaOjys9hbOk1Rg23oV2JjenD+kAmEJ5QDZRGo4Fq4y zH0TKU8KnzcqfTvWTUvgSDcY8XtnjfsQAmzSk2407sfAjqc+Rl8HV6jfU9sJ6/3T3zlv Q3u22AQj6piKE4YHr0KpS33B6IbbNQlmGRt61+gMKSmyRE6NSsVekeyVZiLobqLJDsQ9 pE0GIDVV4LSWC/eZNHR3SNws5bAq7Wrkp6FsfntOp966YUaMQ4siMtbVQwz44Mc20vNj RYJ2TKA8CcLg4jsJYOphQqQ/AIhl3fOdBYZdApnjFU+w/SIOVoKefns8vr/YqJGGu6G5 FkDQ== 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=F/d77mOZpymq/QjhDN4sQI8qnbKDDHBwnLdqx/RJq80=; fh=dWiF9yA75H1aqs9gWsUd3EBPP3Gm973tCc8eTJiqNVE=; b=LXs5OkVRflJMwuGLVNplFMh5FnMwZYrx9nrWULH3Rvy08x6OFY/Olb3R1YzFjRkmzk PRjxiiHJhpfQwOcD6StRXCiGxpI/HdpXYXyZQunQG659PCljXQXVVR4EDvOv5m+UA0+h +QqZ9chGG36adSs5HLOiVHumtAHoPIgzpZrAVeRHofbDOwLUWHHAjh7kDoYKC5hvFtYX UPbouOH4VB1wHtSOeZM1VAuIsZkeBSFIujKmXwgf8sD0GvmjikzzXqoUv0IrHNpyCGdn Q43BPosZFGEl/5XCa2JDsFDvynUr0L69oiv5Ivg43MUpx4h6c/VIMtfZHl0W4SKgXcUQ 7F2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FWsU4Mnn; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-69378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69378-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 7-20020a0562140d0700b0068f3fccc51csi712284qvh.271.2024.02.16.13.51.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 13:51:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=FWsU4Mnn; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-69378-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69378-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5D39F1C22CCB for ; Fri, 16 Feb 2024 21:51:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 605EB146917; Fri, 16 Feb 2024 21:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="FWsU4Mnn" 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 BAF6F146009 for ; Fri, 16 Feb 2024 21:51:33 +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=1708120296; cv=none; b=mL2XZMfICJqOT+J4kRhkqToO7bb2aCNfDluua726dKSAcR/O1Q+xT89hMHGU+5bthhPDvrOnIrUV+K/NmYPZW55zU2IVDOLByf6BxbWTHlt0isAyjSRAFbf5yhyhAmXzULhaYuO//YCBrfLbL6QsTb2BmaDlUp+QZk/EJRdkxJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708120296; c=relaxed/simple; bh=BsjsUA6OOZ5TN1SPbdQUI7UhAJGf1pVK1HFsnohjbX0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=f37Vg1TGWXv8DViaajIG1M/SoGnioGH2sem8IN4M1E3WrGYFbjAkSrC0vmhf/9NxlYAtMqCZ4+JXcTYHr+hB0wgUxDKkuQjJpBY4EFaJD5N02blD17S9wgLAlGnSKp5MVg8Zz0NjMkyDLqdy69QdAtnCkSKDRLOLz5zDyY+VcWA= 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=FWsU4Mnn; 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=F/d77mOZpymq/QjhDN4sQI8qnbKDDHBwnLdqx/RJq80=; b=FWsU4MnnWkT180rHy8EX4JrqFI W4B/fytKg4dXU+KXkHiYbWv0N2PTHkneBwk/SlyeCPfpLYIeOMA46mkoMijUct9jTh1vAgJnSK8jO dQ+tiwmk2D94Wv1EoJ6MkhN4HzalJ6VOZxvJTXixnmlRWJDOaylVBm2rMyFQcD0Z67qi6rPbxeyhb IWSS3J1r7uEuRcR1CUcT9HxQGTQ9Y+S2TlgduQ6AGBR3H5e7YUXMryUzxvL76gXxDvOrYdp01iclx qT8abDeyqaQ5jMG+5FVDP5+tjWxr6kRUvDpk8RnAth2Ao2HHg5UWou0Foy8ltSBfAWrIM2c7tXzXh 11jWZXoQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rb67H-00000005kZ6-0hkK; Fri, 16 Feb 2024 21:51:31 +0000 Date: Fri, 16 Feb 2024 21:51:31 +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 2/6] mm/migrate_device: further convert migrate_device_unmap() to folios Message-ID: References: <20240216211320.222431-1-sidhartha.kumar@oracle.com> <20240216211320.222431-2-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-2-sidhartha.kumar@oracle.com> On Fri, Feb 16, 2024 at 01:13:16PM -0800, Sidhartha Kumar wrote: > migrate_device_unmap() already has a folio, we can use the folio > versions of is_zone_device_page() and putback_lru_page. > - if (page_mapped(page) || > - !migrate_vma_check_page(page, fault_page)) { > - if (!is_zone_device_page(page)) { > - get_page(page); > - putback_lru_page(page); > + if (folio_mapped(folio) || > + !migrate_vma_check_page(&folio->page, fault_page)) { > + if (!folio_is_zone_device(folio)) { > + folio_get(folio); > + folio_putback_lru(folio); page_mapped() is not the same thing as folio_mapped(page_folio(page)). please include some argumentation about why this is a correct transformation to make.