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=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 69E52C32771 for ; Mon, 20 Jan 2020 22:25:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 15E17217F4 for ; Mon, 20 Jan 2020 22:25:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 15E17217F4 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 6B8136B0675; Mon, 20 Jan 2020 17:25:33 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 640E66B067F; Mon, 20 Jan 2020 17:25:33 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5301B6B06A1; Mon, 20 Jan 2020 17:25:33 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0005.hostedemail.com [216.40.44.5]) by kanga.kvack.org (Postfix) with ESMTP id 393C36B0675 for ; Mon, 20 Jan 2020 17:25:33 -0500 (EST) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id CA93A181AC9C6 for ; Mon, 20 Jan 2020 22:25:32 +0000 (UTC) X-FDA: 76399445304.02.men02_133b9ec6e9301 X-HE-Tag: men02_133b9ec6e9301 X-Filterd-Recvd-Size: 3402 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jan 2020 22:25:31 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jan 2020 14:25:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,343,1574150400"; d="scan'208";a="425300248" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by fmsmga005.fm.intel.com with ESMTP; 20 Jan 2020 14:25:28 -0800 Date: Tue, 21 Jan 2020 06:25:40 +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 1/8] mm/migrate.c: skip node check if done in last round Message-ID: <20200120222540.GA32314@richard> Reply-To: Wei Yang References: <20200119030636.11899-1-richardw.yang@linux.intel.com> <20200119030636.11899-2-richardw.yang@linux.intel.com> <20200120093646.GL18451@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200120093646.GL18451@dhcp22.suse.cz> User-Agent: Mutt/1.9.4 (2018-02-28) 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: On Mon, Jan 20, 2020 at 10:36:46AM +0100, Michal Hocko wrote: >On Sun 19-01-20 11:06:29, Wei Yang wrote: >> Before move page to target node, we would check if the node id is valid. >> In case we would try to move pages to the same target node, it is not >> necessary to do the check each time. >> >> This patch tries to skip the check if the node has been checked. >> >> Signed-off-by: Wei Yang >> --- >> mm/migrate.c | 19 +++++++++++-------- >> 1 file changed, 11 insertions(+), 8 deletions(-) >> >> diff --git a/mm/migrate.c b/mm/migrate.c >> index 430fdccc733e..ba7cf4fa43a0 100644 >> --- a/mm/migrate.c >> +++ b/mm/migrate.c >> @@ -1612,15 +1612,18 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, >> goto out_flush; >> addr = (unsigned long)untagged_addr(p); >> >> - err = -ENODEV; >> - if (node < 0 || node >= MAX_NUMNODES) >> - goto out_flush; >> - if (!node_state(node, N_MEMORY)) >> - goto out_flush; >> + /* Check node if it is not checked. */ >> + if (current_node == NUMA_NO_NODE || node != current_node) { >> + err = -ENODEV; >> + if (node < 0 || node >= MAX_NUMNODES) >> + goto out_flush; >> + if (!node_state(node, N_MEMORY)) >> + goto out_flush; > >This makes the code harder to read IMHO. The original code checks the >valid node first and it doesn't conflate that with the node caching >logic which your change does. > I am sorry, would you mind showing me an example about the conflate in my change? I don't get it. >> >> - err = -EACCES; >> - if (!node_isset(node, task_nodes)) >> - goto out_flush; >> + err = -EACCES; >> + if (!node_isset(node, task_nodes)) >> + goto out_flush; >> + } >> >> if (current_node == NUMA_NO_NODE) { >> current_node = node; >> -- >> 2.17.1 > >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me