From patchwork Wed Jan 4 19:18:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 39068 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp5314255wrt; Wed, 4 Jan 2023 11:21:34 -0800 (PST) X-Google-Smtp-Source: AMrXdXvWnQyWPpvyD204cXQ3L2p2P1KSEW14W/SnnSmVjSCbEf7aKEMlGBZ0qF3xqv+qt/VJK6XZ X-Received: by 2002:a17:906:3a93:b0:7c0:f7b0:9aed with SMTP id y19-20020a1709063a9300b007c0f7b09aedmr39869694ejd.55.1672860094024; Wed, 04 Jan 2023 11:21:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672860094; cv=none; d=google.com; s=arc-20160816; b=hGdTbOjOrV0hLr/Ots6sc/cg+pKjx+z1W7bzEcSXwPsZAY41eafdT6JBADmgUjxXKB ogQxPh2cldjcKX6lEdvJhMizgmKGuxfoTpeerp6mVdkLVgIvWcSBCawUS1qcEx6yPykX nCjj7XSVZpDpTtHTf77AHoUoExK5GXaEEyvn/8eMoIe6mZplgaAtBK15h0slVEJr7Hkg wMjrtsBvU71W6eyw88gsPXLtLuvpCQ0wDWiDmRw93iZPTw0vtHfN93lEj4gv19xiQNcS QNPcD/H04/w81MX+tPcl+WR/wBPE92ht2vW+kSHEDNXX2EILMqDmWGSWYOGeNQcBQkDr H1Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=7z9bug0ACxLCEE0oCWrKvM2WKLSBgb/nbdLR7my4w3E=; b=V/K5a5aqa55q7tXpsgL55ZpJXgzfd1m9w8O9DwE+6Dw3CdYLwsFWii6ve0zi1nOSIm QREEWhSw8VZfQIAIdCM0NvrnXctZCX1Kk8h68hBXNyf6Y2RN0C5EoQ/YmakZifWX3GIY +P2jJW4GvCSL0LjC/o72r4GvNZX9olx3fOCwP0r/okGup3as0I2JPRMUpNBW5WoeZOfG WysmZa9Q0rdCF1MYyla/i7W+fu1UyKxnDBubdp8DPss6CMO7BK5rHCFImi/gZDfjQ/++ FzhLXmZQ5Sk9TBTKIpj1CHQTjyKaRLxtpSs+Ui85B7Q2tguCVnssvapg8QdUo9qEcaYv CrMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mhOIg47e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg32-20020a170907972000b007c1286ad884si34855419ejc.677.2023.01.04.11.21.09; Wed, 04 Jan 2023 11:21:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mhOIg47e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239756AbjADTSW (ORCPT + 99 others); Wed, 4 Jan 2023 14:18:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232953AbjADTSV (ORCPT ); Wed, 4 Jan 2023 14:18:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ADE821C for ; Wed, 4 Jan 2023 11:18:20 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 12904B8189F for ; Wed, 4 Jan 2023 19:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4286CC433D2; Wed, 4 Jan 2023 19:18:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672859897; bh=/a1ST1ZnmxMiB7Kfy4mw19tmCPrOMY5YoQtFMqkWXjk=; h=From:To:Cc:Subject:Date:From; b=mhOIg47ecYOAzFbSXOuJEOP3I+JHngjYgRJfee8h8Rbh20Tn5/I5uyQHXjY4obkUF bKl0v7B9B91OveXVgKQobr/mA5smTXvsFznZQ7jYrAWemiRvh1xeLPpbvjUUbje1vh 18BMDHbhoWdvRGS5LGAlvC62A+5/hu/rnb7+HHaeO4qVup472WEcOgLvfo6B2HD9O2 s8LFVj+4++NbLJ3ukVihw8q+uLpxxXBs8WHAZFdiidNAg7ChcFAB8lXQwYNzb77w8b JIbGnOwQ/Neja0+5k6ACW7/4NAv3qSqMQIx+v1lRdDoaO0uPHxu+hIZIw4JOGra4bU IYdPwOn2KkZtQ== From: Mike Rapoport To: Andrew Morton Cc: Mel Gorman , Mike Rapoport , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm/page_alloc: invert logic for early page initialisation checks Date: Wed, 4 Jan 2023 21:18:05 +0200 Message-Id: <20230104191805.2535864-1-rppt@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754120946275727158?= X-GMAIL-MSGID: =?utf-8?q?1754120946275727158?= From: "Mike Rapoport (IBM)" Rename early_page_uninitialised() to early_page_initialised() and invert its logic to make the code more readable. Signed-off-by: Mike Rapoport (IBM) Reviewed-by: Anshuman Khandual Reviewed-by: David Hildenbrand Acked-by: Mel Gorman --- mm/page_alloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 0745aedebb37..a881f2d42b2c 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -443,15 +443,15 @@ static inline bool deferred_pages_enabled(void) return static_branch_unlikely(&deferred_pages); } -/* Returns true if the struct page for the pfn is uninitialised */ -static inline bool __meminit early_page_uninitialised(unsigned long pfn) +/* Returns true if the struct page for the pfn is initialised */ +static inline bool __meminit early_page_initialised(unsigned long pfn) { int nid = early_pfn_to_nid(pfn); if (node_online(nid) && pfn >= NODE_DATA(nid)->first_deferred_pfn) - return true; + return false; - return false; + return true; } /* @@ -498,9 +498,9 @@ static inline bool deferred_pages_enabled(void) return false; } -static inline bool early_page_uninitialised(unsigned long pfn) +static inline bool early_page_initialised(unsigned long pfn) { - return false; + return true; } static inline bool defer_init(int nid, unsigned long pfn, unsigned long end_pfn) @@ -1641,7 +1641,7 @@ static void __meminit init_reserved_page(unsigned long pfn) pg_data_t *pgdat; int nid, zid; - if (!early_page_uninitialised(pfn)) + if (early_page_initialised(pfn)) return; nid = early_pfn_to_nid(pfn); @@ -1804,7 +1804,7 @@ int __meminit early_pfn_to_nid(unsigned long pfn) void __init memblock_free_pages(struct page *page, unsigned long pfn, unsigned int order) { - if (early_page_uninitialised(pfn)) + if (!early_page_initialised(pfn)) return; if (!kmsan_memblock_free_pages(page, order)) { /* KMSAN will take care of these pages. */