Re: [PATCHv2] mm/migrate: clean up useless code in migrate_vma_collect_pmd()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 8/7/19 1:41 AM, Pingfan Liu wrote:
Clean up useless 'pfn' variable.

Signed-off-by: Pingfan Liu <kernelfans@xxxxxxxxx>
Cc: "Jérôme Glisse" <jglisse@xxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx>
Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
Cc: Matthew Wilcox <willy@xxxxxxxxxxxxx>
To: linux-mm@xxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
  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);
/*
  		 * By getting a reference on the page we pin it and that blocks


Thanks, I was planning to do this too.
Reviewed-by: Ralph Campbell <rcampbell@xxxxxxxxxx>





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux