Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4302619ybl; Tue, 21 Jan 2020 17:18:26 -0800 (PST) X-Google-Smtp-Source: APXvYqyqtwPUH/G1SJW6QSoUybYOivzIrgsGczQM8ZMMwO7eHgBUgU+QAcWrX4cfowIlOckdTM+I X-Received: by 2002:a05:6808:9b4:: with SMTP id e20mr4874947oig.37.1579655906221; Tue, 21 Jan 2020 17:18:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579655906; cv=none; d=google.com; s=arc-20160816; b=vYOLPg6ssa4HY4JctmGrVQrDhaUAfh+WLec235P29fk3DhrDRJlHQrQoDi5UqHETiZ HVrU8sqCSARmzjTGygkTryWwqesFI8NnW8kfQaFiUOwUCcoCaQJNIQaNKWSqI+NIAdEB NwfNBoLHCiPaV1NsCDayoB66efXq0Iro0RfIpMFLts/kUW/3dV5Ih5WWtirjgVG5A9M9 m6Y5hMea/SfI3I5RX2Dga22gSrHb1Qi+VdGn7bOYz5TlHwTzLT9mOx0423mFfFLeVmug 3ALtG/XKlr4FtjVGdRHvP5/CqiyVYCh+bp3gq9p0Ud3FY4E140H8CWh7VZ0q+gr3oL+m VhmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=kbaEX64Qxeb5Vh/u8iwJMkAzA4Tvk+3n0Wkpd3I4h3s=; b=A7PIwXnb/0Myo9nZzz7xzJ/vGGFfweg8D/Ofe9wuoj6m0sS5wsEdQcfqEXUm3xZeF7 9bkCV5/9rLrm8WDlLcg4oxbhqhUC6/Qgx5QDY+XVl+c9lsE8gKrCiOcyK0d6rXoio3aK 9rr5Vi2Nfb2D9tMwHnPBTKRqr/UJOKqGuucdyLSRAemr1Mk1Hg976Wl8DaIOTYTOw8NX Beks22Q53+5f59hzgTsoT8AtOisErFfTaH3ctbHnZKKzTiM5EYquTufOOV1OF/HexnpR GOsH2FwLG5GTJ3S+xCyN4ifQDO3OKUpSSctcqB5kS3c+sHNtQTc9S1YfbHDWx0bh/nhV 6jcg== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x68si20576070oia.227.2020.01.21.17.18.14; Tue, 21 Jan 2020 17:18:26 -0800 (PST) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729106AbgAVBRP (ORCPT + 99 others); Tue, 21 Jan 2020 20:17:15 -0500 Received: from mga06.intel.com ([134.134.136.31]:24737 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728900AbgAVBRN (ORCPT ); Tue, 21 Jan 2020 20:17:13 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2020 17:17:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,347,1574150400"; d="scan'208";a="244885521" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga002.jf.intel.com with ESMTP; 21 Jan 2020 17:17:12 -0800 From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, mhocko@suse.com, yang.shi@linux.alibaba.com, rientjes@google.com, Wei Yang Subject: [Patch v2 3/4] mm/migrate.c: check pagelist in move_pages_and_store_status() Date: Wed, 22 Jan 2020 09:16:46 +0800 Message-Id: <20200122011647.13636-4-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200122011647.13636-1-richardw.yang@linux.intel.com> References: <20200122011647.13636-1-richardw.yang@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When pagelist is empty, it is not necessary to do the move and store. Also it consolidate the empty list check in one place. Signed-off-by: Wei Yang Acked-by: Michal Hocko --- mm/migrate.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index a4d3bd6475e1..80d2bba57265 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1499,9 +1499,6 @@ static int do_move_pages_to_node(struct mm_struct *mm, { int err; - if (list_empty(pagelist)) - return 0; - err = migrate_pages(pagelist, alloc_new_node_page, NULL, node, MIGRATE_SYNC, MR_SYSCALL); if (err) @@ -1589,6 +1586,9 @@ static int move_pages_and_store_status(struct mm_struct *mm, int node, { int err; + if (list_empty(pagelist)) + return 0; + err = do_move_pages_to_node(mm, pagelist, node); if (err) return err; @@ -1676,9 +1676,6 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, current_node = NUMA_NO_NODE; } out_flush: - if (list_empty(&pagelist)) - return err; - /* Make sure we do not overwrite the existing error */ err1 = move_pages_and_store_status(mm, current_node, &pagelist, status, start, i - start); -- 2.17.1