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 D3B4DC43334 for ; Thu, 30 Jun 2022 10:04:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BB3A8E0001; Thu, 30 Jun 2022 06:04:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 26BDC6B0073; Thu, 30 Jun 2022 06:04:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 132C58E0001; Thu, 30 Jun 2022 06:04:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 052F56B0072 for ; Thu, 30 Jun 2022 06:04:14 -0400 (EDT) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id D1EFA6122B for ; Thu, 30 Jun 2022 10:04:13 +0000 (UTC) X-FDA: 79634466786.29.6F26D18 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf08.hostedemail.com (Postfix) with ESMTP id 6351316003F for ; Thu, 30 Jun 2022 10:04:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656583452; 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=DmU0ygkfQICKkJrotNjuaw4hfz5r1ur5tb6+FXoicmQ=; b=G1AVLzD1DiKVZJQyxTjqAJSb2eMIubO1H92b43P1C/faa3FRxM8cebCnihl+ABy3+7sbhB hGSh+oHGlz72RgiqyJglfbPwmj75EmpCTcsi0ZcJmPQKpdDdeAQYA+5FTvwGfq7u1Nbb1F mOsZtKYd7AuHrSy1jnAesoUXieM5Sl0= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-31-WqchLcTxMWC43kCXKkk1fw-1; Thu, 30 Jun 2022 06:04:11 -0400 X-MC-Unique: WqchLcTxMWC43kCXKkk1fw-1 Received: by mail-wr1-f71.google.com with SMTP id z11-20020adfc00b000000b0021a3ab8ec82so3008020wre.23 for ; Thu, 30 Jun 2022 03:04:11 -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 :content-language:to:cc:references:from:organization:subject :in-reply-to:content-transfer-encoding; bh=DmU0ygkfQICKkJrotNjuaw4hfz5r1ur5tb6+FXoicmQ=; b=p6s2su5SM34Ati9IvHFt0l9gEeOvXyFjFOOgkEDsyMxedyYrXSDpiJVYeMOThZDMEu h4WTtkl6ZBIajilQuIUOK0WoKszu2VPwMLcdZ7A0W/2YHetZ6a121vEO9BMKbmnlBPrA GF90oXAxtxTssWIZlFAB/KrDdfB/LtWRqfipnzqGYc+r/j/i7c+qhSPl9I2PgK+9MrFA /tanqeM2mSl59kdm5izxOxY+NxdDhJ9+f99g/1oM8OUBkwyKMj3zil8/Y4+gSvFGXCKq lZ1f9kvtFBMlIogbyJZIfpi1X8O3j/VTEjniFilt9z3G/nc8lhSvHKwGlN5gcdpV3K7t oYPA== X-Gm-Message-State: AJIora8H7GrNllcwb4fAs8iAX7sdPmdooc3ddunTgy6XM/rqq1E7d1W8 O7jkCd5PAuEbSrNntpYJunDBelk5jz9gGzTeSc2Mb4iL9zcxt6+1aNK9tmGfcdyGQSyJDNZH5Hc 5whnLsnR6FoQ= X-Received: by 2002:a7b:c152:0:b0:3a0:3e53:aa17 with SMTP id z18-20020a7bc152000000b003a03e53aa17mr11394765wmi.78.1656583450246; Thu, 30 Jun 2022 03:04:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vuI1sm5VybPo4wkaCR+sryKNwQzXdsHV339ZfkUZFjdgFAR5z/wUEvUcNLFrEOEmcW1irqSA== X-Received: by 2002:a7b:c152:0:b0:3a0:3e53:aa17 with SMTP id z18-20020a7bc152000000b003a03e53aa17mr11394724wmi.78.1656583449915; Thu, 30 Jun 2022 03:04:09 -0700 (PDT) Received: from ?IPV6:2003:cb:c708:7f00:214b:cffb:c693:2b71? (p200300cbc7087f00214bcffbc6932b71.dip0.t-ipconnect.de. [2003:cb:c708:7f00:214b:cffb:c693:2b71]) by smtp.gmail.com with ESMTPSA id j22-20020a05600c1c1600b003a046549a85sm2150594wms.37.2022.06.30.03.04.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Jun 2022 03:04:09 -0700 (PDT) Message-ID: <956b1c51-b8f1-0480-81ca-5d03b45110f7@redhat.com> Date: Thu, 30 Jun 2022 12:04:03 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.0 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: <20220629035426.20013-1-alex.sierra@amd.com> <20220629035426.20013-5-alex.sierra@amd.com> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH v7 04/14] mm: add device coherent vma selection for memory migration In-Reply-To: <20220629035426.20013-5-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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656583453; 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=DmU0ygkfQICKkJrotNjuaw4hfz5r1ur5tb6+FXoicmQ=; b=XBXH0QS58qTNoGjCz9dUz3jb8XBGaY3Izx9uTFCv0cIMT9uzVimr5Izf+VitrxiXD+rXom Y6AcEn5xFbcMx6qKXBB6ZU8KuUSBHz254Hje1qdIbm6lfe4it25ICzT890LwCIqkLK1OYd 2yqV6uORMCvSJjDQg8abFXD+WwJ+y5w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656583453; a=rsa-sha256; cv=none; b=1s036gRVvJLY4i/1x4JD9tE7kVURZpWbgo6jxDkPKo8/dzmmQoS8Fbf/TmajnxWUTlhae/ ouPsbNSx+g78MBSnGb5LOPND/Cnu6S9Y/xamTVx1/psTY3EgzYa94LAzQLiMOTRlJfjwxe IKbVgyLlGLOZdEK7i23FT5gUP9JnQx0= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G1AVLzD1; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf08.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.129.124) smtp.mailfrom=david@redhat.com Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=G1AVLzD1; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf08.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: rspam03 X-Rspam-User: X-Stat-Signature: fk4wahzag667cidnx3uuescpze6i83fp X-Rspamd-Queue-Id: 6351316003F X-HE-Tag: 1656583453-68439 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 29.06.22 05:54, Alex Sierra wrote: > This case is used to migrate pages from device memory, back to system > memory. Device coherent type memory is cache coherent from device and CPU > point of view. > > Signed-off-by: Alex Sierra > Acked-by: Felix Kuehling > Reviewed-by: Alistair Poppple > Signed-off-by: Christoph Hellwig I'm not too familiar with this code, please excuse my naive questions: > @@ -148,15 +148,21 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, > if (is_writable_device_private_entry(entry)) > mpfn |= MIGRATE_PFN_WRITE; > } else { > - if (!(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM)) > - goto next; Why not exclude MIGRATE_VMA_SELECT_DEVICE_PRIVATE here? IIRC that would have happened before this change. > pfn = pte_pfn(pte); > - if (is_zero_pfn(pfn)) { > + if (is_zero_pfn(pfn) && > + (migrate->flags & MIGRATE_VMA_SELECT_SYSTEM)) { > mpfn = MIGRATE_PFN_MIGRATE; > migrate->cpages++; > goto next; > } > page = vm_normal_page(migrate->vma, addr, pte); > + if (page && !is_zone_device_page(page) && I'm wondering if that check logically belongs into patch #2. > + !(migrate->flags & MIGRATE_VMA_SELECT_SYSTEM)) > + goto next; > + else if (page && is_device_coherent_page(page) && > + (!(migrate->flags & MIGRATE_VMA_SELECT_DEVICE_COHERENT) || > + page->pgmap->owner != migrate->pgmap_owner)) In general LGTM -- Thanks, David / dhildenb