linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE
@ 2023-05-08 11:41 Kefeng Wang
  2023-05-08 11:41 ` [PATCH 2/2] mm: memory-failure: move sysctl register in memory_failure_init() Kefeng Wang
  2023-05-10  3:03 ` [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE HORIGUCHI NAOYA(堀口 直也)
  0 siblings, 2 replies; 4+ messages in thread
From: Kefeng Wang @ 2023-05-08 11:41 UTC (permalink / raw)
  To: Naoya Horiguchi, Andrew Morton; +Cc: linux-mm, linux-kernel, Kefeng Wang

The memory_failure_attr_group is only called if MEMORY_FAILURE
enabled, move it under this configuration.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 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,
-- 
2.35.3



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] mm: memory-failure: move sysctl register in memory_failure_init()
  2023-05-08 11:41 [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE Kefeng Wang
@ 2023-05-08 11:41 ` Kefeng Wang
  2023-05-10  3:06   ` HORIGUCHI NAOYA(堀口 直也)
  2023-05-10  3:03 ` [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE HORIGUCHI NAOYA(堀口 直也)
  1 sibling, 1 reply; 4+ messages in thread
From: Kefeng Wang @ 2023-05-08 11:41 UTC (permalink / raw)
  To: Naoya Horiguchi, Andrew Morton; +Cc: linux-mm, linux-kernel, Kefeng Wang

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 <wangkefeng.wang@huawei.com>
---
 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);
-- 
2.35.3



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE
  2023-05-08 11:41 [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE Kefeng Wang
  2023-05-08 11:41 ` [PATCH 2/2] mm: memory-failure: move sysctl register in memory_failure_init() Kefeng Wang
@ 2023-05-10  3:03 ` HORIGUCHI NAOYA(堀口 直也)
  1 sibling, 0 replies; 4+ messages in thread
From: HORIGUCHI NAOYA(堀口 直也) @ 2023-05-10  3:03 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: Andrew Morton, linux-mm, linux-kernel

On Mon, May 08, 2023 at 07:41:27PM +0800, Kefeng Wang wrote:
> The memory_failure_attr_group is only called if MEMORY_FAILURE
> enabled, move it under this configuration.
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] mm: memory-failure: move sysctl register in memory_failure_init()
  2023-05-08 11:41 ` [PATCH 2/2] mm: memory-failure: move sysctl register in memory_failure_init() Kefeng Wang
@ 2023-05-10  3:06   ` HORIGUCHI NAOYA(堀口 直也)
  0 siblings, 0 replies; 4+ messages in thread
From: HORIGUCHI NAOYA(堀口 直也) @ 2023-05-10  3:06 UTC (permalink / raw)
  To: Kefeng Wang; +Cc: Andrew Morton, linux-mm, linux-kernel

On Mon, May 08, 2023 at 07:41:28PM +0800, Kefeng Wang wrote:
> 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 <wangkefeng.wang@huawei.com>

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-10  3:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-08 11:41 [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE Kefeng Wang
2023-05-08 11:41 ` [PATCH 2/2] mm: memory-failure: move sysctl register in memory_failure_init() Kefeng Wang
2023-05-10  3:06   ` HORIGUCHI NAOYA(堀口 直也)
2023-05-10  3:03 ` [PATCH 1/2] mm: memory_failure: move memory_failure_attr_group under MEMORY_FAILURE HORIGUCHI NAOYA(堀口 直也)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox