From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A210C433EF for ; Mon, 18 Jul 2022 10:56:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 07FD88E0001; Mon, 18 Jul 2022 06:56:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 008A36B0072; Mon, 18 Jul 2022 06:56:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC3F38E0001; Mon, 18 Jul 2022 06:56:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C7DC86B0071 for ; Mon, 18 Jul 2022 06:56:52 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 910FB60DF4 for ; Mon, 18 Jul 2022 10:56:52 +0000 (UTC) X-FDA: 79699917864.15.B4F762D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 3306E18004D for ; Mon, 18 Jul 2022 10:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658141811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wznRRcQ1E1EPLsgI7kgVwWWa1K3DaSgJ1EEclGC9ESw=; b=OKL8ux2tjAPfTS4qPaAjjr11Epbb4FxyLNcKga6/w+cjh6UDoHFB0VSgtnUBDSEJQEPuWG bEQq1zw+Na1CIVk+rOylAkc8CGYCLxxUU56k81mPRM1BPL3TwX1J0XA98nQgZLW8cfwcr5 alGuvHxUpvEYjXAuV3J980h6WqKj83M= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-125-E2dFG7otNLSFbImBZbZzpg-1; Mon, 18 Jul 2022 06:56:32 -0400 X-MC-Unique: E2dFG7otNLSFbImBZbZzpg-1 Received: by mail-wm1-f71.google.com with SMTP id a18-20020a05600c225200b003a30355c0feso3815696wmm.6 for ; Mon, 18 Jul 2022 03:56:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=wznRRcQ1E1EPLsgI7kgVwWWa1K3DaSgJ1EEclGC9ESw=; b=c1LcA1jwzk++xLi8bZ4DDK6bMUIG94Hz5NUMEvdAAF0JU6sgICY8ts4RWWfL/9hPK8 Tv4Gvu1L38GZ1WtgvCFZVhtb/9LgcCnoo4CkKTAIfk8u7dsFe8j0keRqyVq0uRBF+P12 cd80PTHQ2/AmtXMVUYUpfe18mA9wV2rlUAhvQjdUYi4Yk+RdJufumEQfnz1Oq74Hy2c6 lwBRxgnxknAXktIZ2J+meFdVohTb75MKpp1QqzaLv773w/r0JB7DXcCKrDJqMO/yz9QA fbQcxIK5IxjfFBcH9o5hWS48N5/qYSkKbs8H3V+BtEqGr4Nzf6e6hbhSITeYi74aQb+X +ovw== X-Gm-Message-State: AJIora8BzHgPnbo2/o3UJ88aLxfryfstPSDOjixv/FkdjzMLjX92EPjI u/p4KV0sSmccEq3y7TAmCrrG8787T5E79fppiwB3OP112+i/6ethPhXkYB9n2yfr3QeeLlpkckm cdVMi4+8+Wk4= X-Received: by 2002:a05:600c:3b8d:b0:3a2:ea2b:d0f9 with SMTP id n13-20020a05600c3b8d00b003a2ea2bd0f9mr25454657wms.120.1658141791258; Mon, 18 Jul 2022 03:56:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1semjCkDwGjEQMzpCRvMdqQ/nTLWiXGmEKcwwSpdKliRLXOgrdG+Rkplh3ByVOTYHpbct/E2A== X-Received: by 2002:a05:600c:3b8d:b0:3a2:ea2b:d0f9 with SMTP id n13-20020a05600c3b8d00b003a2ea2bd0f9mr25454634wms.120.1658141790977; Mon, 18 Jul 2022 03:56:30 -0700 (PDT) Received: from ?IPV6:2003:cb:c705:7400:6b3a:a74a:bd53:a018? (p200300cbc70574006b3aa74abd53a018.dip0.t-ipconnect.de. [2003:cb:c705:7400:6b3a:a74a:bd53:a018]) by smtp.gmail.com with ESMTPSA id g1-20020a5d5541000000b0021d728d687asm12298516wrw.36.2022.07.18.03.56.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Jul 2022 03:56:30 -0700 (PDT) Message-ID: <225554c2-9174-555e-ddc0-df95c39211bc@redhat.com> Date: Mon, 18 Jul 2022 12:56:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH v9 06/14] mm/gup: migrate device coherent pages when pinning instead of failing To: Alex Sierra , jgg@nvidia.com Cc: Felix.Kuehling@amd.com, linux-mm@kvack.org, rcampbell@nvidia.com, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, hch@lst.de, jglisse@redhat.com, apopple@nvidia.com, willy@infradead.org, akpm@linux-foundation.org References: <20220715150521.18165-1-alex.sierra@amd.com> <20220715150521.18165-7-alex.sierra@amd.com> From: David Hildenbrand Organization: Red Hat In-Reply-To: <20220715150521.18165-7-alex.sierra@amd.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OKL8ux2t; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf16.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1658141812; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wznRRcQ1E1EPLsgI7kgVwWWa1K3DaSgJ1EEclGC9ESw=; b=Enimr7fdJOrbIr81xvkIFXdf2jQuCF3FsInMhO6Wd0G1aA/WEe2bsKKReD6QhnwsXA5hZC 1p7XQyYD4VXsYSl2MGfdpwc7If02ZEQXLVGUxeukCPZjQbhVTy6V8PdRLQBBrWlc5O/tTD ugAltI9jwMz5AJz5LzfkBuFMqp9gbhg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1658141812; a=rsa-sha256; cv=none; b=YzOkScGi/VoEp97celE8bzeq0LUF+Oc+7ul9wNhOmUNTjSLv7LfrMKFjf8EwUxIuUrnhjJ 0ruU9o/U5BX8WImj6lGiL0h/T7LzVJTCtC7XnzMzJsqacEEkU+0w4kb2ExXwT1nIuwlVGj bizSjSD92g0+3S4/TaclnPoJKzzIOas= X-Rspamd-Queue-Id: 3306E18004D X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=OKL8ux2t; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf16.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam11 X-Stat-Signature: z36ufdmr5bzohrepc4urukc49qzmfexp X-HE-Tag: 1658141812-110265 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 15.07.22 17:05, Alex Sierra wrote: > From: Alistair Popple > > Currently any attempts to pin a device coherent page will fail. This is > because device coherent pages need to be managed by a device driver, and > pinning them would prevent a driver from migrating them off the device. > > However this is no reason to fail pinning of these pages. These are > coherent and accessible from the CPU so can be migrated just like > pinning ZONE_MOVABLE pages. So instead of failing all attempts to pin > them first try migrating them out of ZONE_DEVICE. > > [hch: rebased to the split device memory checks, > moved migrate_device_page to migrate_device.c] > > Signed-off-by: Alistair Popple > Acked-by: Felix Kuehling > Signed-off-by: Christoph Hellwig [...] > /* > * Try to move out any movable page before pinning the range. > */ > @@ -1919,7 +1948,8 @@ static long check_and_migrate_movable_pages(unsigned long nr_pages, > folio_nr_pages(folio)); > } > > - if (!list_empty(&movable_page_list) || isolation_error_count) > + if (!list_empty(&movable_page_list) || isolation_error_count > + || coherent_pages) The common style is to a) add the || to the end of the previous line b) indent such the we have a nice-to-read alignment if (!list_empty(&movable_page_list) || isolation_error_count || coherent_pages) Apart from that lgtm. Reviewed-by: David Hildenbrand -- Thanks, David / dhildenb