linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] mm: fix format issues and param types
@ 2024-11-15 23:57 Keren Sun
  2024-11-15 23:57 ` [PATCH 1/3] mm: prefer 'unsigned int' to bare use of 'unsigned' Keren Sun
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Keren Sun @ 2024-11-15 23:57 UTC (permalink / raw)
  To: akpm
  Cc: roman.gushchin, hannes, mhocko, shakeel.butt, muchun.song,
	cgroups, linux-mm, linux-kernel, Keren Sun

Fix some minor issues including improving formats, update params types in
functions, and removing logic duplicacies, most of which are warned by
checkpatch scirpt.

Keren Sun (3):
  mm: prefer 'unsigned int' to bare use of 'unsigned'
  mm: remove unnecessary whitespace before a quoted newline
  mm: remove the non-useful else after a break in a if statement

 mm/memcontrol-v1.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

-- 
2.47.0.338.g60cca15819-goog



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

* [PATCH 1/3] mm: prefer 'unsigned int' to bare use of 'unsigned'
  2024-11-15 23:57 [PATCH 0/3] mm: fix format issues and param types Keren Sun
@ 2024-11-15 23:57 ` Keren Sun
  2024-11-18 16:54   ` Roman Gushchin
  2024-11-15 23:57 ` [PATCH 2/3] mm: remove unnecessary whitespace before a quoted newline Keren Sun
  2024-11-15 23:57 ` [PATCH 3/3] mm: remove the non-useful else after a break in a if statement Keren Sun
  2 siblings, 1 reply; 7+ messages in thread
From: Keren Sun @ 2024-11-15 23:57 UTC (permalink / raw)
  To: akpm
  Cc: roman.gushchin, hannes, mhocko, shakeel.butt, muchun.song,
	cgroups, linux-mm, linux-kernel, Keren Sun

Change the param 'mode' from type 'unsigned' to 'unsigned int' in
memcg_event_wake() and memcg_oom_wake_function(), and for the param
'nid' in VM_BUG_ON().

Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Keren Sun <kerensun@google.com>
---
 mm/memcontrol-v1.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index 539ceefa9d2d..465201ef40b7 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -899,7 +899,7 @@ static void memcg_event_remove(struct work_struct *work)
  *
  * Called with wqh->lock held and interrupts disabled.
  */
-static int memcg_event_wake(wait_queue_entry_t *wait, unsigned mode,
+static int memcg_event_wake(wait_queue_entry_t *wait, unsigned int mode,
 			    int sync, void *key)
 {
 	struct mem_cgroup_event *event =
@@ -1216,7 +1216,7 @@ struct oom_wait_info {
 };
 
 static int memcg_oom_wake_function(wait_queue_entry_t *wait,
-	unsigned mode, int sync, void *arg)
+	unsigned int mode, int sync, void *arg)
 {
 	struct mem_cgroup *wake_memcg = (struct mem_cgroup *)arg;
 	struct mem_cgroup *oom_wait_memcg;
@@ -1658,7 +1658,7 @@ static unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
 	unsigned long nr = 0;
 	enum lru_list lru;
 
-	VM_BUG_ON((unsigned)nid >= nr_node_ids);
+	VM_BUG_ON((unsigned int)nid >= nr_node_ids);
 
 	for_each_lru(lru) {
 		if (!(BIT(lru) & lru_mask))
-- 
2.47.0.338.g60cca15819-goog



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

* [PATCH 2/3] mm: remove unnecessary whitespace before a quoted newline
  2024-11-15 23:57 [PATCH 0/3] mm: fix format issues and param types Keren Sun
  2024-11-15 23:57 ` [PATCH 1/3] mm: prefer 'unsigned int' to bare use of 'unsigned' Keren Sun
@ 2024-11-15 23:57 ` Keren Sun
  2024-11-18 16:55   ` Roman Gushchin
  2024-11-15 23:57 ` [PATCH 3/3] mm: remove the non-useful else after a break in a if statement Keren Sun
  2 siblings, 1 reply; 7+ messages in thread
From: Keren Sun @ 2024-11-15 23:57 UTC (permalink / raw)
  To: akpm
  Cc: roman.gushchin, hannes, mhocko, shakeel.butt, muchun.song,
	cgroups, linux-mm, linux-kernel, Keren Sun

Remove whitespaces before newlines for strings in pr_warn_once()

Signed-off-by: Keren Sun <kerensun@google.com>
---
 mm/memcontrol-v1.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index 465201ef40b7..4cbbced0c8a1 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -1043,13 +1043,13 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of,
 	} else if (!strcmp(name, "memory.oom_control")) {
 		pr_warn_once("oom_control is deprecated and will be removed. "
 			     "Please report your usecase to linux-mm-@kvack.org"
-			     " if you depend on this functionality. \n");
+			     " if you depend on this functionality.\n");
 		event->register_event = mem_cgroup_oom_register_event;
 		event->unregister_event = mem_cgroup_oom_unregister_event;
 	} else if (!strcmp(name, "memory.pressure_level")) {
 		pr_warn_once("pressure_level is deprecated and will be removed. "
 			     "Please report your usecase to linux-mm-@kvack.org "
-			     "if you depend on this functionality. \n");
+			     "if you depend on this functionality.\n");
 		event->register_event = vmpressure_register_event;
 		event->unregister_event = vmpressure_unregister_event;
 	} else if (!strcmp(name, "memory.memsw.usage_in_bytes")) {
@@ -1895,7 +1895,7 @@ static int mem_cgroup_oom_control_write(struct cgroup_subsys_state *css,
 
 	pr_warn_once("oom_control is deprecated and will be removed. "
 		     "Please report your usecase to linux-mm-@kvack.org if you "
-		     "depend on this functionality. \n");
+		     "depend on this functionality.\n");
 
 	/* cannot set to root cgroup and only 0 and 1 are allowed */
 	if (mem_cgroup_is_root(memcg) || !((val == 0) || (val == 1)))
-- 
2.47.0.338.g60cca15819-goog



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

* [PATCH 3/3] mm: remove the non-useful else after a break in a if statement
  2024-11-15 23:57 [PATCH 0/3] mm: fix format issues and param types Keren Sun
  2024-11-15 23:57 ` [PATCH 1/3] mm: prefer 'unsigned int' to bare use of 'unsigned' Keren Sun
  2024-11-15 23:57 ` [PATCH 2/3] mm: remove unnecessary whitespace before a quoted newline Keren Sun
@ 2024-11-15 23:57 ` Keren Sun
  2024-11-18 16:56   ` Roman Gushchin
  2 siblings, 1 reply; 7+ messages in thread
From: Keren Sun @ 2024-11-15 23:57 UTC (permalink / raw)
  To: akpm
  Cc: roman.gushchin, hannes, mhocko, shakeel.butt, muchun.song,
	cgroups, linux-mm, linux-kernel, Keren Sun

Remove the else block since there is already a break in the statement of
if (iter->oom_lock), just set iter->oom_lock true after the if block
ends.

Signed-off-by: Keren Sun <kerensun@google.com>
---
 mm/memcontrol-v1.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memcontrol-v1.c b/mm/memcontrol-v1.c
index 4cbbced0c8a1..423c861acdd8 100644
--- a/mm/memcontrol-v1.c
+++ b/mm/memcontrol-v1.c
@@ -1148,8 +1148,8 @@ static bool mem_cgroup_oom_trylock(struct mem_cgroup *memcg)
 			failed = iter;
 			mem_cgroup_iter_break(memcg, iter);
 			break;
-		} else
-			iter->oom_lock = true;
+		}
+		iter->oom_lock = true;
 	}
 
 	if (failed) {
-- 
2.47.0.338.g60cca15819-goog



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

* Re: [PATCH 1/3] mm: prefer 'unsigned int' to bare use of 'unsigned'
  2024-11-15 23:57 ` [PATCH 1/3] mm: prefer 'unsigned int' to bare use of 'unsigned' Keren Sun
@ 2024-11-18 16:54   ` Roman Gushchin
  0 siblings, 0 replies; 7+ messages in thread
From: Roman Gushchin @ 2024-11-18 16:54 UTC (permalink / raw)
  To: Keren Sun
  Cc: akpm, hannes, mhocko, shakeel.butt, muchun.song, cgroups,
	linux-mm, linux-kernel

On Fri, Nov 15, 2024 at 03:57:42PM -0800, Keren Sun wrote:
> Change the param 'mode' from type 'unsigned' to 'unsigned int' in
> memcg_event_wake() and memcg_oom_wake_function(), and for the param
> 'nid' in VM_BUG_ON().
> 
> Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
> Signed-off-by: Keren Sun <kerensun@google.com>

A small nit: Acked-by tags should follow your signature.

Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!


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

* Re: [PATCH 2/3] mm: remove unnecessary whitespace before a quoted newline
  2024-11-15 23:57 ` [PATCH 2/3] mm: remove unnecessary whitespace before a quoted newline Keren Sun
@ 2024-11-18 16:55   ` Roman Gushchin
  0 siblings, 0 replies; 7+ messages in thread
From: Roman Gushchin @ 2024-11-18 16:55 UTC (permalink / raw)
  To: Keren Sun
  Cc: akpm, hannes, mhocko, shakeel.butt, muchun.song, cgroups,
	linux-mm, linux-kernel

On Fri, Nov 15, 2024 at 03:57:43PM -0800, Keren Sun wrote:
> Remove whitespaces before newlines for strings in pr_warn_once()
> 
> Signed-off-by: Keren Sun <kerensun@google.com>

Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>


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

* Re: [PATCH 3/3] mm: remove the non-useful else after a break in a if statement
  2024-11-15 23:57 ` [PATCH 3/3] mm: remove the non-useful else after a break in a if statement Keren Sun
@ 2024-11-18 16:56   ` Roman Gushchin
  0 siblings, 0 replies; 7+ messages in thread
From: Roman Gushchin @ 2024-11-18 16:56 UTC (permalink / raw)
  To: Keren Sun
  Cc: akpm, hannes, mhocko, shakeel.butt, muchun.song, cgroups,
	linux-mm, linux-kernel

On Fri, Nov 15, 2024 at 03:57:44PM -0800, Keren Sun wrote:
> Remove the else block since there is already a break in the statement of
> if (iter->oom_lock), just set iter->oom_lock true after the if block
> ends.
> 
> Signed-off-by: Keren Sun <kerensun@google.com>

Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>

Thanks!


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

end of thread, other threads:[~2024-11-18 16:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-15 23:57 [PATCH 0/3] mm: fix format issues and param types Keren Sun
2024-11-15 23:57 ` [PATCH 1/3] mm: prefer 'unsigned int' to bare use of 'unsigned' Keren Sun
2024-11-18 16:54   ` Roman Gushchin
2024-11-15 23:57 ` [PATCH 2/3] mm: remove unnecessary whitespace before a quoted newline Keren Sun
2024-11-18 16:55   ` Roman Gushchin
2024-11-15 23:57 ` [PATCH 3/3] mm: remove the non-useful else after a break in a if statement Keren Sun
2024-11-18 16:56   ` Roman Gushchin

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