Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3770305ybh; Tue, 6 Aug 2019 01:01:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqzFlTWVfCpLz9KLrz0VlQqYIj8q2jK1nLdYqVq/J3NCGUJg5fa2emD2Xv++d0DLJzTBg9n1 X-Received: by 2002:a17:902:d20a:: with SMTP id t10mr1879370ply.226.1565078514452; Tue, 06 Aug 2019 01:01:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565078514; cv=none; d=google.com; s=arc-20160816; b=gTbMp8ubvUNLqxW9HTWEnLRAoN6gEcWBIs6Nrq+ctdV29iF8SFLcI+p+JJYvhdgyEh CoT4T/MxF2tMKYLt3BhQa7Q3jBmXZ9Y0ososr4N+lDA0SVPz0vmeVd4NiPJIJ+Qb6o6p aLw3XQmbiDhLi9UUTyoyYM3gFneg/YN376BbMM0wU+WF5hoPD0T1h8HgUYs3lvW4ka/V NrnV1ZbdwlHZV7lh7rbzcAwePjJQbWM80eXCRU4QBj0fpoFVliJwBdY9he09JqJVrLIU JGvLbjyMP8mxltd24G4h4SjJVW/ZaIm2/b6ppU24UdK78Gs4w3tt45w0vYvopkfg3aUX locA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QJLvXO26uNAgUTLj60JeKo10xs/5jo+93bjXJtmEioQ=; b=CXIMNlHT1CN0Ot+/WnyNDhRGmM1EwFCiFhiQoHb85/yGw8wJ6UckTSO5/9NrSrnR0c s0S30aLIByBXpXDwXI4pb0aFs6306aVf5HC8rRbgIe940NKkKZzLNtkB+wqpF2aFUhi8 qQ5OUM9I+ph5cRnEasxlRC1hFpEo7e0hRlY43z7i17csRhg+CzkL6SxiryhtCPxzc1KU 9rtLoIz+ifkQyph6/dluua+6P/lV9rChPgRluRYcR1iyILw5TByeu5T/1e7mEqdXbBiP N9tdfWx+/qAncQ7J6ILxN1p2b5g5o9J/x49GUg9sJb5eUCyWiaGJ94PXSDmT9PbilUIR cdHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ov06WqFF; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t129si51178403pfb.16.2019.08.06.01.01.38; Tue, 06 Aug 2019 01:01:54 -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=@gmail.com header.s=20161025 header.b=Ov06WqFF; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732218AbfHFIAk (ORCPT + 99 others); Tue, 6 Aug 2019 04:00:40 -0400 Received: from mail-pl1-f194.google.com ([209.85.214.194]:33965 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728975AbfHFIAj (ORCPT ); Tue, 6 Aug 2019 04:00:39 -0400 Received: by mail-pl1-f194.google.com with SMTP id i2so37557349plt.1 for ; Tue, 06 Aug 2019 01:00:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QJLvXO26uNAgUTLj60JeKo10xs/5jo+93bjXJtmEioQ=; b=Ov06WqFFY5F/mrImBwDzAGW2EMBWCuuAhDL1ZdsHVeP80acUV+W08iVCFtalIXtiqs Zb2ePWkpruGrrBPtU/pHKyjQbllrpPlgiUhu7jXat9twql0Kp/09g9hxcrSxf6bpAsKk Cb95Vt3v/XsCzvrZo1Ettv33EwB0GMhW3PeHDCdoLR4rQqrEa1uy3+OwC4vl7keb48uh gy8GVUJ8aue7XghwW9YnFWsBme4do20rvhV5SARX11rG7UTIpsQNvJ63B8inkppv8xS5 nCu07LatsWfyhe9v1QL5e59QtWMNu7ENLerKRwFz1MIWpsqbYYDH28du8EGWHcXg1wQk 299Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QJLvXO26uNAgUTLj60JeKo10xs/5jo+93bjXJtmEioQ=; b=Zz7lPg5OHNQshhvP+r689Z8FvpQp7kDypJ03yCLA4skFf2epxfCv9BGH+OKxsjZzkq CzC2k/Gbw0kZMT09PKaWcj5vWNmDlhjo5ioWSq6tVjP5Lg3f0il+SBbQAfMTnEUC7kTH QeL46oSXuew0WR28rjuiBybVPh+LXQp6Y222ZEPTys3O//YBcLns9aeLf2ra69JBS6IE dgVTV8tpvA60bwonoNDyU5CCbFmwgVh68NbJy1F4XFKAapfaTW2EAf0ZsQ8MjBbExVHe AkWzpS7XzHN9HrDXeE5c3OkdQPdIttJQlX8vFlJrltSLAF9p96f6CGdUGayyHzgkB27N jsjw== X-Gm-Message-State: APjAAAUxsCngJI7u3Rtqp3yv/B+yJFzCx9zIzmEVSOBI1Tx5c714E3KM lDSNycfWMyfigcgMMe0rBA== X-Received: by 2002:a17:902:549:: with SMTP id 67mr1920696plf.86.1565078439075; Tue, 06 Aug 2019 01:00:39 -0700 (PDT) Received: from mylaptop.redhat.com ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id p7sm96840679pfp.131.2019.08.06.01.00.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 01:00:38 -0700 (PDT) From: Pingfan Liu To: linux-mm@kvack.org Cc: Pingfan Liu , =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Andrew Morton , Mel Gorman , Jan Kara , "Kirill A. Shutemov" , Michal Hocko , Mike Kravetz , Andrea Arcangeli , Matthew Wilcox , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] mm/migrate: see hole as invalid source page Date: Tue, 6 Aug 2019 16:00:10 +0800 Message-Id: <1565078411-27082-2-git-send-email-kernelfans@gmail.com> X-Mailer: git-send-email 2.7.5 In-Reply-To: <1565078411-27082-1-git-send-email-kernelfans@gmail.com> References: <1565078411-27082-1-git-send-email-kernelfans@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 } 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