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: 13088854 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 5E6BCC4332F for ; Wed, 4 Jan 2023 19:18:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EA8058E0002; Wed, 4 Jan 2023 14:18:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E57588E0001; Wed, 4 Jan 2023 14:18:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1FD98E0002; Wed, 4 Jan 2023 14:18:22 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B6AD28E0001 for ; Wed, 4 Jan 2023 14:18:22 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8D89BA01CB for ; Wed, 4 Jan 2023 19:18:22 +0000 (UTC) X-FDA: 80318077644.16.B2C68F6 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf05.hostedemail.com (Postfix) with ESMTP id 0587E10000D for ; Wed, 4 Jan 2023 19:18:20 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mhOIg47e; spf=pass (imf05.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672859901; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=7z9bug0ACxLCEE0oCWrKvM2WKLSBgb/nbdLR7my4w3E=; b=OYk2e0V2pKqHG0oTXbUP3RArLomr2+q4p1WI+Kf5U1cn6MuO6awOMZbkWRbNVS6iZxaWbW mGNX2XjpVroUwYY6LyEixo8f1kIZSU05IL2PWLtJQw7zhYLNdsmLnQwywiESUqd1xmirAP JM6CRLbhBxoETMc6h+G3XG0KaHq4j3Y= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=mhOIg47e; spf=pass (imf05.hostedemail.com: domain of rppt@kernel.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=rppt@kernel.org; dmarc=pass (policy=none) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672859901; a=rsa-sha256; cv=none; b=BKZMSiWnn6ypQ7IFcNNoZ5Frin5f+jjiAvsTUDl34/h+09G4zl9gOxc3idkK6mXLWu5t7j k7Fs9Juv+A2nJmu+oL1Ycx68+IzfIJW00/v+BWa3liI6K3doHlt33x6Xdws1aZHHBk2chf c9Qo/AdodF7J+HQIt7wIzH6lNNsc/lY= 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 21BCCB818B9; 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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0587E10000D X-Rspam-User: X-Stat-Signature: wz5rxb8gi367nfy4k8prn9ezgyi13etp X-HE-Tag: 1672859900-369602 X-HE-Meta: U2FsdGVkX181jjgSpHFFT0hywy0HY/TSNWSJWxzcDpota2sHlxGFpxqSUKReYOcItNy1s5echeaXcfZhuOillyHwJvXYmqMXlOIFSkhZiDajsI8SJKotbals+VnJKiWBaq7bAbAEc5JSAPyDpgTijUIZtN/eNxTjbIFgrZ55Lth5yFCBofX5ipuqOC2TQVw0ZQS1lJljo/AbanYDME7IQh1dVyvjtf8iQ8w4D+/9JC/k0N+YF9ARJpsAr1oLtw+Unvm/8TISxvc7THfg3oMlDbQTPWN/Vui/uMsZFquJaFCdnHcBbdg8yflpX8kdf6y/2GG/cXBiSR/6A08M7FSttjJZwYSFJrS4rxg6pDySJbZA7h3qqIsgkgdnH+262HDwb6lGy2W+kjktBCP63gpls4H9gf9EMaQQPZ3TiX5XAouYviQc0LdEyzvYDvQqhfDX3/beIo4P8BppsEI1sYbdjstEs6nmZXLbcuDBszwaubsFHqhV/DocAkteQmPVFyiAfmsvPizzDBNvvxyZ2GMJH7iIfMN53u6uLfnMLm2U9T7TY7FNrRt/5CZUpZKyitYLSbkX+5KePLNhmeHCMIVJjLnNw+7eghrbKNgfFwGctUWvt9uDA7B6c6hO3nkat7Kr/TfBn6cdvKpW/0HSVLZCeptkbe1rmjlfVFeBZ8+7vKZGsFI5tdwmnxKnBozw1+nsl6IwAm1DmdSh3o4mtCN4MThIT1KnGO4f8ROK4/nWsFPG/iHe+iAunwrQbT9yHxfaufLkUyRNzEZprwN8fFVvB5UBDi/6XkG3a0Ej9xsgMwJ7GfIHMweI0+ej0jrspX6gaPxekZKxsCLkAyblJECv5jQZcbngDFxPh3OKaunRJN97ulcAa57Zgi/uojHXO153oit0eXY5qbGtbGHXm6crFwSXNB2dMlg5sTmapu9Lj17y6y+e2vFhByCSVWBpMqo/BQjcFuFlGgjQr5g8nV5 Drkd0V84 NbJNkSCm66ZEnRKl+F7/MgHrb8Lh3IhY/P5ufK5qPujPdquiD9TdgSsVnE/PgfWQY3MnbqwFdTHT8I78Zwa33IBmA5OsPBp4dQWoFzmMGa3ZMHcz7sixfDqi3sQ== 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: 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. */