Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp90429ybl; Thu, 15 Aug 2019 13:15:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYtDihjYkNT9mi3YwIeU8Dfz5U1KivC9u3faua+Q3EoHt7cpyE3MsOH/mhZIt2xfeeh8TB X-Received: by 2002:a17:902:8492:: with SMTP id c18mr5950579plo.279.1565900140579; Thu, 15 Aug 2019 13:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565900140; cv=none; d=google.com; s=arc-20160816; b=vqAYx5v15BL4IbkYsq/WzvRqKPkhDSGSCrNTMVBomvDWuLTlVahUyRsl8+8xe7xx1H HqCcx8Ny1tOV8ELR7ybpcqcxjv/u7FpEOvJeMtn5rRIRrQgKcPX1gWvH9mSU/fMLf+Jd SFzgTxz3Yo45zJbFET2LvwWoI6bbcITstUYNlWZIBzr7b8/FP/IsQKV5dEm+5RGAtbgE MYgqn5HzLjdl6cieoODdpEwpqnatnrH+alKbObc6yNIYDufG87MnQmwrl461KcHYqY6v MVlyRw/v1bf/TUdI5mj8nzr98nPoG9u/D0iFpOy5bVR4N6yXuvC5vaA/cTdSdBBbdHtX t4RQ== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=vkjRswpUjtZfCjVU2R9I+hlvzvOMVMgQk4AI8p27uwY=; b=jfgM1kYiONEDUaaeBClOp/JUScNsSkBj24WLIFHoARQxcEzY3XCDpd/RrHnrcvqTlF cEbjcUCcNv2m/arLa2QJ/6R/zXVVv9qR/8uW5qf9y/A7Iym9u/qY5AO9pO96ncyGDpWa 3ABbWmle1OHpqHOEcJG22UnUWridqvyMa0wpF3tpgSW8NJs9n7vqzaCzxVL7a3sjmWVA W22aVWmgw/03b1cglxTQUZNPqFdqxUbTzt7RHJU4JF7qOYh5lBZE0wx9rU+3/k69JZ6u h/tKn7+5idWeRyOttYyJNbkuRncOKuRbWS7vYrqE1gbKaXGQKEG4MHRdUE6w7aeKEGR/ Ly7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=P+RSFj2M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 91si2569911pld.380.2019.08.15.13.15.24; Thu, 15 Aug 2019 13:15:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=P+RSFj2M; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1732293AbfHOTXq (ORCPT + 99 others); Thu, 15 Aug 2019 15:23:46 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:8753 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728979AbfHOTXq (ORCPT ); Thu, 15 Aug 2019 15:23:46 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 15 Aug 2019 12:23:47 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 15 Aug 2019 12:23:45 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 15 Aug 2019 12:23:45 -0700 Received: from rcampbell-dev.nvidia.com (10.124.1.5) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 15 Aug 2019 19:23:44 +0000 Subject: Re: [PATCHv2] mm/migrate: clean up useless code in migrate_vma_collect_pmd() To: Jerome Glisse , Pingfan Liu CC: , Andrew Morton , Mel Gorman , Jan Kara , "Kirill A. Shutemov" , Michal Hocko , Mike Kravetz , Andrea Arcangeli , Matthew Wilcox , References: <20190807052858.GA9749@mypc> <1565167272-21453-1-git-send-email-kernelfans@gmail.com> <20190815171918.GC30916@redhat.com> X-Nvconfidentiality: public From: Ralph Campbell Message-ID: Date: Thu, 15 Aug 2019 12:23:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <20190815171918.GC30916@redhat.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL105.nvidia.com (172.20.187.12) To HQMAIL107.nvidia.com (172.20.187.13) Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1565897027; bh=vkjRswpUjtZfCjVU2R9I+hlvzvOMVMgQk4AI8p27uwY=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=P+RSFj2MK6qwETLKT3U+Kgh8Zs/QjjEaL0NaxpNb2FGAew8lBC7SrZjoYTNsxIUBC sRqNyCTBmnUsDzC54aJbweOncfryqggz82LyC5JFGjngwplsubbikkOzZ6adhvbyfm NTC5la+MqrS4VXQRgugtcuB7+IFTLxd5VIbuak6jhvOI9uPTRM+jRB7FepjPo2S25t gfWzV2WehEd1RnVieZvPRERjdwuq1jhfHZ8cJftn4CDkCLF8s+Lp8Q7f+n4shOekD/ 3AnIjoPlvxEWtSGAzchogN8DcBDpOrFqqJHROWMLYQQ3oW3aoKWxRyCq9hqP+rhLpm s/RnpwxqsXG6A== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/15/19 10:19 AM, Jerome Glisse wrote: > On Wed, Aug 07, 2019 at 04:41:12PM +0800, Pingfan Liu wrote: >> Clean up useless 'pfn' variable. >=20 > NAK there is a bug see below: >=20 >> >> Signed-off-by: Pingfan Liu >> Cc: "J=C3=A9r=C3=B4me Glisse" >> Cc: Andrew Morton >> Cc: Mel Gorman >> Cc: Jan Kara >> Cc: "Kirill A. Shutemov" >> Cc: Michal Hocko >> Cc: Mike Kravetz >> Cc: Andrea Arcangeli >> Cc: Matthew Wilcox >> To: linux-mm@kvack.org >> Cc: linux-kernel@vger.kernel.org >> --- >> mm/migrate.c | 9 +++------ >> 1 file changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/mm/migrate.c b/mm/migrate.c >> index 8992741..d483a55 100644 >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -2225,17 +2225,15 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, >> pte_t pte; >> =20 >> pte =3D *ptep; >> - pfn =3D pte_pfn(pte); >> =20 >> if (pte_none(pte)) { >> mpfn =3D MIGRATE_PFN_MIGRATE; >> migrate->cpages++; >> - pfn =3D 0; >> goto next; >> } >> =20 >> if (!pte_present(pte)) { >> - mpfn =3D pfn =3D 0; >> + mpfn =3D 0; >> =20 >> /* >> * Only care about unaddressable device page special >> @@ -2252,10 +2250,10 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, >> if (is_write_device_private_entry(entry)) >> mpfn |=3D MIGRATE_PFN_WRITE; >> } else { >> + pfn =3D pte_pfn(pte); >> if (is_zero_pfn(pfn)) { >> mpfn =3D MIGRATE_PFN_MIGRATE; >> migrate->cpages++; >> - pfn =3D 0; >> goto next; >> } >> page =3D vm_normal_page(migrate->vma, addr, pte); >> @@ -2265,10 +2263,9 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, >> =20 >> /* FIXME support THP */ >> if (!page || !page->mapping || PageTransCompound(page)) { >> - mpfn =3D pfn =3D 0; >> + mpfn =3D 0; >> goto next; >> } >> - pfn =3D page_to_pfn(page); >=20 > You can not remove that one ! Otherwise it will break the device > private case. >=20 I don't understand. The only use of "pfn" I see is in the "else" clause above where it is set just before using it.