From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A81FC32771 for ; Sun, 19 Jan 2020 03:07:35 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id ED8222469C for ; Sun, 19 Jan 2020 03:07:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org ED8222469C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 99BEA6B055E; Sat, 18 Jan 2020 22:07:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 974436B055F; Sat, 18 Jan 2020 22:07:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 817936B0560; Sat, 18 Jan 2020 22:07:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id 5B8BB6B055E for ; Sat, 18 Jan 2020 22:07:32 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 102DD349B for ; Sun, 19 Jan 2020 03:07:32 +0000 (UTC) X-FDA: 76392898344.14.doll54_249c9579e5242 X-HE-Tag: doll54_249c9579e5242 X-Filterd-Recvd-Size: 3478 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Sun, 19 Jan 2020 03:07:31 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.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> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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