From patchwork Tue Aug 6 08:00:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pingfan Liu X-Patchwork-Id: 11078381 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 0BEAB1395 for ; Tue, 6 Aug 2019 08:00:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF994285ED for ; Tue, 6 Aug 2019 08:00:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBAE1285B5; Tue, 6 Aug 2019 08:00:47 +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 57C002857D for ; Tue, 6 Aug 2019 08:00:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C9FF6B0006; Tue, 6 Aug 2019 04:00:46 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 57A7D6B0008; Tue, 6 Aug 2019 04:00:46 -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 4686B6B000A; Tue, 6 Aug 2019 04:00:46 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id 0F24C6B0006 for ; Tue, 6 Aug 2019 04:00:46 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id w12so12139516pgo.2 for ; Tue, 06 Aug 2019 01:00:46 -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=VPlLXY0wXzdcZsw+gwjQql0L/1vV4IXahw59/Pbnezs=; b=jBXNJJ26wAsPkXVU6xLPrhSi01MQ0zbfq5pomqEg6AysiWhVdqINWwYc7ULchWiNHE H2zhyDPsK7jeC0lKFCLHAKlwHFO/nSZdVkN4dFUgXR9Q1A9+WjeS5wnGtYqFpM/M++gf LF9FEvOTL7fFfcCr0STznepOn+9PKl5mXwVPl/xT+9Ro1vZ6GYqp6w5vu9T8i1YrJBQ6 mk64JemDUnveQN6eXhY8tpzv2ElzFZ/ESxJKZ5swrj7Bv9ZO2hNE74PnHvmqm19Rpoy0 VmDIFXvqgcYee9ANcXzF8p6JWLnYAlTR7iCKX+Fm4cpB61YT8A2r87bMT7KN3o55QpIV /Cug== X-Gm-Message-State: APjAAAX/lXw+ZHlkIAqrafcNnJfh/0Dj+HKAbLOhF+S0FrStlNax5BEs ggsxU4hJ2Stpl1t5QHAENxBT+pznOcN2gAD+mb5dhRhqtJInON8mobpvsbsCfIPATb2ljacYrEL l8L13jAIT85gl51Hr2lJBPs5AY4OGDflQxAwGKWUDcMWl/xS7InNBa2AaJfpgoV3IoA== X-Received: by 2002:a62:be04:: with SMTP id l4mr2260972pff.77.1565078445678; Tue, 06 Aug 2019 01:00:45 -0700 (PDT) X-Received: by 2002:a62:be04:: with SMTP id l4mr2260898pff.77.1565078444711; Tue, 06 Aug 2019 01:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565078444; cv=none; d=google.com; s=arc-20160816; b=Um7Z9Mucxn6cggENcQSKOUmOkmYKGidJThQm6ak+aQcur2tg+1n4fhc3gAxwCV6wz+ ZWdeemiZb2R7S8TsmIYzBPVr7FckieO5DpW2Tg5h/cJDY8nMy0MolTwF9WtGZptHNxUj V6qyBDD7YEyJNAAThtsPIz8XJST0oWaHcbUU2O0iM9x+f1v2OqklsDaVcuGSjk9f0+bJ 1yDz/10uhbTZ5XfPFdw4PRT9Yf1LFBG1hiMm6YCSxv17PZKz65SLvuUHpGDqVrtTtPny p295GY524JBU1+WwmsrEp+6cDrg/kT9qrSjZas+PIK0X21snBhcNj+UpxYm7C7PAnHkx 2LJQ== 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=VPlLXY0wXzdcZsw+gwjQql0L/1vV4IXahw59/Pbnezs=; b=gnDEE9jIOSXkn3W/ZO9LPNcOYIrgQK6jZD7tQxLv/2ryn56bSRL+G/shKia9mSVekc FIlhi1i3SYlMzjlpk0hxjCZHeqBzUg2kVbmKZGJalVABhGNpphVw3zohTMpqtHbYQUzU RqVMYGD3YyYYxtUvtjKYAvIiOKQ5qJhKa0FhqBiBo1Fe6MZ4YW4Tnwz+8rzNxRoWOvgX iHj/9juzCHyHgiQzegJ3k8/gPO2fcG96mxHqOLTbNpO4X8U1ac9Ujna1Jec4DMf+oIxZ yFiAqouW4CI8uXkx2qxf1b7RMb6/AZa6QPJpD1NGhuflBCKCBY6YHpg7e/QFhrt0rPjU 7wDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f3hrVj8Z; 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 r2sor66518235pfh.6.2019.08.06.01.00.44 for (Google Transport Security); Tue, 06 Aug 2019 01:00:44 -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=f3hrVj8Z; 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=VPlLXY0wXzdcZsw+gwjQql0L/1vV4IXahw59/Pbnezs=; b=f3hrVj8ZgSrkyz6mbiTGMtbGJs5//kmK0LanZLxVWpezH8VpgJt8y1ox4rbd5P+7Xu rzgSCTmtRAEF7TnsRnCMRtWtnaxg/idNjkjI98rTH/vcVoKdlRfMtcn+GTAVn9u5nrbY /kXvVE+IL6jIN3PrJOjEjy2+1PFE9ioV7h3oak9qXBxVb3sVGREH58rI+mP/pBGg9T1W dSGuAXe3gUK4/mKwGZhLSa6+q0H8YIiD5gO4WY1k9Liar/mnk7rLB2o2y49Q6Ee68fry dmqFLhb6R1cXymhQ7T2tOsaMakcuCNSQbzfwW8Unea6HJvVUNiD4Iic21I5EDOenle3t h1/A== X-Google-Smtp-Source: APXvYqyiwHAHgTc4msK2mvodCQr/+/YaQdZ92NMfmgPYPCboKZknrpOFM/qqY3qhKWJuKDfTi9GXsQ== X-Received: by 2002:a62:5c47:: with SMTP id q68mr2350903pfb.205.1565078444317; Tue, 06 Aug 2019 01:00:44 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Aug 2019 01:00:43 -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 3/3] mm/migrate: remove the duplicated code migrate_vma_collect_hole() Date: Tue, 6 Aug 2019 16:00:11 +0800 Message-Id: <1565078411-27082-3-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 After the previous patch which sees hole as invalid source, migrate_vma_collect_hole() has the same code as migrate_vma_collect_skip(). Removing the duplicated code. 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 | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 832483f..95e038d 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2128,22 +2128,6 @@ struct migrate_vma { unsigned long end; }; -static int migrate_vma_collect_hole(unsigned long start, - unsigned long end, - struct mm_walk *walk) -{ - struct migrate_vma *migrate = walk->private; - unsigned long addr; - - for (addr = start & PAGE_MASK; addr < end; addr += PAGE_SIZE) { - migrate->src[migrate->npages] = 0; - migrate->dst[migrate->npages] = 0; - migrate->npages++; - } - - return 0; -} - static int migrate_vma_collect_skip(unsigned long start, unsigned long end, struct mm_walk *walk) @@ -2173,7 +2157,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, again: if (pmd_none(*pmdp)) - return migrate_vma_collect_hole(start, end, walk); + return migrate_vma_collect_skip(start, end, walk); if (pmd_trans_huge(*pmdp)) { struct page *page; @@ -2206,7 +2190,7 @@ static int migrate_vma_collect_pmd(pmd_t *pmdp, return migrate_vma_collect_skip(start, end, walk); if (pmd_none(*pmdp)) - return migrate_vma_collect_hole(start, end, + return migrate_vma_collect_skip(start, end, walk); } } @@ -2337,7 +2321,7 @@ static void migrate_vma_collect(struct migrate_vma *migrate) mm_walk.pmd_entry = migrate_vma_collect_pmd; mm_walk.pte_entry = NULL; - mm_walk.pte_hole = migrate_vma_collect_hole; + mm_walk.pte_hole = migrate_vma_collect_skip; mm_walk.hugetlb_entry = NULL; mm_walk.test_walk = NULL; mm_walk.vma = migrate->vma;