Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3770707ybh; Tue, 6 Aug 2019 01:02:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6aKEyZ2YhYpzfTr8uoUbx+jtgg7eAnxmVG88bo9v11V0rcLbvGycSsQCBDjC99nLQgnC6 X-Received: by 2002:a17:90a:9903:: with SMTP id b3mr1874278pjp.80.1565078534668; Tue, 06 Aug 2019 01:02:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565078534; cv=none; d=google.com; s=arc-20160816; b=fvxkfPxUKBIRQ9SrPhgoO/VG7c34lc1y/tr1CUn7eBgA8FdmmPxrS9yZrcHMidhtt4 k8EwKdRGdxr51GNWQ93wCGPC6ozqwPx3IdVPqs6yaQx2/WPQKTilVGRapo9RCAXxa8aA wfIw3ED3MZYpkSokAryOJnzOhJ2CfJAOLScj2b8OoX/Mb5XDejNkf7g7lcZxkQWIfjar cjUH0Db25zDqHDS5g4GiYoQnLv9BiJ8ghs8vfAE/E/+WT2CD0DfvsHjbRGKZP2REELii RIFIbdtqujjTipI9FANqsbK5bngTozoaS17q8l8qTInpewu/nCa76qAHHsX1/KhcFw1w ASYQ== 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=VPlLXY0wXzdcZsw+gwjQql0L/1vV4IXahw59/Pbnezs=; b=E1zA7BEwX2I8Ux3ZXnAZumtLOdwC+kVSiD5uhU4PtxN5CPJcy51LxqdakH8l9eJCId P/xTFjDNn9uXmTq2hau7dr5qt8wZZOKKVSxT54v4/Irl256tPTLMmx2CzEYv9Kvn4ENa FO0zC8DM5lOVKsqoE7HJS3KggP678Zf/y3clFxmAxJAJQTngwSml8eT5as0RuW3LPurf VHUN1Sz1vDPf5jGJOdrKfhW+Sl1lDnbNp+UK3vy/FC4vCapbombvuK/wt7slRm52RCg/ 899ExubVcnl7UMiM63cE8hfVH2ThnSy91Eqfjqj5TqZh8cCOCzwBdlU1WSUNo4AVtcnv MadA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=f3hrVj8Z; 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 i3si40964572plt.306.2019.08.06.01.01.59; Tue, 06 Aug 2019 01:02:14 -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=f3hrVj8Z; 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 S1732231AbfHFIAp (ORCPT + 99 others); Tue, 6 Aug 2019 04:00:45 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37509 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728975AbfHFIAo (ORCPT ); Tue, 6 Aug 2019 04:00:44 -0400 Received: by mail-pg1-f196.google.com with SMTP id d1so8335155pgp.4 for ; Tue, 06 Aug 2019 01:00:44 -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=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-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=VPlLXY0wXzdcZsw+gwjQql0L/1vV4IXahw59/Pbnezs=; b=CqjHP7SptOimi6dplMpNcVLQ0qczt5wThIPhZ6sk44Xd/uL82TygFX4X8J1QcHTmGh Exita/KCAknCIBzqWfukYtCgOrvKgrYDLTy9/OilYxQoRnF0ocILVv3MQ/8PdMIehT/p 77XHf2xajQ7k/pL4I+IJ0VEj5wdCVIypeSzrZUAUo0B4H2czpODpYbJl0tvMYez052vo oCX0M/kyFKM561S3f4cE9dc94jfuVCDW6khsw6AIj4b1M7PVUfucEfXCkNRiapwWyvXM z6EZxl3ccP8cPo5fz6FRGAuyAAIhAaN973DEDDXiRgZFoLr5JaRFhgav7/8cs6ZzXvoB iOiQ== X-Gm-Message-State: APjAAAXyYQi18BJM/J3LLKHRyUwBM+Ws0REBykWnZStbTRSe4djf+E8U WTuYHN8YZOUnJ/g0woIFmw== 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?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 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 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 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; -- 2.7.5