Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1044541ybl; Wed, 29 Jan 2020 14:17:45 -0800 (PST) X-Google-Smtp-Source: APXvYqz9d/dOHUCd2nqGmfiTd6N9NTniaTqXErx80t6oyjgD6cVZr4QQdayZS9tFepUb/8U+JUT6 X-Received: by 2002:aca:4f8e:: with SMTP id d136mr779032oib.61.1580336265325; Wed, 29 Jan 2020 14:17:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580336265; cv=none; d=google.com; s=arc-20160816; b=YcOlxkFxGLbwHrQP2AzN4pnQ0WGMeUAgBp1B/JD09rCSADsxcoUH3KWiYji7HPX6/8 U3FJ7CazIiD7jRpFbEoef4zcqVSaczqQ4snmFenSHJBUCETRVt93yXDivMkzMzq+Bj+w tq20k0bWmZ5NlcpuIQParUlTjsv52fvL1rGF1IZlHlbFWqnu3nA1mvvobSfgH6TeQxM6 anyLj9C3ksV/aRDjQPqIIG72mhWwLgPn8cBWvOEoUX8C3SnholzSAHpPR4gSDwBPfGMF UNJ1Z0JjYx1SG5BDkGDtDawxDkUj2ZzEqI+IatOyJBy5/ptGwHWGQqrf/lm+y6D7AjsY Nmcw== 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=9XMMI36ED7wOHH521Z/KKd3ev/bG2dAMxbfZ3Tz56FE=; b=iHgE3nDm8Nw47W4iA8ETCchezC3bscAjRxbLgQpdpAJIicf6+PnO241MNNSjuW/Fx2 GPhydZm6YHJL0qKRZmdZ4S4fjHwqHEg9R3o5gHXsQrtFHgLGjXo19uO52BTIg9kUvHjb ahc3LWGYJD1XO8GynqoCs+p6G1Kvdd/byb0xCBhXKw4PAytgjVhvepuJ4l0+zwasJdTC aT51iGqIOklkV+ovcs+pTpaILsFRD/vHmofbgemtpolEFueYdyal4B1+KLziwnLokDOi 9pyUve2JdxWARcos2XouktrUHWSi60aDtRL9w7Jf49L+xVFGQSA+eLk5ignHfOxnUk/E PM4w== 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 u8si1896543otq.262.2020.01.29.14.17.33; Wed, 29 Jan 2020 14:17:45 -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 S1726788AbgA2WQg (ORCPT + 99 others); Wed, 29 Jan 2020 17:16:36 -0500 Received: from mga02.intel.com ([134.134.136.20]:4886 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbgA2WQf (ORCPT ); Wed, 29 Jan 2020 17:16:35 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Jan 2020 14:16:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,379,1574150400"; d="scan'208";a="261959945" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 29 Jan 2020 14:16:33 -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, david@redhat.com, Wei Yang Subject: [Patch v4 3/4] mm/migrate.c: check pagelist in move_pages_and_store_status() Date: Thu, 30 Jan 2020 06:16:15 +0800 Message-Id: <20200129221616.25432-4-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200129221616.25432-1-richardw.yang@linux.intel.com> References: <20200129221616.25432-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 Reviewed-by: David Hildenbrand --- mm/migrate.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 92e8c9396368..981916007b4f 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; @@ -1675,9 +1675,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