Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2429356ybl; Sun, 26 Jan 2020 02:29:14 -0800 (PST) X-Google-Smtp-Source: APXvYqxL3rC0W62jxElXrjaKRd7kEeh/GuNk2yky6kz/aJfQgMs9s04SlifMoTiPfikPujfp4h38 X-Received: by 2002:a9d:7593:: with SMTP id s19mr8456264otk.219.1580034554381; Sun, 26 Jan 2020 02:29:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580034554; cv=none; d=google.com; s=arc-20160816; b=m3Fv2ckjg96IdoHsh7ScJd6I1L4vKK2xRHM0ospUBQKSo+NzM+IsyLaSeIgNCdaFZr 0AhT4Ja05G2wCA7VgA/f9pgRe5Q1o8iVxAhRVNdrsf5lj+txblK+iR98GEVg+eK23h7p PZbd/B0bckoZy37XJq3fMuuderwj4HkFnKxvx6FRcxuREQ59KConKIHH+ygI1Uo40fxL NOS5IQOwr+KIBSO1yVTnFX/CvOWOsUHA3hGOt94s9lI5sPfQ+RahBlia2XKwpwgzajLM bQ1pVLWS6XBEsyx4sP1lAmnwDsGmKlYGQ/CG5cVHjb5yZ/p4ElNsQbh8tIHQs0B3C7C3 nhcg== 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=RQPiH2Q8tRqiK5B3vK4FGhxJ5Mfp53+XBSmryn05N6A=; b=lHS3eSvbNEUWXJWdBVYp+Au3Og8UzICnOXdIggaW01AMCJwyiiS9Y/kCcPhHNT1qjr fB83m7cvbmwxG7OylZAxCnv2yWBRtAAJptjPsFuIckM3z77f8mPEEPLDWzbf+gsCr977 eSMbvamP4eo+ZT6V1LdujhJD2px+LqYT9Sk3y22j3fa+e6Vwd+BqkI+5OMe1OcjxWyFg m1xEfXX2ZvROeTiE5U0zDlV5ACOceCyNhSd9fUX+tBLtJJeT1FQUHBbwD3wJ2gDEBycn RuyrOeVPWumE0s2UBD4976Ut2OnuRicMIKqbDBMHhx8H9gffs0HR69t6xkb+Gv+uZuGC t7Fg== 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 v11si1876169otp.279.2020.01.26.02.29.02; Sun, 26 Jan 2020 02:29:14 -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 S2387418AbgAZK1Y (ORCPT + 99 others); Sun, 26 Jan 2020 05:27:24 -0500 Received: from mga12.intel.com ([192.55.52.136]:33300 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729456AbgAZK1X (ORCPT ); Sun, 26 Jan 2020 05:27:23 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Jan 2020 02:27:23 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,365,1574150400"; d="scan'208";a="223002741" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga008.fm.intel.com with ESMTP; 26 Jan 2020 02:27:21 -0800 From: Wei Yang To: akpm@linux-foundation.org Cc: mhocko@suse.com, yang.shi@linux.alibaba.com, rientjes@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [Patch v3 3/4] mm/migrate.c: check pagelist in move_pages_and_store_status() Date: Sun, 26 Jan 2020 18:26:22 +0800 Message-Id: <20200126102623.9616-4-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200126102623.9616-1-richardw.yang@linux.intel.com> References: <20200126102623.9616-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 e816c8990296..b123ced445b7 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) { /* @@ -1687,9 +1687,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, nr_pages, start, i); -- 2.17.1