From patchwork Mon May 8 11:41:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 91072 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2093262vqo; Mon, 8 May 2023 04:54:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4xLnTivo9eQfayXnPyW3b6fQxYXCNUe6P2ZHHHxqdI9g+N5BRN/Z+yprpN6DgCfIRzJPF4 X-Received: by 2002:a17:902:e5c3:b0:1aa:d6ad:4eaa with SMTP id u3-20020a170902e5c300b001aad6ad4eaamr12374131plf.2.1683546882458; Mon, 08 May 2023 04:54:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683546882; cv=none; d=google.com; s=arc-20160816; b=HxlaALzPoChXbzRW9+lHT9NPtGO6WyhsAjCP/LKHRfNRwQbnQfGv8rI6xusSsQwqkE kM3M3QhnJ+jfztLNNQuTjneKdUulQ7JS7OMEnuTZoDsv9AOL4qP68xITndlhQmeSnzyH 6/4qRy8Bm3i97+aDkM0jTDNL5hz4C8yy2R11g0epMS+uaXz3+Uc+ARsPR69tUCI4fjc8 GtKLFgHElBhvibVzatX0OBmucHZpRgBGk3i8Wq7MBDx3FosgtkyJopJO1rKBQvAEF6tD jXIgPTVEr/t8hOO+MPQVWx1fDoIK/BP3oWjnrt45WiS+EH+gbnNe149KZm7DZmDC5PfZ pLOQ== 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; bh=QNDCvuYbSG3ZRfk/K0TZBYN6nOfxr4IQ0kfLJ+C2Ryk=; b=QD30JhFB1OQMyK4Jm7bR2Ifo4NODjZW61xElHXumGRY3ZCvxtkoG9ebMyJbtmLTCxt jTt0+jTM4kytnTeTNT/YAb1M4PxVNcwOpYtSgTCuXtqJlRVf325ZInZddyGZ+IVQHsIj jYKo4UKyGUR/ubzfUWBUzVZAcNFTzNioXKBi2FU3j5rH16m95SlTs6zdeXvjFk6SO08r Vn4NeczZg2xVN1JPoUAlTl3u6XR/qDF/MmVBMb2pXLDFB6xXyhPwXsiYHH4eoZnndbiM ZKoN6uGy2hczH7oxKcYEmmo4ZFuit321FSEvhZr0tvu11Cl/3vPIujQQHn5p8zbqZ3EB 8PAg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c16-20020a170902d49000b0019a826d3054si8233224plg.640.2023.05.08.04.54.29; Mon, 08 May 2023 04:54:42 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235711AbjEHLYi (ORCPT + 99 others); Mon, 8 May 2023 07:24:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235653AbjEHLYS (ORCPT ); Mon, 8 May 2023 07:24:18 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CE1E37031 for ; Mon, 8 May 2023 04:24:18 -0700 (PDT) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QFJjf2dNpzpV29; Mon, 8 May 2023 19:20:06 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 8 May 2023 19:24:14 +0800 From: Kefeng Wang To: Naoya Horiguchi , Andrew Morton CC: , , Kefeng Wang Subject: [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE Date: Mon, 8 May 2023 19:41:27 +0800 Message-ID: <20230508114128.37081-1-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1765326855509677466?= X-GMAIL-MSGID: =?utf-8?q?1765326855509677466?= The memory_failure_attr_group is only called if MEMORY_FAILURE enabled, move it under this configuration. Signed-off-by: Kefeng Wang Acked-by: Naoya Horiguchi --- include/linux/mm.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/linux/mm.h b/include/linux/mm.h index d533ef955dd0..cdb0377f97fa 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -3687,6 +3687,10 @@ extern void shake_page(struct page *p); extern atomic_long_t num_poisoned_pages __read_mostly; extern int soft_offline_page(unsigned long pfn, int flags); #ifdef CONFIG_MEMORY_FAILURE +/* + * Sysfs entries for memory failure handling statistics. + */ +extern const struct attribute_group memory_failure_attr_group; extern void memory_failure_queue(unsigned long pfn, int flags); extern int __get_huge_page_for_hwpoison(unsigned long pfn, int flags, bool *migratable_cleared); @@ -3779,11 +3783,6 @@ enum mf_action_page_type { MF_MSG_UNKNOWN, }; -/* - * Sysfs entries for memory failure handling statistics. - */ -extern const struct attribute_group memory_failure_attr_group; - #if defined(CONFIG_TRANSPARENT_HUGEPAGE) || defined(CONFIG_HUGETLBFS) extern void clear_huge_page(struct page *page, unsigned long addr_hint, From patchwork Mon May 8 11:41:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 91081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2098633vqo; Mon, 8 May 2023 05:03:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7h66vcP772l0FPCO8m0Mo9q6BFKpRgInZol8Rkn9SyR5itaaAa3CadGNiejLgdyvNREDay X-Received: by 2002:a17:902:f683:b0:1ac:8148:8c3e with SMTP id l3-20020a170902f68300b001ac81488c3emr2544281plg.32.1683547393101; Mon, 08 May 2023 05:03:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683547393; cv=none; d=google.com; s=arc-20160816; b=tyUy5ZJG6jr9CyLj4IG46XRsRuyE8Uu5H+wjc5RMVnccOevQwgBf8Ml8Fue6uOCplJ Y7oRRCA6LCj5IW6A2NG3tlux9g2CiFYKdnQCwGCUk2b1+6T2/pVPURpHTTpQ9BG8ppqR Ej+MPZMlSwUz+KvN8smgU2cZlCvYKYB8Jnto6ZncxlnbIu36B5t2VdmltTIzyfrfdRFa 27xL0t7GcRWjYiViQk8gYbRo9f2bWyhUSoCNF43eCy5szgUifQdwoJ+Ud0CyTXrCtsF0 R8ot2/bmW+2ryVMDiLlPXOuS0Rw6FRDg8ag23QfEOL4qdRza2JaXhf5cSjKNpIm0xiAB S3nQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cJHX2F8uIOAdcQoI49Ej8kv7hO5jE38auQf5eL6ghXc=; b=GEayhsQxgd47CkP6vX1DeJBqDUdOaAM0PhEeOTJShsewXKL5WJ6O5/DlAXQRxlBJ22 RCga+V1XgnPr706kheM4qkKaIsubOCrsOxZeklf6clNlEBZqV4iYZ9jKUx+2sW1pH680 yw5SpV8DHxz0ljcBU4zzzXF0QrvW3TdRilxKgfOV4XteUnf0jCBLgvW3p3rn/yr1OOmo twh2QTCkCSAXwbtf7t/l0dN1DsfEiK2N7yg4aMukfiyDYtGUAREGZjlH2uRgqKUuoCIQ U9FAXTxwvhJFx7p00ImW0O8WjJ3D4Ck6+x8NzQcR73ykVaWbHRavCA8AZHbcPu9udoIo wJ6A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h7-20020a170902748700b0019a96849d6dsi7525651pll.605.2023.05.08.05.02.57; Mon, 08 May 2023 05:03:13 -0700 (PDT) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235667AbjEHLYf (ORCPT + 99 others); Mon, 8 May 2023 07:24:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235651AbjEHLYS (ORCPT ); Mon, 8 May 2023 07:24:18 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBA0E39B94 for ; Mon, 8 May 2023 04:24:16 -0700 (PDT) Received: from dggpemm500001.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QFJmJ4yNyzsRCL; Mon, 8 May 2023 19:22:24 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 8 May 2023 19:24:14 +0800 From: Kefeng Wang To: Naoya Horiguchi , Andrew Morton CC: , , Kefeng Wang Subject: [PATCH 2/2] mm: memory-failure: move sysctl register in memory_failure_init() Date: Mon, 8 May 2023 19:41:28 +0800 Message-ID: <20230508114128.37081-2-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230508114128.37081-1-wangkefeng.wang@huawei.com> References: <20230508114128.37081-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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?1765327391299626270?= X-GMAIL-MSGID: =?utf-8?q?1765327391299626270?= There is already a memory_failure_init(), don't add a new initcall, move register_sysctl_init() into it to cleanup a bit. Signed-off-by: Kefeng Wang Acked-by: Naoya Horiguchi --- mm/memory-failure.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 5b663eca1f29..004a02f44271 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -123,7 +123,6 @@ const struct attribute_group memory_failure_attr_group = { .attrs = memory_failure_attr, }; -#ifdef CONFIG_SYSCTL static struct ctl_table memory_failure_table[] = { { .procname = "memory_failure_early_kill", @@ -146,14 +145,6 @@ static struct ctl_table memory_failure_table[] = { { } }; -static int __init memory_failure_sysctl_init(void) -{ - register_sysctl_init("vm", memory_failure_table); - return 0; -} -late_initcall(memory_failure_sysctl_init); -#endif /* CONFIG_SYSCTL */ - /* * Return values: * 1: the page is dissolved (if needed) and taken off from buddy, @@ -2441,6 +2432,8 @@ static int __init memory_failure_init(void) INIT_WORK(&mf_cpu->work, memory_failure_work_func); } + register_sysctl_init("vm", memory_failure_table); + return 0; } core_initcall(memory_failure_init);