From patchwork Tue Aug 6 08:00:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 11078379 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 130C013B1 for ; Tue, 6 Aug 2019 08:00:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02BDE27F98 for ; Tue, 6 Aug 2019 08:00:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EACCD284B5; Tue, 6 Aug 2019 08:00:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6C15A2844B for ; Tue, 6 Aug 2019 08:00:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7764E6B0005; Tue, 6 Aug 2019 04:00:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 726AA6B0006; Tue, 6 Aug 2019 04:00:41 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6166A6B0008; Tue, 6 Aug 2019 04:00:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by kanga.kvack.org (Postfix) with ESMTP id 2BDD76B0005 for ; Tue, 6 Aug 2019 04:00:41 -0400 (EDT) Received: by mail-pl1-f197.google.com with SMTP id o6so47847420plk.23 for ; Tue, 06 Aug 2019 01:00:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:from:to:cc:subject:date :message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=QJLvXO26uNAgUTLj60JeKo10xs/5jo+93bjXJtmEioQ=; b=glZDmRnKk9Qii1+E9LxRk+kQjIcnLMCZ19ggMo4xvTja5O+g6i/VDN//TN4DbCbaES 6JHPu/VVeXw2fjwSl+jtwysOi7Oih0igdNO75CsIVnBV7dO8cB9AhLW/+e9+Ov0V4it2 dDGk3UFXQ2AHpxY1ZlbGWhjVNPVW+HaItalx0IFWVeQSKqUNfA8YLFZyILDajhdb1SR8 Z6N5YNiICE19Q1MGSefOtXfNVQRTKS+28JsWMJkOG4NWFbGHfmaqoQk5SzM/QboQp0BS PAYNajtU1TcAM2AH105jvOnzJipeeBkuCrggkCDlX4j8Fco5vIjbyPkmHKYCb6znkGoY WrEA== X-Gm-Message-State: APjAAAW5BpEuAR7WOFirc7GzQ5XN8z4uzufijZw1HzUPcfyW/wqRHqmY oimpAQ368539YBbDQKjq5EVgdIg3vjd5XiZmKFGHJEl3dDdA7nGbiD2Gn4NRvokdEcyXgLn6aWa KT4uZWq63EmhbBZ9SMXCMt2ww1EF95FeB/bGK0K9f1GUb06S6ZOgJdMPuvG/Q/CR22A== X-Received: by 2002:a63:3112:: with SMTP id x18mr1869482pgx.385.1565078440514; Tue, 06 Aug 2019 01:00:40 -0700 (PDT) X-Received: by 2002:a63:3112:: with SMTP id x18mr1869384pgx.385.1565078439513; Tue, 06 Aug 2019 01:00:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565078439; cv=none; d=google.com; s=arc-20160816; b=y6mWM+u09oHQ7HIOBcVRHyjGMBgbApFc0SADLFLg1V3NbgfS6tY3GAz3i39I5kGl88 B0NTf38z3/WrxMrZfRkuyEGUeV/b+EgU64LhXOME2p/I6XRuirViFhAsP0b1XbR5Bx13 H6DBJbBKVjvcPQnhxEtm/TcYPetEnf1KHu4mMStjCnWSJQdnTY9MQZALoGMoUpUP5Nhu Z3IO9JVXHrA6HXKjR/AUsO2V/bbKavSommiLgSwlg/sYh1ZkvfqWjrQt8sTwiwFQGB2n r52Nfj3cixa5QplATTaX9a+pY7mMo/jEpG3kCYzyVvX3x3SlsX4xdxKP65qImjWYsZCR E6qA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=QJLvXO26uNAgUTLj60JeKo10xs/5jo+93bjXJtmEioQ=; b=oK8SoKXAh25rF3Axu+PpTek7bEzxOw2ZQtKo1d1CSW3ffkFmtPFcZjt/hbTi5dnZhh fiW7l4OgXiO7vy+pEcjP75uKYopU14SC+jw27EgA8ZWGIJkTi9+MumfcCJkvd/Gg0ah+ 0cn1vTB95oGuTZKqis+8tigNzskmTqBW4DiLeAAfucFTGSs7aCvLJvvxi5yw/PtGl3a3 XvwEDPdfQ64nD44SUUsbUeJZVXCKHJvwdL1wJfZSwKhO+EL4rXJYv6dMfaQIfLUPPpV0 CqAlVgcVZTNRwpsW47p+JHJOJNyof5N161iIMRHvJfzbNfJQSxFPKXrGGmcr1FIaJrLV 2bOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ov06WqFF; spf=pass (google.com: domain of kernelfans@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=kernelfans@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b10sor32607680pla.6.2019.08.06.01.00.39 for (Google Transport Security); Tue, 06 Aug 2019 01:00:39 -0700 (PDT) Received-SPF: pass (google.com: domain of kernelfans@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ov06WqFF; spf=pass (google.com: domain of kernelfans@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=kernelfans@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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-Smtp-Source: APXvYqzCPLsm7dfAooib/V/VTYqbHUQPePIInQAoDof4+Yj607pvI0yjcNDlSnn6Ie1lWQ4lqIBACg== 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?b?SsOpcsO0bWUgR2xpc3Nl?= , 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 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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; }