Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1017582ybl; Tue, 28 Jan 2020 16:58:59 -0800 (PST) X-Google-Smtp-Source: APXvYqxM0TVNlX2QiG0aOajhTtm3VaIDv6586+1FHpu4WzqILekqhc8CRzK/fSqFirHpiSRgVf1m X-Received: by 2002:a9d:6745:: with SMTP id w5mr19117926otm.52.1580259538827; Tue, 28 Jan 2020 16:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580259538; cv=none; d=google.com; s=arc-20160816; b=SvF6Z4NxR/OrkF1FKk64S1qZ6iFHANVEdXnKiCEbOmgtWW3Wgr5g+xSXkWUYDcsIWP sbypIC6AeNsSmSqDO6SKfyHN9afRfYyZDeb40t4UHYTAUtzTwEgEIIaDmdb66qDpQIvt +BJ42+YKd/zAFdx9+SoRwaJIK5h/VqpGd+msNkd7Fa7uxfV8g5neEyOWRUgL4t0pXkbk DYE6iglujeoYEhehIdD6NjXVJZk3G8xTj9+mh/NNEV7U4ladQUiU7zmDRQNIeCz5wDMy IuBlMhOVyyos+Ckp+HnKw70BfnHw7sqk+lwvQAtUU2xGGE2FN0uHGfPk4HktZ9Smu19Z HEqg== 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=WGRe5ZrqKGXRZ4HWTpu8QWpTp4vqUujAiSJYxDPlkU4=; b=YOMKMw8qYYExGBuJEIOQbq1DUg2GvSnju+BrKXnM7MvC2p6sc5pEcVUtYmo/zRFmqk jm7th1L3obmBysrLKtsgBQjAFs+EH3A473FcVmEH65OqgC+QFCl3Clb6mcAVdbuEtm4p SWErJOTR5688JwuLWYX1aKkw3++gX5EyztGuyuIow+lpeIhzzFCRKxeoTznxYxLp5kgk rIUE6GL18FifceVWJls9lpu7MdDnzImjFXxd5Z708nyhvlV5c1R4+iNI4y52goAReKXp IY3W3LsavEZ5mdmAkFb3mVeHWv+bRVfco+ojv89j0hFqJccZiArPLfcpOt1fxF2rCk1H fnQw== 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 m9si262327oie.148.2020.01.28.16.58.42; Tue, 28 Jan 2020 16:58:58 -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 S1726859AbgA2Aqw (ORCPT + 99 others); Tue, 28 Jan 2020 19:46:52 -0500 Received: from mga07.intel.com ([134.134.136.100]:19872 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726487AbgA2Aqw (ORCPT ); Tue, 28 Jan 2020 19:46:52 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jan 2020 16:46:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,376,1574150400"; d="scan'208";a="222916704" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga007.fm.intel.com with ESMTP; 28 Jan 2020 16:46:25 -0800 Date: Wed, 29 Jan 2020 08:46:37 +0800 From: Wei Yang To: David Hildenbrand Cc: Wei Yang , akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, mhocko@suse.com, yang.shi@linux.alibaba.com, rientjes@google.com Subject: Re: [Patch v2 3/4] mm/migrate.c: check pagelist in move_pages_and_store_status() Message-ID: <20200129004637.GD12835@richard> Reply-To: Wei Yang References: <20200122011647.13636-1-richardw.yang@linux.intel.com> <20200122011647.13636-4-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Tue, Jan 28, 2020 at 11:21:13AM +0100, David Hildenbrand wrote: >On 22.01.20 02:16, Wei Yang wrote: >> 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 >> --- >> mm/migrate.c | 9 +++------ >> 1 file changed, 3 insertions(+), 6 deletions(-) >> >> diff --git a/mm/migrate.c b/mm/migrate.c >> index a4d3bd6475e1..80d2bba57265 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; >> @@ -1676,9 +1676,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; > > >Am I wrong or are you discarding an error here? (err could be !0) > This is not obvious in this code snippet. If you look into the source code, it might help you get the whole picture. The following comment says: Make sure we do not overwrite the existing error So we didn't eat error here. > >-- >Thanks, > >David / dhildenb -- Wei Yang Help you, Help me