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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADD1DC433F5 for ; Fri, 11 Feb 2022 10:40:51 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4345A6B007B; Fri, 11 Feb 2022 05:40:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3E37A6B007D; Fri, 11 Feb 2022 05:40:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2D3A08D0001; Fri, 11 Feb 2022 05:40:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id 217726B007B for ; Fri, 11 Feb 2022 05:40:51 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C98EF9519F for ; Fri, 11 Feb 2022 10:40:50 +0000 (UTC) X-FDA: 79130155860.16.23876D7 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf02.hostedemail.com (Postfix) with ESMTP id 6FEC980003 for ; Fri, 11 Feb 2022 10:40:50 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8BF8C6118C; Fri, 11 Feb 2022 10:40:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18843C340E9; Fri, 11 Feb 2022 10:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644576049; bh=GnpbNG9DkJjep49DVx8HI24joSzwMLLTieup5YugTdE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EUhbWdeEScjiu+LktwI9YVlzovSs5OK4RLBicuIjwtQyKpvlQTPexSM1EOubd9rh4 XiMC8lfMshUgwwPqkgCtc0T3JOUCvXEf/Owa5tJIE2ljGpQLBouWgTK9Tex/2+UMQa vQGlR3RIQxJvIxIpIoGHbUmr4ZDfiWU2Hlb4wPDDRTdyJWC7QUu2lXKIw40iQWV7cW iIXojmClz9lxGMOoy6lJgXWBSTpEDrm8/OJDfZxawPQzETANJQsjHjvkTjMoEV5uf/ 58+W6PGF9kZhh70oxZgjaGKT1pbQYmorCx0OVsuIh+XPQ8YqrHFpwHacP/vbClpTsD LKOD1eIzfnoYQ== Date: Fri, 11 Feb 2022 12:40:37 +0200 From: Mike Rapoport To: Yury Norov Cc: Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= , Greg Kroah-Hartman , Peter Zijlstra , David Laight , Joe Perches , Dennis Zhou , Emil Renner Berthing , Nicholas Piggin , Matti Vaittinen , Alexey Klimov , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 46/49] mm/mempolicy: replace nodes_weight with nodes_weight_eq Message-ID: References: <20220210224933.379149-1-yury.norov@gmail.com> <20220210224933.379149-47-yury.norov@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210224933.379149-47-yury.norov@gmail.com> X-Rspamd-Queue-Id: 6FEC980003 X-Stat-Signature: sh6d8hm7b16suq7j1w8bm5c8k6oq9ypz X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=EUhbWdeE; spf=pass (imf02.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam06 X-HE-Tag: 1644576050-245146 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 Thu, Feb 10, 2022 at 02:49:30PM -0800, Yury Norov wrote: > do_migrate_pages() calls nodes_weight() to compare the weight > of nodemask with a given number. We can do it more efficiently with > nodes_weight_eq() because conditional nodes_weight() may stop > traversing the nodemask earlier, as soon as condition is (or is not) > met. > > Signed-off-by: Yury Norov Acked-by: Mike Rapoport > --- > mm/mempolicy.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/mm/mempolicy.c b/mm/mempolicy.c > index 7c852793d9e8..56efd00b1b6e 100644 > --- a/mm/mempolicy.c > +++ b/mm/mempolicy.c > @@ -1154,7 +1154,7 @@ int do_migrate_pages(struct mm_struct *mm, const nodemask_t *from, > * [0-7] - > [3,4,5] moves only 0,1,2,6,7. > */ > > - if ((nodes_weight(*from) != nodes_weight(*to)) && > + if (!nodes_weight_eq(*from, nodes_weight(*to)) && > (node_isset(s, *to))) > continue; > > -- > 2.32.0 > > -- Sincerely yours, Mike.