linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low return bool
@ 2015-09-21 13:37 Yaowei Bai
  2015-09-21 13:37 ` [PATCH 2/2] mm/memcontrol: make mem_cgroup_inactive_anon_is_low " Yaowei Bai
  2015-09-24 19:50 ` [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low " Johannes Weiner
  0 siblings, 2 replies; 3+ messages in thread
From: Yaowei Bai @ 2015-09-21 13:37 UTC (permalink / raw)
  To: akpm, mgorman, mhocko, rientjes, hannes, vdavydov, oleg, vbabka,
	iamjoonsoo.kim, tj
  Cc: linux-mm, linux-kernel

This patch makes inactive_anon/file_is_low return bool
due to these particular functions only using either one
or zero as their return value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
 mm/vmscan.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 2d978b2..ed0c7fc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1859,7 +1859,7 @@ static void shrink_active_list(unsigned long nr_to_scan,
 }
 
 #ifdef CONFIG_SWAP
-static int inactive_anon_is_low_global(struct zone *zone)
+static bool inactive_anon_is_low_global(struct zone *zone)
 {
 	unsigned long active, inactive;
 
@@ -1867,9 +1867,9 @@ static int inactive_anon_is_low_global(struct zone *zone)
 	inactive = zone_page_state(zone, NR_INACTIVE_ANON);
 
 	if (inactive * zone->inactive_ratio < active)
-		return 1;
+		return true;
 
-	return 0;
+	return false;
 }
 
 /**
@@ -1879,14 +1879,14 @@ static int inactive_anon_is_low_global(struct zone *zone)
  * Returns true if the zone does not have enough inactive anon pages,
  * meaning some active anon pages need to be deactivated.
  */
-static int inactive_anon_is_low(struct lruvec *lruvec)
+static bool inactive_anon_is_low(struct lruvec *lruvec)
 {
 	/*
 	 * If we don't have swap space, anonymous page deactivation
 	 * is pointless.
 	 */
 	if (!total_swap_pages)
-		return 0;
+		return false;
 
 	if (!mem_cgroup_disabled())
 		return mem_cgroup_inactive_anon_is_low(lruvec);
@@ -1894,9 +1894,9 @@ static int inactive_anon_is_low(struct lruvec *lruvec)
 	return inactive_anon_is_low_global(lruvec_zone(lruvec));
 }
 #else
-static inline int inactive_anon_is_low(struct lruvec *lruvec)
+static inline bool inactive_anon_is_low(struct lruvec *lruvec)
 {
-	return 0;
+	return false;
 }
 #endif
 
@@ -1914,7 +1914,7 @@ static inline int inactive_anon_is_low(struct lruvec *lruvec)
  * This uses a different ratio than the anonymous pages, because
  * the page cache uses a use-once replacement algorithm.
  */
-static int inactive_file_is_low(struct lruvec *lruvec)
+static bool inactive_file_is_low(struct lruvec *lruvec)
 {
 	unsigned long inactive;
 	unsigned long active;
@@ -1925,7 +1925,7 @@ static int inactive_file_is_low(struct lruvec *lruvec)
 	return active > inactive;
 }
 
-static int inactive_list_is_low(struct lruvec *lruvec, enum lru_list lru)
+static bool inactive_list_is_low(struct lruvec *lruvec, enum lru_list lru)
 {
 	if (is_file_lru(lru))
 		return inactive_file_is_low(lruvec);
-- 
1.9.1


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* [PATCH 2/2] mm/memcontrol: make mem_cgroup_inactive_anon_is_low return bool
  2015-09-21 13:37 [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low return bool Yaowei Bai
@ 2015-09-21 13:37 ` Yaowei Bai
  2015-09-24 19:50 ` [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low " Johannes Weiner
  1 sibling, 0 replies; 3+ messages in thread
From: Yaowei Bai @ 2015-09-21 13:37 UTC (permalink / raw)
  To: akpm, mgorman, mhocko, rientjes, hannes, vdavydov, oleg, vbabka,
	iamjoonsoo.kim, tj
  Cc: linux-mm, linux-kernel

This patch makes mem_cgroup_inactive_anon_is_low return bool due to
this particular function only using either one or zero as its return
value.

No functional change.

Signed-off-by: Yaowei Bai <bywxiaobai@163.com>
---
 include/linux/memcontrol.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index ad800e6..91a6bf3 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -383,7 +383,7 @@ unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
 	return mz->lru_size[lru];
 }
 
-static inline int mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
+static inline bool mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
 {
 	unsigned long inactive_ratio;
 	unsigned long inactive;
@@ -584,10 +584,10 @@ static inline bool mem_cgroup_disabled(void)
 	return true;
 }
 
-static inline int
+static inline bool
 mem_cgroup_inactive_anon_is_low(struct lruvec *lruvec)
 {
-	return 1;
+	return true;
 }
 
 static inline bool mem_cgroup_lruvec_online(struct lruvec *lruvec)
-- 
1.9.1


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

* Re: [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low return bool
  2015-09-21 13:37 [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low return bool Yaowei Bai
  2015-09-21 13:37 ` [PATCH 2/2] mm/memcontrol: make mem_cgroup_inactive_anon_is_low " Yaowei Bai
@ 2015-09-24 19:50 ` Johannes Weiner
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Weiner @ 2015-09-24 19:50 UTC (permalink / raw)
  To: Yaowei Bai
  Cc: akpm, mgorman, mhocko, rientjes, vdavydov, oleg, vbabka,
	iamjoonsoo.kim, tj, linux-mm, linux-kernel

On Mon, Sep 21, 2015 at 09:37:52PM +0800, Yaowei Bai wrote:
> This patch makes inactive_anon/file_is_low return bool
> due to these particular functions only using either one
> or zero as their return value.
> 
> No functional change.
> 
> Signed-off-by: Yaowei Bai <bywxiaobai@163.com>

Acked-by: Johannes Weiner <hannes@cmpxchg.org>

You can probably merge both patches into a single commit.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

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

end of thread, other threads:[~2015-09-24 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-21 13:37 [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low return bool Yaowei Bai
2015-09-21 13:37 ` [PATCH 2/2] mm/memcontrol: make mem_cgroup_inactive_anon_is_low " Yaowei Bai
2015-09-24 19:50 ` [PATCH 1/2] mm/vmscan: make inactive_anon/file_is_low " Johannes Weiner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).