From: Jerome Glisse <jglisse@redhat.com>
To: Ralph Campbell <rcampbell@nvidia.com>
Cc: Pingfan Liu <kernelfans@gmail.com>,
linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@techsingularity.net>, Jan Kara <jack@suse.cz>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Michal Hocko <mhocko@suse.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
Andrea Arcangeli <aarcange@redhat.com>,
Matthew Wilcox <willy@infradead.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv2] mm/migrate: clean up useless code in migrate_vma_collect_pmd()
Date: Thu, 15 Aug 2019 15:40:21 -0400 [thread overview]
Message-ID: <20190815194021.GB9253@redhat.com> (raw)
In-Reply-To: <d0a8ab6e-1122-a101-6139-9d7dadb9e999@nvidia.com>
On Thu, Aug 15, 2019 at 12:23:44PM -0700, Ralph Campbell wrote:
>
> 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.
> >
> > NAK there is a bug see below:
> >
> > >
> > > Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
> > > Cc: "Jérôme Glisse" <jglisse@redhat.com>
> > > Cc: Andrew Morton <akpm@linux-foundation.org>
> > > Cc: Mel Gorman <mgorman@techsingularity.net>
> > > Cc: Jan Kara <jack@suse.cz>
> > > Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> > > Cc: Michal Hocko <mhocko@suse.com>
> > > Cc: Mike Kravetz <mike.kravetz@oracle.com>
> > > Cc: Andrea Arcangeli <aarcange@redhat.com>
> > > Cc: Matthew Wilcox <willy@infradead.org>
> > > 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.
> >
>
> 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.
Ok i managed to confuse myself with mpfn and probably with old
version of the code. Sorry for reading too quickly. Can we move
unsigned long pfn; into the else { branch so that there is no
more confusion to its scope.
Cheers,
Jérôme
next prev parent reply other threads:[~2019-08-15 19:40 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 8:00 [PATCH 1/3] mm/migrate: clean up useless code in migrate_vma_collect_pmd() Pingfan Liu
2019-08-06 8:00 ` [PATCH 2/3] mm/migrate: see hole as invalid source page Pingfan Liu
2019-08-15 17:22 ` Jerome Glisse
2019-08-16 15:02 ` Pingfan Liu
2019-08-26 7:52 ` Pingfan Liu
2019-08-06 8:00 ` [PATCH 3/3] mm/migrate: remove the duplicated code migrate_vma_collect_hole() Pingfan Liu
2019-08-15 17:22 ` Jerome Glisse
2019-08-06 13:35 ` [PATCH 1/3] mm/migrate: clean up useless code in migrate_vma_collect_pmd() Matthew Wilcox
2019-08-07 5:28 ` Pingfan Liu
2019-08-07 8:41 ` [PATCHv2] " Pingfan Liu
2019-08-14 23:11 ` Ralph Campbell
2019-08-15 17:19 ` Jerome Glisse
2019-08-15 19:23 ` Ralph Campbell
2019-08-15 19:40 ` Jerome Glisse [this message]
2019-08-16 13:21 ` Pingfan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190815194021.GB9253@redhat.com \
--to=jglisse@redhat.com \
--cc=aarcange@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=jack@suse.cz \
--cc=kernelfans@gmail.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=mike.kravetz@oracle.com \
--cc=rcampbell@nvidia.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.