Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3165171ybl; Mon, 20 Jan 2020 17:26:31 -0800 (PST) X-Google-Smtp-Source: APXvYqyWT+P23J1n8mJM8ekfA/NfIH6NKkG3q8Ky/CgbgR8fDKKrFaMzsiZKGNaaVoHhHtFmubvi X-Received: by 2002:a05:6808:611:: with SMTP id y17mr1216275oih.146.1579569990925; Mon, 20 Jan 2020 17:26:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579569990; cv=none; d=google.com; s=arc-20160816; b=Gna+kre0sBw4B+xXtdA4ugIx0eQgTXFzqSpiVM7TYxUYJNU+toS+vwGED30Q++4W9x QfND2qtk9knkshsGLXFhcPA8KcPcCDOHpSjPlBFgDlgGtCs67G0Ph6QVy8CKFiPRHybV 4MN0fOjsVsrcAydvPvdS+P3LlL7ekTVGE2IppMFV4Dx2NSg2wC8dwCG9bl9uOIk+roDy QEEP64bm3F8LIFpB2OaTAC1PjBFj6l1RyaT2OwWLgQcbvrgvWKC2QoZYkmFe6KBGzIgR 26L0ytL8oN2khtSWLRZepAk/eCwHD6v9U8LryyPHS157wlxlQAxyHG5kf153/23j8mvr oOcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date; bh=nuGchB93b7KVGqyjlOBg0bRueszuV6szBf4CzE6r4uc=; b=HYcStA8R0bgbCaE5KQdiKjQCR6IVD+PjQBJ+6Ij4mvrv6atmF3Wwom2BHfY4eBULNG FkPaVXcO3vOOV8sfisFPX623XyevwK1oU78Yyj1LAPZWMoiHKG3BISqi8RFfJ8fT2O7a hEpL1lVSZPbx8Hgpcce9iHet0AoVpNs4RzT7aEIJ2mv3YcVyQ2JyfrcXycCrXSeseFQu gF7Vn732Fa8KCw+MEm5E2A6L9K9gOURPcQqoiVVx/cwd1b4zgKiB2xov6+2hvbgIqWd7 ttYS0PF6mGjjlLWCElgQ0CnCw4kG/Jv2WdnHK64zV76Pxf2ygaUdLnY9V8CdYqE2mV37 Y5Ag== 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 s5si18373713oic.116.2020.01.20.17.25.49; Mon, 20 Jan 2020 17:26:30 -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 S1728898AbgAUBVw (ORCPT + 99 others); Mon, 20 Jan 2020 20:21:52 -0500 Received: from mga18.intel.com ([134.134.136.126]:62102 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728668AbgAUBVv (ORCPT ); Mon, 20 Jan 2020 20:21:51 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 17:21:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,344,1574150400"; d="scan'208";a="277391772" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga001.fm.intel.com with ESMTP; 20 Jan 2020 17:21:49 -0800 Date: Tue, 21 Jan 2020 09:22:00 +0800 From: Wei Yang To: Michal Hocko Cc: Wei Yang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yang.shi@linux.alibaba.com Subject: Re: [PATCH 7/8] mm/migrate.c: move page on next iteration Message-ID: <20200121012200.GA1567@richard> Reply-To: Wei Yang References: <20200119030636.11899-1-richardw.yang@linux.intel.com> <20200119030636.11899-8-richardw.yang@linux.intel.com> <20200120100203.GR18451@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200120100203.GR18451@dhcp22.suse.cz> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 20, 2020 at 11:02:03AM +0100, Michal Hocko wrote: >On Sun 19-01-20 11:06:35, Wei Yang wrote: >> 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. > >No! Not another iterator. There are two and this makes the function >quite hard to follow already. We do not want to add a third one. > Two iterators here are? I don't get your point. >> 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 >> > >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me