[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200120094503.GM18451@dhcp22.suse.cz>
Date: Mon, 20 Jan 2020 10:45:03 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Wei Yang <richardw.yang@...ux.intel.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, yang.shi@...ux.alibaba.com
Subject: Re: [PATCH 2/8] mm/migrate.c: not necessary to check start and i
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 <richardw.yang@...ux.intel.com>
Acked-by: Michal Hocko <mhocko@...e.com>
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
Powered by blists - more mailing lists