Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1114879ybl; Sat, 18 Jan 2020 19:08:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxfxjY4zKLmJi5/IhYgwQ0LuvhnhCdw4DiE4keQvVZL0oKW+ZH0QWMHlhLdQPVo4kM6/Tyk X-Received: by 2002:a9d:7c91:: with SMTP id q17mr11709513otn.293.1579403323564; Sat, 18 Jan 2020 19:08:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579403323; cv=none; d=google.com; s=arc-20160816; b=PoWG6KjrR58zD9xWXmoIUBFOFbWh58I/O/cLFG+5ZRtULm1CN3vEGHfwW0UD5e1cCX Sxp95wordbnwv432ast2B0+d7eRE5AI9d07uNcd+hYj+QIvZxqFrQlgi5R5gycNoxuX3 vQpa9HmEaAGEcd/hcC6BDeIIvmIIh2V8OmdNfvKd37ak3UyKQVjflGiUdg7QPjAAMtRF +lar5KeFeYRNfDU/Xz6UakRc3/lR5iw4esWoKVxgI2jw6Zioc32JKH9+CocqqQNwzJV9 wmboxvqSHfJ0Pr1tu+/l1/QZYaLhZANyETngK7PeuPg/FwBYSg7pw/MJVRVIy5WxFqDk n6vA== 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=8ZS4QKSKcSl6vZC/6qVfa/YTQni4c61KySR1T3j4I8c=; b=JSs4upfGR+k9T0X0DY5OpluZO2YcGM29+tdoLfpfh14SuWCvbApdP1jHLUgEZDKOs6 SODU6ckYQH9cKzBQsJlYeVJnsTMXCauX7Pyk54dHDyQq5sLy5K2DaxlfMsyuinMQNhNt b6gwB38JISU5jyetSETCcOk+ugDRfOmdpb7pYhcIS6gOe42d3kChIeAvC4cvRKRVcfHm G3f1YSepuouCJHV2RKJqLt+4sxIIkwpZf3DFDnqccU/pR9baNNsJqyzaBF4AyToSo+wm cuNrfhFHdBdteIzWbiVDDsfo4zFFxgg/s3fuMhuMKWV0UaAeLMHCH454Va68YDvz0QgJ dfuA== 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 t2si17773988otq.196.2020.01.18.19.08.31; Sat, 18 Jan 2020 19:08:43 -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 S1729126AbgASDHb (ORCPT + 99 others); Sat, 18 Jan 2020 22:07:31 -0500 Received: from mga07.intel.com ([134.134.136.100]:14153 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729100AbgASDHa (ORCPT ); Sat, 18 Jan 2020 22:07:30 -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 orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jan 2020 19:07:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,336,1574150400"; d="scan'208";a="258308794" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 18 Jan 2020 19:07:29 -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, Wei Yang Subject: [PATCH 7/8] mm/migrate.c: move page on next iteration Date: Sun, 19 Jan 2020 11:06:35 +0800 Message-Id: <20200119030636.11899-8-richardw.yang@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200119030636.11899-1-richardw.yang@linux.intel.com> References: <20200119030636.11899-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 page is not successfully queued for migration, we would move pages on pagelist immediately. Actually, this could be done in the next iteration by telling it we need some help. This patch adds a new variable need_move to be an indication. After this, we only need to call move_pages_and_store_status() twice. Signed-off-by: Wei Yang --- mm/migrate.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index aee5aeb082c4..2a857fec65b6 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1610,6 +1610,7 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, LIST_HEAD(pagelist); int start, i; int err = 0, err1; + int need_move = 0; migrate_prep(); @@ -1641,13 +1642,15 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, if (current_node == NUMA_NO_NODE) { current_node = node; start = i; - } else if (node != current_node) { + } else if (node != current_node || need_move) { err = move_pages_and_store_status(mm, current_node, - &pagelist, status, start, i - start); + &pagelist, status, start, + i - start - need_move); if (err) goto out; start = i; current_node = node; + need_move = 0; } /* @@ -1662,6 +1665,9 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, continue; } + /* Ask next iteration to move us */ + need_move = 1; + /* * Two possible cases for err here: * == 0: page is already on the target node, then store @@ -1671,17 +1677,11 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, err = store_status(status, i, err ? : current_node, 1); if (err) goto out_flush; - - err = move_pages_and_store_status(mm, current_node, &pagelist, - status, start, i - start); - if (err) - goto out; - current_node = NUMA_NO_NODE; } out_flush: /* Make sure we do not overwrite the existing error */ err1 = move_pages_and_store_status(mm, current_node, &pagelist, - status, start, i - start); + status, start, i - start - need_move); if (err >= 0) err = err1; out: -- 2.17.1