From patchwork Thu Feb 10 22:49:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yury Norov X-Patchwork-Id: 12742625 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 90A40C433F5 for ; Fri, 11 Feb 2022 00:33:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C38226B0073; Thu, 10 Feb 2022 19:33:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BE6C86B0075; Thu, 10 Feb 2022 19:33:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AAF4D6B0078; Thu, 10 Feb 2022 19:33:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0054.hostedemail.com [216.40.44.54]) by kanga.kvack.org (Postfix) with ESMTP id 9CE356B0073 for ; Thu, 10 Feb 2022 19:33:32 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6255595B0B for ; Fri, 11 Feb 2022 00:33:32 +0000 (UTC) X-FDA: 79128625464.25.C1DC085 Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by imf13.hostedemail.com (Postfix) with ESMTP id 1865820009 for ; Fri, 11 Feb 2022 00:33:31 +0000 (UTC) Received: by mail-io1-f46.google.com with SMTP id e79so9500250iof.13 for ; Thu, 10 Feb 2022 16:33:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=r/11QztAgc7p887H2JROAx8muQu/2OLTeRvuBg6maFg=; b=ok4tnMvC7LNlEY46BePrt8wMU+Xygc1lZ1J4h61Xtojbzh341QW8CBnitkhh5WqB3/ XQn5p4hMW9VVGbkJ9OqMDwRUWIdHv5YGA1+MudlaHItROlN0ZWP+huOqrDwFHv9Z8QR6 kAQBAsudTSUpOAzB8WSpovQie3Y9Oejz4Ny6jolkns7yygmDKtkLzivE4oMh3a2eFa0Q blKT0mttPX3VUmJXZcZg9AeE3k4/82VYbeWrmKV+2djpYxOF+Z8FLRVT7aZJzk3HNEyf zId6ynUThngQhyEuB4bOApoKZZXjGDOOJNdj8JSWbzBBA7Maj1PC2m2E0xgnM+DZdPL7 xKnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=r/11QztAgc7p887H2JROAx8muQu/2OLTeRvuBg6maFg=; b=h1SwW5N5V7DaDqLQ2lEROnLDbLROWtXdwvkN+0C6M1NB1yqYRoz4H0xDo98v2bBFuq JFSR9IPf2Pd/DSimQwVnmldjbTEpYEXPd3t03K9gEd4b9YlC8drLa3vHVGCxsj795pbS 4tTLW4rEIJDe1NI67Bl1efcCEgKDA7Go0RIrg25gxgqj24jFSoubl3AAhXYmvSN4ntbx Zu23Mbr4l2M9FBEi69Nu9Jk1wVj99GUYeWaCbgdGA+K7eRpIZk8ExUOQHPpCPel41rT3 KeTJS8I/jSROv3WP43qTxi1r87sj4/Zux7FhWVIfG+ZWmiKTu0drJj+sjPSg5r8aoS5o gnLA== X-Gm-Message-State: AOAM530SFOqFzISzkLCR0I23EZPK6M9Mw1Fzq1yr2/sjSYyNBy3WtiZC yxpnT7XOv3CAyry4AeWkaqc= X-Google-Smtp-Source: ABdhPJyzos5XlKp1kunYx0r5VshfNF8Q0FlI8L2FzcjJPMYDnSfr0hH9Cw5PSnXX0u86MmWYjJr03Q== X-Received: by 2002:a02:3f2f:: with SMTP id d47mr5568535jaa.228.1644539611330; Thu, 10 Feb 2022 16:33:31 -0800 (PST) Received: from localhost ([12.28.44.171]) by smtp.gmail.com with ESMTPSA id 193sm3856876iob.17.2022.02.10.16.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Feb 2022 16:33:31 -0800 (PST) From: Yury Norov To: Yury Norov , Andy Shevchenko , Rasmus Villemoes , Andrew Morton , =?utf-8?b?TWljaGHFgiBNaXJvc8WC?= =?utf-8?b?YXc=?= , 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: [PATCH 46/49] mm/mempolicy: replace nodes_weight with nodes_weight_eq Date: Thu, 10 Feb 2022 14:49:30 -0800 Message-Id: <20220210224933.379149-47-yury.norov@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220210224933.379149-1-yury.norov@gmail.com> References: <20220210224933.379149-1-yury.norov@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 1865820009 X-Stat-Signature: ha8aszqxzmibinzjqur358bnyu14ijx6 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ok4tnMvC; spf=pass (imf13.hostedemail.com: domain of yury.norov@gmail.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=yury.norov@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam06 X-HE-Tag: 1644539611-873944 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: 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;