Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3108357ybt; Mon, 22 Jun 2020 15:22:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziYifHMnvj7Wvk+XQIsVole7FFwpla6NhOnhuA0kbO9ABsflNmIZOCX0KRpQN0UoYvwoxx X-Received: by 2002:a17:906:6b8a:: with SMTP id l10mr16658826ejr.465.1592864565591; Mon, 22 Jun 2020 15:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592864565; cv=none; d=google.com; s=arc-20160816; b=KA41bsGrgtTs/dPmJkBYYtnjQys2OqQUqR6ejqSyewi4jOh5S+YmKWHOp/10A1gSub DS6XF03rEUtmYRWxDcPNY4FKXjeRUlVE75e7FjqgEj18Q+fxyfm1mrE6sczJu2wejAgT XC1XMlqpq9SCg90As1Gk9VNA/uBDSL1mYnJB9A2abrGO1xvxBFmPlm1isZ8yV3shPT7l ynwgKNr7eM9bwogBnRr+C6ytat54loFFg/N0qkv4tEWclBC4HuDRfPBlt2H3tUkx3cyU zw1957cV1Ore8OAfQeU3/J2AMsNC1qGHI483cIGubwe7jjRaG/YIwF6fY0DmYS4PsapV Dpmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=ySmyg12ZvnX4sON6UJTDpZrJIeJKTXH2UZeIMBkOFh8=; b=Qh5LrntpsWwl+hSzDlKFFQzSXyiOf54EjZygJGXlAGv9xpA8+Sk5623Fa7kyKhqcxT G5rfNeGBmQuE7Yh/i/Oen5mC0WoCrUWw/zi16yZa3QS9yEGPmVZ9w3Ay14M2b660a0Ts NqS2EZI2r0bc2y+uLYYFgBeU2ldXAV/7imbw6CMOUT+EWLEqWldF1MUEwJRaeEC4IxNG lSRxecfNwAXhZPujCoZAfLqNwhYPffS6GZxvWXXz3Hnsx1HcBPPBUEFYFnVl2z0S5QRP LvrXb4tS3R9eDTelTJf+ihqEFYSQKfTeWec/orB/kr6eNE5SXq5GDJeeIGk8lXE4petd G80A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=JxJcBBvu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i14si9950942ejz.362.2020.06.22.15.22.22; Mon, 22 Jun 2020 15:22:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=JxJcBBvu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730937AbgFVWU0 (ORCPT + 99 others); Mon, 22 Jun 2020 18:20:26 -0400 Received: from hqnvemgate25.nvidia.com ([216.228.121.64]:11272 "EHLO hqnvemgate25.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730840AbgFVWUZ (ORCPT ); Mon, 22 Jun 2020 18:20:25 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate25.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Mon, 22 Jun 2020 15:19:40 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Mon, 22 Jun 2020 15:20:25 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Mon, 22 Jun 2020 15:20:25 -0700 Received: from HQMAIL107.nvidia.com (172.20.187.13) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Mon, 22 Jun 2020 22:20:18 +0000 Received: from hqnvemgw03.nvidia.com (10.124.88.68) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Mon, 22 Jun 2020 22:20:18 +0000 Received: from rcampbell-dev.nvidia.com (Not Verified[10.110.48.66]) by hqnvemgw03.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Mon, 22 Jun 2020 15:20:18 -0700 From: Ralph Campbell To: , CC: Jerome Glisse , John Hubbard , Christoph Hellwig , Jason Gunthorpe , "Andrew Morton" , Ralph Campbell Subject: [RESEND PATCH] mm: fix migrate_vma_setup() src_owner and normal pages Date: Mon, 22 Jun 2020 15:20:08 -0700 Message-ID: <20200622222008.9971-1-rcampbell@nvidia.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: quoted-printable Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1592864380; bh=ySmyg12ZvnX4sON6UJTDpZrJIeJKTXH2UZeIMBkOFh8=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: MIME-Version:X-NVConfidentiality:Content-Transfer-Encoding: Content-Type; b=JxJcBBvujeFk6CmyTc7FOCIAh0CEb3Tkllm/M6lhjXEWpvIXr3LbCH7+4VeCgmxYX w+zDJCSFAjsjBNGVqAixxnp9C30xqNvMtC1a/IMBep1BceLsN4bV8ft0CJTvPeCTHl BJJfU7l0TSUMsl/cFDBNTDyMI9waxcPUPSF4Sk7aiCT8OPV+FKN/A6DYUBOaN+kN7P o2Q/bIW39koLi/7ZZoOdpjc8XKTQyBct68HE1CT9cgV/H/zTFCzFQFlfMGbHF8mj9c i79N6Be5FqjJ+/LR7uyMaV66yVuSGEN37GyY2LRYJpEChbRPNJSl8eIEj0EOpRYwtY lnmPACycThJJg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The caller of migrate_vma_setup() does not know what type of page is stored in the CPU's page tables. Pages within the specified range are free to be swapped out, migrated, or freed until after migrate_vma_setup() returns. The caller needs to set struct migrate_vma.src_owner in case a page is a ZONE device private page that the device owns and might want to migrate. However, the current code skips normal anonymous pages if src_owner is set, thus preventing those pages from being migrated. Remove the src_owner check for normal pages since src_owner only applies to device private pages and allow a range of normal and device private pages to be migrated. Fixes: 800bb1c8dc80 ("mm: handle multiple owners of device private pages in= migrate_vma") Signed-off-by: Ralph Campbell --- This is based on 5.8.0-rc2 for Andrew Morton's mm tree. I believe it can be queued for 5.8-rcX after being reviewed. This was part of a larger series but I'm resending it separately as suggested by Jason Gunthorpe. https://lore.kernel.org/linux-mm/20200619215649.32297-1-rcampbell@nvidia.co= m/ mm/migrate.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index f37729673558..24535281cea3 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2295,8 +2295,6 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, if (is_write_device_private_entry(entry)) mpfn |=3D MIGRATE_PFN_WRITE; } else { - if (migrate->src_owner) - goto next; pfn =3D pte_pfn(pte); if (is_zero_pfn(pfn)) { mpfn =3D MIGRATE_PFN_MIGRATE; --=20 2.20.1