Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1114847ybl; Sat, 18 Jan 2020 19:08:41 -0800 (PST) X-Google-Smtp-Source: APXvYqzW+AOAtTZykIngbBhlxtYW99dk8/lC9DHJWzipPrJ/EPYHcCMz9V97jZZeILGbyRlhVLJf X-Received: by 2002:a9d:73ca:: with SMTP id m10mr11922051otk.312.1579403321466; Sat, 18 Jan 2020 19:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579403321; cv=none; d=google.com; s=arc-20160816; b=WzRu+KF2at86+0uj6WFwdf4egEmqG/N/kkZOxgx4If54u73MNIMqnUDUprxFN94Lzc wFM2ObpBK4CVRbTQ6Ivvwluuya8uM/os2W5GX5ASdPsqsHGET373AU0skKjlRmtg4KGG FwMF8REpPRxcVtrAUQP+a7wuaoXvDb4QYOWpvSfGtRJjvBYwB3kdYGPoJGjzqd+DIigo gDReeAL2Id/JzodVhNnP1WvRC6aASSxKYaWKYDh3XnCC+AKPIGdV9tZJLE5diMg+LAqV aWb3jx0++H6CWrEMOw03FIprzpg8QQv8wqVuh9/zHuAnP1NFTE0CRgatD3IiO8IDwU/t ycww== 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=MhYuR/fNBvr0BaWEnmJcMX0GGacLupHKxCorC6I3oKQ=; b=anwmBFOa9hGzwbSEidMnz10LFgATi7SJgkQkoE/BrGO+prENlITuV874Wm+Mp14SKd /Q7SblnEy0lXNfaw73ka7NORPOwdi5dpNgcAAiiUMgAAj9PricUCujIhITax63ofo3dg rQd+00LP6o13CpCb0ZIdMiybeihkaXZsyJLQyOqakimaLmDm6ghtcr9+3SYO1avvOt6g kgRZsJFW80ekdlmitjjm/w5An87JDLyhkT1kYlAwmvfE0yt4qsRkGA8OwqGJfe1dRX6V 6O4FGSKf3GgW1RYIAYlxlOtGS87AxS4LEumxSogpZAEU1puwVY9f3NdVsFJMLdwp5BCi a82g== 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 i5si17653553otr.293.2020.01.18.19.08.29; Sat, 18 Jan 2020 19:08:41 -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 S1729099AbgASDHa (ORCPT + 99 others); Sat, 18 Jan 2020 22:07:30 -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 S1729091AbgASDH3 (ORCPT ); Sat, 18 Jan 2020 22:07:29 -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:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,336,1574150400"; d="scan'208";a="258308791" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga002.fm.intel.com with ESMTP; 18 Jan 2020 19:07:27 -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 6/8] mm/migrate.c: handle same node and add failure in the same way Date: Sun, 19 Jan 2020 11:06:34 +0800 Message-Id: <20200119030636.11899-7-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 queued for migration, there are two possible cases: * page already on the target node * failed to add to migration queue Current code handle them differently, this leads to a behavior inconsistency. Usually for each page's status, we just do store for once. While for the page already on the target node, we might store the node information for twice: * once when we found the page is on the target node * second when moving the pages to target node successfully after above action The reason is even we don't add the page to pagelist, but store_status() does store in a range which still contains the page. This patch handles these two cases in the same way to reduce this inconsistency and also make the code a little easier to read. Signed-off-by: Wei Yang --- mm/migrate.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/migrate.c b/mm/migrate.c index 46a5697b7fc6..aee5aeb082c4 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1657,18 +1657,18 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, err = add_page_for_migration(mm, addr, current_node, &pagelist, flags & MPOL_MF_MOVE_ALL); - if (!err) { - /* The page is already on the target node */ - err = store_status(status, i, current_node, 1); - if (err) - goto out_flush; - continue; - } else if (err > 0) { + if (err > 0) { /* The page is successfully queued for migration */ continue; } - err = store_status(status, i, err, 1); + /* + * Two possible cases for err here: + * == 0: page is already on the target node, then store + * current_node to status + * < 0: failed to add page to list, then store err to status + */ + err = store_status(status, i, err ? : current_node, 1); if (err) goto out_flush; -- 2.17.1