From patchwork Mon Mar 18 13:57:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 13595385 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 0EC9FC54E58 for ; Mon, 18 Mar 2024 13:58:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5C2D46B0083; Mon, 18 Mar 2024 09:58:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5713E6B0085; Mon, 18 Mar 2024 09:58:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45FEB6B0087; Mon, 18 Mar 2024 09:58:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 385FE6B0083 for ; Mon, 18 Mar 2024 09:58:30 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E6A2D1C0D8D for ; Mon, 18 Mar 2024 13:58:29 +0000 (UTC) X-FDA: 81910314738.17.18354D2 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by imf29.hostedemail.com (Postfix) with ESMTP id 869D0120007 for ; Mon, 18 Mar 2024 13:58:25 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf29.hostedemail.com: domain of thunder.leizhen@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=thunder.leizhen@huaweicloud.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710770308; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=SOWUXowDb7Aj1GHlvpJ113yibPgYCyM1Mzi0jcOQn0Q=; b=K3GBJ/WA5PMvo9Ofat4f4GKv/wIxk0oi84cOX6LXh7EhvttwSy0mjoaNYBvz51PPddsoJK vu7YAvtqPPbB5hguPdI4zLf6fCbrKaifNKiR5zsRJZs7KG4OE2Nr6zGkvvIy9pcr3HnvvA 46lhMs2do8jIUeRm3Arp/QFkxuQWu9o= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf29.hostedemail.com: domain of thunder.leizhen@huaweicloud.com designates 45.249.212.56 as permitted sender) smtp.mailfrom=thunder.leizhen@huaweicloud.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710770308; a=rsa-sha256; cv=none; b=recSteaSjTP1T8U+n3MLI9HRiph6IdfvlgYwrGwRhNdP13scNGup3EeEcvTLiNnYE9iWKm 2ehNiCan/1q/amm7GFLoX8X6OFlaFDr1dhyzAZ8yYQwvz4e6zwPJBXvvam7Ra+MEheV7b6 dSEhgvcG91EKEBZ1t97I/ZlBZrxVz+E= Received: from mail.maildlp.com (unknown [172.19.93.142]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4TyxJj1wdVz4f3jJG for ; Mon, 18 Mar 2024 21:58:13 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 310AF1A016E for ; Mon, 18 Mar 2024 21:58:19 +0800 (CST) Received: from huaweicloud.com (unknown [10.174.178.55]) by APP1 (Coremail) with SMTP id cCh0CgAX6RF4SPhllRNcHQ--.5764S4; Mon, 18 Mar 2024 21:58:19 +0800 (CST) From: thunder.leizhen@huaweicloud.com To: Mike Rapoport , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/1] mm/mm_init.c: eliminate a local variable in mem_debugging_and_hardening_init() Date: Mon, 18 Mar 2024 21:57:14 +0800 Message-Id: <20240318135715.312-1-thunder.leizhen@huaweicloud.com> X-Mailer: git-send-email 2.37.3.windows.1 MIME-Version: 1.0 X-CM-TRANSID: cCh0CgAX6RF4SPhllRNcHQ--.5764S4 X-Coremail-Antispam: 1UD129KBjvJXoW7CrWrXrykXFy8Xw1DJryxZrb_yoW8CFWxpF Z8Jw1IyrZ5ArZak3y2yryDWry7JayfGFW7Jry3Xa43Xw1xC3yrKFs7Kw15ZFyvvrWkXa1a qa93Kr9rZ3W5ta7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUyvb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Xr0_Ar1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxV AFwI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2 j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7x kEbVWUJVW8JwACjcxG0xvY0x0EwIxGrwAKzVCY07xG64k0F24l42xK82IYc2Ij64vIr41l 4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67 AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8I cVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r4UMIIF0xvE42xK8VAvwI 8IcIk0rVWrZr1j6s0DMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAF wI0_Jr0_GrUvcSsGvfC2KfnxnUUI43ZEXa7IU8j9aPUUUUU== X-CM-SenderInfo: hwkx0vthuozvpl2kv046kxt4xhlfz01xgou0bp/ X-Rspamd-Queue-Id: 869D0120007 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: cbhgmhqa4wkch4kmbqk7bihsdow6wq49 X-HE-Tag: 1710770305-722131 X-HE-Meta: U2FsdGVkX18LLsgLAGg8Ed/WU4eA8foZNYOghH2MyKpRu2nMCNvtJXypGNyK1QcY7tdNFJuGy6552ZOWOryog5NPleP3zKVi4MOR4hOHJb3jQRe1llFK6sFbzg0oGmV98o/XLKmEhYWAfaV+Z3hKIH8FjN3lH/8faUZqsl0GEy+fvkYcfU9keCboZMuYP2Vyv5bCT7zX4QFayRvIUL1gVJRkrUqKWN8ALvFcOwN0kGyow8l90K/cKoEq5BN3MTvuzNM1duhAuJVCUOha/6XI0lG3ovroXyfnYbd7r9YYoeR6SLX1ayH/h+3FLzh74JLDonYe+scx7Jq0A1smazo7AApCYTRzbTWw+4lWP0iKrZBa6ZJA4HScYK6wMdr0QbwnPjlwXieNTYjwQGNw3DizrQ6ZP4T1vQig4067UT4jTNNJDw0iSuLrAwRKErL399/BeC/npGqs4Tew0G9MjPDUoTDnYwCzYciV0J9Up51H0YmsGNkZHUYjPeSGVgE0usGX6OD3w3HPZ0symHsiEc7xZamYfWk1T+SdwggxeN/HLwhnAtVqV/8gH6Ms1vjveTP0P8RQTqJQKHhsHJKBnBZVc4DhSplvIK7MIWQ99EjN5+wLJxFe/BTkIts5MUQLCH2xA5lKjUTzO0lTbJIX+OHRKyLpZb5jYQEPebF9Tb/eqp/uOKmBwm8b8axjycRkkHT8u6zSk7YDFQtq9pYU+PlgvmLr3JL2K66TFydF5VNHL+b/7nZMli+91Z0upHSWK/b9snha9KTG9ZFYGasD/KZhDu+5iClNBZr3dQrb/8s1OhPViMEFTe2fiWLDW9/87ZMahO+rDvnQF0n5IHi7fwqhdW1QXm0PgW7utL2draYwT2FL6NpsHaqbx+rN067np5Q+9XISRK3BAtPbISq5mwUP8b9wnQ9v/UqolGKgKOuT7qtw/yhfi0xHlpOdI90qr2ZhDlUobNTO9L5ncMBknbi YS5xolkg smSn9OrZjQEdej/kHaaZ+2+iUwAaZ3t5jPo6XsbmpIpQNUALB9e5EegE1DqfM03YoKx3dXBBpSOtp3NlweysLibuCQfhNvqzvdFNIVdyOcFdbcstCRgsIJc34Yiean+WixH45CuFQWyKHjsOBuwSabEooJCWPjMMCXgZ2nuM663v8+yo= 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: List-Subscribe: List-Unsubscribe: From: Zhen Lei The local variable 'page_poisoning_requested' is assigned true at only one point. It can be eliminated by moving the code that depends on it to the location where it is assigned true. This also make the moved code to be compiled only if CONFIG_PAGE_POISONING is set. Signed-off-by: Zhen Lei --- mm/mm_init.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/mm/mm_init.c b/mm/mm_init.c index 549e76af8f82a8e..3eb217130bcb2b5 100644 --- a/mm/mm_init.c +++ b/mm/mm_init.c @@ -2614,7 +2614,6 @@ DEFINE_STATIC_KEY_MAYBE(CONFIG_DEBUG_VM, check_pages_enabled); */ static void __init mem_debugging_and_hardening_init(void) { - bool page_poisoning_requested = false; bool want_check_pages = false; #ifdef CONFIG_PAGE_POISONING @@ -2626,18 +2625,16 @@ static void __init mem_debugging_and_hardening_init(void) (!IS_ENABLED(CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC) && debug_pagealloc_enabled())) { static_branch_enable(&_page_poisoning_enabled); - page_poisoning_requested = true; want_check_pages = true; - } -#endif - if ((_init_on_alloc_enabled_early || _init_on_free_enabled_early) && - page_poisoning_requested) { - pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " - "will take precedence over init_on_alloc and init_on_free\n"); - _init_on_alloc_enabled_early = false; - _init_on_free_enabled_early = false; + if (_init_on_alloc_enabled_early || _init_on_free_enabled_early) { + pr_info("mem auto-init: CONFIG_PAGE_POISONING is on, " + "will take precedence over init_on_alloc and init_on_free\n"); + _init_on_alloc_enabled_early = false; + _init_on_free_enabled_early = false; + } } +#endif if (_init_on_alloc_enabled_early) { want_check_pages = true;