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.5 required=3.0 tests=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 8B9A4C33CB7 for ; Mon, 20 Jan 2020 09:45:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5B18D207FF for ; Mon, 20 Jan 2020 09:45:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B18D207FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id EE75D6B0616; Mon, 20 Jan 2020 04:45:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E717F6B0617; Mon, 20 Jan 2020 04:45:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D384B6B0618; Mon, 20 Jan 2020 04:45:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0151.hostedemail.com [216.40.44.151]) by kanga.kvack.org (Postfix) with ESMTP id C07996B0616 for ; Mon, 20 Jan 2020 04:45:06 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with SMTP id 6CF56181AC9C6 for ; Mon, 20 Jan 2020 09:45:06 +0000 (UTC) X-FDA: 76397529012.09.help99_49a153998e35e X-HE-Tag: help99_49a153998e35e X-Filterd-Recvd-Size: 3859 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by imf16.hostedemail.com (Postfix) with ESMTP for ; Mon, 20 Jan 2020 09:45:05 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id d139so14343309wmd.0 for ; Mon, 20 Jan 2020 01:45:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=3iTVE2tqoMsXkoe3MYL5m+Qa1tyuzuu6FafNlWLs6fA=; b=MMFRd9vnoaqRWloBpEi8CXjqN6cDt6MHaOTvny3QDTs0iuDmr+Sa8AeJuwG0N0ooon wCEuIvDpvUQ/Bh1IkRTu1d14+exChoX8/Cd7X+n8VwImWqRMCfhvz4dmLCO5zEirR9iS 9uZbL9tm7UmWwYqi8XOzcpShR0xcarkmN0+eYZMaxXp7V68tGJWzSfb6LHN3+E1qA36/ OpXMhOWieNq/MX7yDiiHLrRKLsjSA8cTyFhD7921JTbUDEuEfoOC/Hw3/ZdgyAn45t5a upgAfGvW6aAp8pGepuZSB4tWjbt1iP5U84mOhxyFLqE40m/O3DSd9fir/4pIsvyv6CfJ RuUQ== X-Gm-Message-State: APjAAAU3PHU5/hAYv+nhANw8Sg/FjBwILahOKH6AuGuEl0yo9QG3w8ZY 9ww+sPZ2aYQ1mdE5mYpbvII= X-Google-Smtp-Source: APXvYqxc+QyDCPn3v70sKZ08DTK7X18YnCfsx7bHkx56YHq9wZ3Y9Gou5TTnbYTLpfln7vdgiZJBOw== X-Received: by 2002:a1c:44d:: with SMTP id 74mr18530043wme.53.1579513504735; Mon, 20 Jan 2020 01:45:04 -0800 (PST) Received: from localhost (prg-ext-pat.suse.com. [213.151.95.130]) by smtp.gmail.com with ESMTPSA id t8sm47113310wrp.69.2020.01.20.01.45.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jan 2020 01:45:04 -0800 (PST) Date: Mon, 20 Jan 2020 10:45:03 +0100 From: Michal Hocko To: Wei Yang Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, yang.shi@linux.alibaba.com Subject: Re: [PATCH 2/8] mm/migrate.c: not necessary to check start and i Message-ID: <20200120094503.GM18451@dhcp22.suse.cz> References: <20200119030636.11899-1-richardw.yang@linux.intel.com> <20200119030636.11899-3-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200119030636.11899-3-richardw.yang@linux.intel.com> User-Agent: Mutt/1.12.2 (2019-09-21) 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 Sun 19-01-20 11:06:30, Wei Yang wrote: > Till here, i must no less than start. And if i equals to start, > store_status() would always return 0. > > Remove some unnecessary check to make it easy to read and prepare for > further cleanup. You are right. This is likely a left over from the development. i >= start because the former is the actual iterator and start is the first index with the cached node. Dropping the check improves readability because one might indeed wonder why this is the only place to do the check and the overal iteration is complex enough to add more questions on top. > Signed-off-by: Wei Yang Acked-by: Michal Hocko Thanks! > --- > mm/migrate.c | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/mm/migrate.c b/mm/migrate.c > index ba7cf4fa43a0..c3ef70de5876 100644 > --- a/mm/migrate.c > +++ b/mm/migrate.c > @@ -1664,11 +1664,9 @@ static int do_pages_move(struct mm_struct *mm, nodemask_t task_nodes, > err = do_move_pages_to_node(mm, &pagelist, current_node); > if (err) > goto out; > - if (i > start) { > - err = store_status(status, start, current_node, i - start); > - if (err) > - goto out; > - } > + err = store_status(status, start, current_node, i - start); > + if (err) > + goto out; > current_node = NUMA_NO_NODE; > } > out_flush: > -- > 2.17.1 -- Michal Hocko SUSE Labs