Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2397252ybl; Thu, 15 Aug 2019 11:08:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7XDbes8Mn9pXz4k7TeEKVwsLo8rDf1VncV/Pp73KbV3PEPQtUJQIM1s1q8BKStBG/BNqY X-Received: by 2002:a63:6c46:: with SMTP id h67mr4582541pgc.248.1565892524331; Thu, 15 Aug 2019 11:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565892524; cv=none; d=google.com; s=arc-20160816; b=uVMNJEpKvtmnMq81YhpVbfocjtGopFkOJGrYFuFYQ5mG+Eryrofh0T0MCM+9/65JPG Jj/Yat+UvAvJYdmHCsAVbRzAFpttFZOf6P+MJ2caj0cwd4tOphbWy7XHakrujjqSYcOE obgECG6nMOKZl8ZA+19wYkHBjUnZoeIz0TFXe7iNHVf3XPd0p77/ysPmd34plrkzVcUT 7r8u6wY1CmtSEUoH3HECyaQydH2kXHaKtuKTsO04TFrK32BPWI1NYzg1jMviJtQ3wJKx ZwsHCM27ssgNqB0dcQQHeTe1byvL2P0BjSvHUYxPXLuPqyJjSxWohEiVxSTELVcKmKGP T5uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=8mIQDYSk205bLQDAx8X+Lu4d85e3NH0eLtSZuXHddS4=; b=G/xIXuUcTr1uU3pl4ot87XTsBqrhJut+eRhJley5VCDqBtz7oMDnAx5VdccW2K2wXM 447HXbNXBJMc7FC2Cl08NdcdqAk0FWk4zBqol2z6f8WXuD9gZ7gXCKR7JJrSDBmu8avw rMlOT+h1x+6K5rHh5TXMFRy0xxmoVRjnxRHJdmRUyf3Dq3ct5CG6GVKHrnwe+EnBBRnG p97qCEbZuRBcwYIoMPPDMTQ4E1lZ+PMKg3vrenXdSEetKmFG/grAYXhUovD4ctl1MCKD q5KkVeuzMGP//vbu1WsUkR1dnqvTSRxWCe0l0hDFD5/t9HczYzkLAplCjbMpBGXsCyJV FPTQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5si2220767pgc.29.2019.08.15.11.08.28; Thu, 15 Aug 2019 11:08:44 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732157AbfHORTV (ORCPT + 99 others); Thu, 15 Aug 2019 13:19:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60766 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731134AbfHORTV (ORCPT ); Thu, 15 Aug 2019 13:19:21 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 41DFE8535C; Thu, 15 Aug 2019 17:19:21 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24D02601A4; Thu, 15 Aug 2019 17:19:20 +0000 (UTC) Date: Thu, 15 Aug 2019 13:19:18 -0400 From: Jerome Glisse To: Pingfan Liu Cc: linux-mm@kvack.org, Andrew Morton , Mel Gorman , Jan Kara , "Kirill A. Shutemov" , Michal Hocko , Mike Kravetz , Andrea Arcangeli , Matthew Wilcox , linux-kernel@vger.kernel.org Subject: Re: [PATCHv2] mm/migrate: clean up useless code in migrate_vma_collect_pmd() Message-ID: <20190815171918.GC30916@redhat.com> References: <20190807052858.GA9749@mypc> <1565167272-21453-1-git-send-email-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1565167272-21453-1-git-send-email-kernelfans@gmail.com> User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 15 Aug 2019 17:19:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 07, 2019 at 04:41:12PM +0800, Pingfan Liu wrote: > Clean up useless 'pfn' variable. NAK there is a bug see below: > > Signed-off-by: Pingfan Liu > Cc: "J?r?me 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; > > pte = *ptep; > - pfn = pte_pfn(pte); > > if (pte_none(pte)) { > mpfn = MIGRATE_PFN_MIGRATE; > migrate->cpages++; > - pfn = 0; > goto next; > } > > if (!pte_present(pte)) { > - mpfn = pfn = 0; > + mpfn = 0; > > /* > * 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 |= MIGRATE_PFN_WRITE; > } else { > + pfn = pte_pfn(pte); > if (is_zero_pfn(pfn)) { > mpfn = MIGRATE_PFN_MIGRATE; > migrate->cpages++; > - pfn = 0; > goto next; > } > page = vm_normal_page(migrate->vma, addr, pte); > @@ -2265,10 +2263,9 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, > > /* FIXME support THP */ > if (!page || !page->mapping || PageTransCompound(page)) { > - mpfn = pfn = 0; > + mpfn = 0; > goto next; > } > - pfn = page_to_pfn(page); You can not remove that one ! Otherwise it will break the device private case.