Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2400516ybl; Thu, 15 Aug 2019 11:11:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqxhI7UdtvSDogfZnLwjx1chmiocltRehdkV6csolYtZ/wS7xvCaN7UWLLkUS7Id1X2N1/tY X-Received: by 2002:a17:902:7d8b:: with SMTP id a11mr5443747plm.306.1565892692506; Thu, 15 Aug 2019 11:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565892692; cv=none; d=google.com; s=arc-20160816; b=uSTZpcEbUOnEW8isWBc/J3Cu2VAn5XffOVHjFocRS6UVTe6TAh9c4+WjqVlL9IFAOv FL6g/gu7M90S3j9XYi1kCJeMAFmWUSn/Fu6KUgaCocFuU9Rg3JRB73ipizsXLNgpnlJG 2KjsPk5Q6Eow95R2MVsR1aso8Jte6105ohzMDVvxI1aQ/yH1rbIB89lf8RKzqFxJbEaW phECV9E6BycXlYmY+jmhYVBBeuBeWKzonPPgvIgBdj3mOCVMqT2N4xGmtBjuSnKv8m1h O/ZeWOD+j0Wiqnj6aU5Di4el6ZKrn7cccGyF/oqFndAhv4K89y86hYoxA0AnswvxTO/n B1fg== 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=NNaiLJ6RxG59ooVfIAqSC86YB/nlcLRSFFrsPhXGhbM=; b=hJfOtv4eGaUJQkldWhl5NoIG/blh9Z0iIIJHrUdtW6kzHG/P7XKW5a8GZGSrQ0UvZo NbFn7qQGeIbG5hXsaIf7XXG4u2kjjF3UkiM+G1WSzjM1TsboiDOz8ZD1RudNWZLNcDip wQdXubQPK01SBlh4u/BHyw+61vYIiSqLAL8LiYBYwJ/Ef5hcShRzSB36XucwFYO0dX9v 0JnO1/ElHJRMXPw4jea5qFVAJHMS1h8ED/UHIh8maKE2bkWwtIv8aR4VVyxJpLBUDG0X CCUdzNSd8iD4z0Ssb0S1EbqePRSNzq8EivvT6WDZZibgWKD5gQuJUr6XkBgc/mAfhLM9 r0xQ== 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.11.16; Thu, 15 Aug 2019 11:11:32 -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 S1731801AbfHORW0 (ORCPT + 99 others); Thu, 15 Aug 2019 13:22:26 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35180 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731059AbfHORWZ (ORCPT ); Thu, 15 Aug 2019 13:22:25 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6EBA730832E1; Thu, 15 Aug 2019 17:22:25 +0000 (UTC) Received: from redhat.com (unknown [10.20.6.178]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 643C55C219; Thu, 15 Aug 2019 17:22:24 +0000 (UTC) Date: Thu, 15 Aug 2019 13:22:22 -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: [PATCH 2/3] mm/migrate: see hole as invalid source page Message-ID: <20190815172222.GD30916@redhat.com> References: <1565078411-27082-1-git-send-email-kernelfans@gmail.com> <1565078411-27082-2-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: <1565078411-27082-2-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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Thu, 15 Aug 2019 17:22:25 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 06, 2019 at 04:00:10PM +0800, Pingfan Liu wrote: > MIGRATE_PFN_MIGRATE marks a valid pfn, further more, suitable to migrate. > As for hole, there is no valid pfn, not to mention migration. > > Before this patch, hole has already relied on the following code to be > filtered out. Hence it is more reasonable to see hole as invalid source > page. > migrate_vma_prepare() > { > struct page *page = migrate_pfn_to_page(migrate->src[i]); > > if (!page || (migrate->src[i] & MIGRATE_PFN_MIGRATE)) > \_ this condition > } NAK you break the API, MIGRATE_PFN_MIGRATE is use for 2 things, first it allow the collection code to mark entry that can be migrated, then it use by driver to allow driver to skip migration for some entry (for whatever reason the driver might have), we still need to keep the entry and not clear it so that we can cleanup thing (ie remove migration pte entry). > > 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 | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index c2ec614..832483f 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -2136,10 +2136,9 @@ static int migrate_vma_collect_hole(unsigned long start, > unsigned long addr; > > for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { > - migrate->src[migrate->npages] = MIGRATE_PFN_MIGRATE; > + migrate->src[migrate->npages] = 0; > migrate->dst[migrate->npages] = 0; > migrate->npages++; > - migrate->cpages++; > } > > return 0; > @@ -2228,8 +2227,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, > pfn = pte_pfn(pte); > > if (pte_none(pte)) { > - mpfn = MIGRATE_PFN_MIGRATE; > - migrate->cpages++; > + mpfn = 0; > goto next; > } > > -- > 2.7.5 >