diff mbox series

[1/7] mm: remove redundant K() macro definition

Message ID 20230804012559.2617515-2-zhangpeng362@huawei.com (mailing list archive)
State New
Headers show
Series cleanup with helper macro K() | expand

Commit Message

Peng Zhang Aug. 4, 2023, 1:25 a.m. UTC
From: ZhangPeng <zhangpeng362@huawei.com>

Since commit eb8589b4f8c1 ("mm: move mem_init_print_info() to
mm_init.c"), the K() macro definition has been moved to mm/internal.h.
Therefore, the definitions in mm/memcontrol.c, mm/backing-dev.c and
mm/oom_kill.c are redundant. Drop redundant definitions.

Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
---
 mm/backing-dev.c | 3 +--
 mm/memcontrol.c  | 1 -
 mm/oom_kill.c    | 2 --
 3 files changed, 1 insertion(+), 5 deletions(-)

Comments

Kefeng Wang Aug. 7, 2023, 8:31 a.m. UTC | #1
On 2023/8/4 9:25, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@huawei.com>
> 
> Since commit eb8589b4f8c1 ("mm: move mem_init_print_info() to
> mm_init.c"), the K() macro definition has been moved to mm/internal.h.
> Therefore, the definitions in mm/memcontrol.c, mm/backing-dev.c and
> mm/oom_kill.c are redundant. Drop redundant definitions.
> 
> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
> ---
>   mm/backing-dev.c | 3 +--
>   mm/memcontrol.c  | 1 -
>   mm/oom_kill.c    | 2 --
>   3 files changed, 1 insertion(+), 5 deletions(-)
> 

...
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> index 612b5597d3af..471061a3a0f5 100644
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -479,8 +479,6 @@ static DECLARE_WAIT_QUEUE_HEAD(oom_victims_wait);
>   
>   static bool oom_killer_disabled __read_mostly;
>   
> -#define K(x) ((x) << (PAGE_SHIFT-10))
> -
>   /*
>    * task->mm can be NULL if the task is the exited group leader.  So to
>    * determine whether the task is using a particular mm, we examine all the

Please drop  "#undef K" in oom_kill.c
David Hildenbrand Aug. 7, 2023, 3:20 p.m. UTC | #2
On 07.08.23 10:31, Kefeng Wang wrote:
> 
> 
> On 2023/8/4 9:25, Peng Zhang wrote:
>> From: ZhangPeng <zhangpeng362@huawei.com>
>>
>> Since commit eb8589b4f8c1 ("mm: move mem_init_print_info() to
>> mm_init.c"), the K() macro definition has been moved to mm/internal.h.
>> Therefore, the definitions in mm/memcontrol.c, mm/backing-dev.c and
>> mm/oom_kill.c are redundant. Drop redundant definitions.
>>
>> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
>> ---
>>    mm/backing-dev.c | 3 +--
>>    mm/memcontrol.c  | 1 -
>>    mm/oom_kill.c    | 2 --
>>    3 files changed, 1 insertion(+), 5 deletions(-)
>>
> 
> ...
>> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
>> index 612b5597d3af..471061a3a0f5 100644
>> --- a/mm/oom_kill.c
>> +++ b/mm/oom_kill.c
>> @@ -479,8 +479,6 @@ static DECLARE_WAIT_QUEUE_HEAD(oom_victims_wait);
>>    
>>    static bool oom_killer_disabled __read_mostly;
>>    
>> -#define K(x) ((x) << (PAGE_SHIFT-10))
>> -
>>    /*
>>     * task->mm can be NULL if the task is the exited group leader.  So to
>>     * determine whether the task is using a particular mm, we examine all the
> 
> Please drop  "#undef K" in oom_kill.c

With that

Reviewed-by: David Hildenbrand <david@redhat.com>
Peng Zhang Aug. 8, 2023, 10:44 a.m. UTC | #3
On 2023/8/7 16:31, Kefeng Wang wrote:

> On 2023/8/4 9:25, Peng Zhang wrote:
>> From: ZhangPeng <zhangpeng362@huawei.com>
>>
>> Since commit eb8589b4f8c1 ("mm: move mem_init_print_info() to
>> mm_init.c"), the K() macro definition has been moved to mm/internal.h.
>> Therefore, the definitions in mm/memcontrol.c, mm/backing-dev.c and
>> mm/oom_kill.c are redundant. Drop redundant definitions.
>>
>> Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
>> ---
>>   mm/backing-dev.c | 3 +--
>>   mm/memcontrol.c  | 1 -
>>   mm/oom_kill.c    | 2 --
>>   3 files changed, 1 insertion(+), 5 deletions(-)
>>
> ...
>> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
>> index 612b5597d3af..471061a3a0f5 100644
>> --- a/mm/oom_kill.c
>> +++ b/mm/oom_kill.c
>> @@ -479,8 +479,6 @@ static DECLARE_WAIT_QUEUE_HEAD(oom_victims_wait);
>>     static bool oom_killer_disabled __read_mostly;
>>   -#define K(x) ((x) << (PAGE_SHIFT-10))
>> -
>>   /*
>>    * task->mm can be NULL if the task is the exited group leader.  So to
>>    * determine whether the task is using a particular mm, we examine 
>> all the
>
> Please drop  "#undef K" in oom_kill.c

Thanks for your review!
diff mbox series

Patch

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 3ffc3cfa7a14..fc44bfbf785e 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -16,6 +16,7 @@ 
 #include <linux/writeback.h>
 #include <linux/device.h>
 #include <trace/events/writeback.h>
+#include "internal.h"
 
 struct backing_dev_info noop_backing_dev_info;
 EXPORT_SYMBOL_GPL(noop_backing_dev_info);
@@ -34,8 +35,6 @@  LIST_HEAD(bdi_list);
 /* bdi_wq serves all asynchronous writeback tasks */
 struct workqueue_struct *bdi_wq;
 
-#define K(x) ((x) << (PAGE_SHIFT - 10))
-
 #ifdef CONFIG_DEBUG_FS
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 1ff51d8df84a..e290e7ed05f3 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1626,7 +1626,6 @@  static void memory_stat_format(struct mem_cgroup *memcg, struct seq_buf *s)
 	WARN_ON_ONCE(seq_buf_has_overflowed(s));
 }
 
-#define K(x) ((x) << (PAGE_SHIFT-10))
 /**
  * mem_cgroup_print_oom_context: Print OOM information relevant to
  * memory controller.
diff --git a/mm/oom_kill.c b/mm/oom_kill.c
index 612b5597d3af..471061a3a0f5 100644
--- a/mm/oom_kill.c
+++ b/mm/oom_kill.c
@@ -479,8 +479,6 @@  static DECLARE_WAIT_QUEUE_HEAD(oom_victims_wait);
 
 static bool oom_killer_disabled __read_mostly;
 
-#define K(x) ((x) << (PAGE_SHIFT-10))
-
 /*
  * task->mm can be NULL if the task is the exited group leader.  So to
  * determine whether the task is using a particular mm, we examine all the