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: 13234322 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 EF776C77B73 for ; Mon, 8 May 2023 11:24:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0D3606B0078; Mon, 8 May 2023 07:24:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0833A6B007D; Mon, 8 May 2023 07:24:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB50F6B007E; Mon, 8 May 2023 07:24:23 -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 D8DB86B0078 for ; Mon, 8 May 2023 07:24:23 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 9BE481407D9 for ; Mon, 8 May 2023 11:24:23 +0000 (UTC) X-FDA: 80766854406.27.9FC0B26 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf28.hostedemail.com (Postfix) with ESMTP id B29F7C0007 for ; Mon, 8 May 2023 11:24:20 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683545061; 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-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references; bh=QNDCvuYbSG3ZRfk/K0TZBYN6nOfxr4IQ0kfLJ+C2Ryk=; b=t784eRArXSEoXWH8OsA1At7/xlgzVNF+rd4WToyRw/qLluyF8afbITJdlFi1+yCtd9BiKN GtN95TZG/qAfVFlxxpoJTzYOrMgAbnGZYfK9qTEsRxrT/fE8HwDOiKyi/ddH+u4nUabDBH XTgKwVAaIdtuysegLsiXvrwkGPToZVg= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; spf=pass (imf28.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683545061; a=rsa-sha256; cv=none; b=s3BQg7GjdCfX2C0HWj4zrbAJBun3lc+8w5sOktTRZVW6q8Y+oZXDMfT9foTo5/Xg4bBrBg Ron2P4zGldjS37yF7KFmiOTPQTeLc6FhngrXlEtqgWQltAXz15SjPkq7jonKKT97f89c0X XQhoy+4tUqHuuxxUNneP4gB9sffLCvA= 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-Stat-Signature: agrt3h5z4cz6inr7rzoaksfu8jtnk5cc X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B29F7C0007 X-Rspam-User: X-HE-Tag: 1683545060-137136 X-HE-Meta: U2FsdGVkX18G1BqYWKvNOiA2BXg+Uh7qp+x7E75g7ujoagB6E6I2QtEcIo5DTikmP/EQ2DyK6H+rqZi48Xd7QF/10ahtxC9VdhDZo/BmGIj+h+ycA8lxGhDM4eX23TtcK59NkkJNLdnKfM4YRB/uj1K5kTrXhulm5jqkNwEq3gZTP33xyXMc84rdJmv75F+QwnfQxADeiE1VoqwHRedQeuAYlmCAP92vRm0y19V+4Thx+Vs+OFAAcGVi3eLFQfRMvK+hYmXrxAEzV9MnqG/aKWft7o952sSCDuyULE1aco11tSh8qlEWneRB7h4uaP1/FKRaLa2Wbghh5UAe/AiGHw8jqoUGeoQpOZlioo7Q3dzWduBhCoVapEnVwoOqK5TXkcTofMWR1G9zKfnRw2OtlU43JFuXUTXw5RiFFXLA9TB8qiz2AqV3nDZ+TXcsqlUEKLyoOjGXjaktxPjp2/DKHBUP9lExb/kxEridSrKosakRvm9ATnIZCQcx6ebKlqo2vgz5JqZpzdB8qJqOWrBLYMcahEYoOyeoTM08Hj91RJraC56fda6aV9X1yS09wStCZu1YbN4oeFDqWfpQF+AyCXqdXFsFP/go7WTuutcm/Fbb199a3i0LTRpwdgI17SokbN8oCjsueAz/16HNpPKEkgokxULtcW4RWnoYSFJ1DGGvtTWUo10kczdBzlmRg9JSf/Ugk7hrGeFkEr68KBV6+QMXTxVdSkBUDW88mZeLzNtBZ1NPmwxKdkfRX5PPf5iSExDYl1o4NB9zuldF3xl68i83pgwUvNea6mj+YoR3HSLjUbNHp9afGhEPbhWJi/jG3SV4EH+0f8CtQMjhmfqaf2AZwtMHJGXyMzVG7a+Dps8dUGGHzq4gOM1/lfzUpOVSf51Ii8hW8owJquxTlv+J4rQmNMvrr1o40BUgt1mLkd23Og5MWylwR3risqQ6Ibpwp1TY0FXyfFrdjE1Wqs8 IqjIrQ9f kQFrtOjI9JtqRRB7CkBfiBCN0ydt6TFVKIsQMM0DManqO7u5fzZDw9wLQbXTX8nWR0/rAGEn7swj5FjS11762i+cpbelsdkK/18c4BIpHM8DYVoXC35EtjsK9ajJbfT4D1179vYJAqRY9WrZ4c3uRyMhYDnQBOYTG+HyFoBUxTPSgPz1RrU0gzQI5zed1r7EgIbEj 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: 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: 13234323 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 B5658C7EE26 for ; Mon, 8 May 2023 11:24:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0BF16B007D; Mon, 8 May 2023 07:24:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id ABBB26B007E; Mon, 8 May 2023 07:24:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 983226B0080; Mon, 8 May 2023 07:24:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8A1EB6B007D for ; Mon, 8 May 2023 07:24:24 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5DCE34025F for ; Mon, 8 May 2023 11:24:24 +0000 (UTC) X-FDA: 80766854448.20.69A5EBA Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by imf19.hostedemail.com (Postfix) with ESMTP id 22E981A0012 for ; Mon, 8 May 2023 11:24:21 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683545062; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cJHX2F8uIOAdcQoI49Ej8kv7hO5jE38auQf5eL6ghXc=; b=vprTifUulT0e32+AHP4jh5If+PqrElHuv0vmtQEad7+Y/Drc+x3WeIZB/SQBsvBxnz55eX tG7KFR21SrjQggL3bYggv+9LFKtqf0Sn48W5WApUAIRsCVpYw02Y5P4lVsRJThVO3Xb69O myBd/TkxsaAPLKXBzNAJMlHKq29o6ek= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=none; spf=pass (imf19.hostedemail.com: domain of wangkefeng.wang@huawei.com designates 45.249.212.187 as permitted sender) smtp.mailfrom=wangkefeng.wang@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683545062; a=rsa-sha256; cv=none; b=A+gLXvJm8PjuXSU3zo6D0OGAbe67KoKHFE3t7PNeUna5ZMN+eB25iP9/Ss+TBnHsxIf1ui YyScseNmMDpSiZoZ2HEdyBOEfyE6WdzPDmYorOF/w2Xdso+ZrUILfnIeTyVnAGMH2zfJ5k PcsB2ShD3fAwPGd+Etod/DJwrcFOw+s= 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-Stat-Signature: jubywh78m7mgedpyqo9pkqn7zczq87ss X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 22E981A0012 X-Rspam-User: X-HE-Tag: 1683545061-867719 X-HE-Meta: U2FsdGVkX19AgWWjBmD0lBPjZIJ4QcCs9twqI9XziXaIHuLJ/rwUN3rX6WldPJGbTM7F2qnRCUOhvfDcM+Vq7vLPlSDYFstBE2JKkX2Jc1b0gwReRsq1dZn/4mbCwwH0SC/GUa3R+lhdnISea1xoylQxjkZ0VjC8zZtIv62Olv0idWOPzsJ4PiROEKLkd6Afjjrs7qHzlJgtoRXVmrrr4MCKlT0ZFK2S1Jqwdqzn/JeZbPEQ7v1eD0mNag3kBvhjH6CKTOzXelSVJKBH0ePX/EdZNlFyL0MZCy5fIm7/TNurhmQrB1YUcOzCsBYDzUow0qSip/QtThl91n6Qyat2ePnTDGK5J2ELoOChqAVyWGTtUnfMZvktvy5bwSmw6ejzoxuMPFCNoqJ4GVl43af8yWm3JfsrH4MnxDryLY+OwIVY+6KMKf8ys/xnXUI2ADTkJWpq0+b/tRnII8J0f20QBERw+Tb6tB+XclOYdJwUwRLCxO00XDtcWGmeUtfyIKZ3qEa8nfbVuhPwhlPA6fCmRa/NP6d+Wf943XeUaL+1N/MrL23mlLdEDt7LWD3dbkwNnSiTJOvoGN3OKD/y76rNx3WMco5wIhfvSHVEOIFlbam0oPmwrl09IZfmUUNfeK+Y7kOMWiDvnsfdW7IYwML3ln6gxchYjSqkKqpJAToHdkspWGxXuxOYZbKXNEh/cbD+8WGukC/aNSSYMQkX40wy5laH/Pyxl05W8fj+KtnedrAVOW3cRg/2GM4qpDooRn2nAuBiu49/Ys5HfTwc36EZOY9+2EDs+w4tEn525MRo+Yc18+pI0iiiYb4ngNocIOQbOSEi5mgwuB0FNOvjYGsuc+3vesgQe0zmCL72C0YI4tPF7B1YdxBbaUSvCC1cZbePpgBc+T+EYPplGAetdZSg7jcmd0ks2eU2niExP7bL8StV//r9eFqdhOrHVal725GA4tTZAYHvV7bMepq2hTR H78x97kh ytK7FLz8PVeEOekw9hoXJ7m+t1V7aEXlkhY1cVJG+TZCrat6RNj4hjMg5AbZTq9/jLoEG2ItpkzzKohDf3CCZKbommzYkZqXv8a4rAd5YRaBX95qOHBbvLl9it7T/W34/eZJFGwH+bSapCt1hqH9wyfKmoWolJvqnKP8Er5G28mcsk5FQLdqwJbog8Ko7ke4EB18G 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: 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);