mm: vmscan: mark kswapd_run() and kswapd_stop() __meminit

Message ID 20230606121813.242163-1-linmiaohe@huawei.com
State New
Headers
Series mm: vmscan: mark kswapd_run() and kswapd_stop() __meminit |

Commit Message

Miaohe Lin June 6, 2023, 12:18 p.m. UTC
  Add __meminit to kswapd_run() and kswapd_stop() to ensure they're default
to __init when memory hotplug is not enabled.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 include/linux/swap.h | 4 ++--
 mm/vmscan.c          | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
  

Comments

Yu Zhao June 9, 2023, 5:16 p.m. UTC | #1
On Tue, Jun 6, 2023 at 6:18 AM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> Add __meminit to kswapd_run() and kswapd_stop() to ensure they're default
> to __init when memory hotplug is not enabled.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Acked-by: Yu Zhao <yuzhao@google.com>
  
David Hildenbrand June 12, 2023, 9:32 a.m. UTC | #2
On 06.06.23 14:18, Miaohe Lin wrote:
> Add __meminit to kswapd_run() and kswapd_stop() to ensure they're default
> to __init when memory hotplug is not enabled.
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>   include/linux/swap.h | 4 ++--
>   mm/vmscan.c          | 4 ++--
>   2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/include/linux/swap.h b/include/linux/swap.h
> index 2ddbfd85f6c7..b5f6f2916de1 100644
> --- a/include/linux/swap.h
> +++ b/include/linux/swap.h
> @@ -460,8 +460,8 @@ static inline bool node_reclaim_enabled(void)
>   void check_move_unevictable_folios(struct folio_batch *fbatch);
>   void check_move_unevictable_pages(struct pagevec *pvec);
>   
> -extern void kswapd_run(int nid);
> -extern void kswapd_stop(int nid);
> +extern void __meminit kswapd_run(int nid);
> +extern void __meminit kswapd_stop(int nid);
>   
>   #ifdef CONFIG_SWAP
>   
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index 43dc5c90abbf..a8881571e0ed 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -7871,7 +7871,7 @@ unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
>   /*
>    * This kswapd start function will be called by init and node-hot-add.
>    */
> -void kswapd_run(int nid)
> +void __meminit kswapd_run(int nid)
>   {
>   	pg_data_t *pgdat = NODE_DATA(nid);
>   
> @@ -7892,7 +7892,7 @@ void kswapd_run(int nid)
>    * Called by memory hotplug when all memory in a node is offlined.  Caller must
>    * be holding mem_hotplug_begin/done().
>    */
> -void kswapd_stop(int nid)
> +void __meminit kswapd_stop(int nid)
>   {
>   	pg_data_t *pgdat = NODE_DATA(nid);
>   	struct task_struct *kswapd;

kswapd_stop() is only called with CONFIG_MEMORY_HOTPLUG, so I'm 
wondering if we even want to compiled that without CONFIG_MEMORY_HOTPLUG ...

Anyhow,

Acked-by: David Hildenbrand <david@redhat.com>
  

Patch

diff --git a/include/linux/swap.h b/include/linux/swap.h
index 2ddbfd85f6c7..b5f6f2916de1 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -460,8 +460,8 @@  static inline bool node_reclaim_enabled(void)
 void check_move_unevictable_folios(struct folio_batch *fbatch);
 void check_move_unevictable_pages(struct pagevec *pvec);
 
-extern void kswapd_run(int nid);
-extern void kswapd_stop(int nid);
+extern void __meminit kswapd_run(int nid);
+extern void __meminit kswapd_stop(int nid);
 
 #ifdef CONFIG_SWAP
 
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 43dc5c90abbf..a8881571e0ed 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -7871,7 +7871,7 @@  unsigned long shrink_all_memory(unsigned long nr_to_reclaim)
 /*
  * This kswapd start function will be called by init and node-hot-add.
  */
-void kswapd_run(int nid)
+void __meminit kswapd_run(int nid)
 {
 	pg_data_t *pgdat = NODE_DATA(nid);
 
@@ -7892,7 +7892,7 @@  void kswapd_run(int nid)
  * Called by memory hotplug when all memory in a node is offlined.  Caller must
  * be holding mem_hotplug_begin/done().
  */
-void kswapd_stop(int nid)
+void __meminit kswapd_stop(int nid)
 {
 	pg_data_t *pgdat = NODE_DATA(nid);
 	struct task_struct *kswapd;