All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] mm: make several functions return bool
@ 2016-03-23  2:26 ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

This series only makes several functions return bool to
improve readability, no other functional changes.

Yaowei Bai (5):
  mm/hugetlb: is_vm_hugetlb_page can be boolean
  mm/memory_hotplug: is_mem_section_removable can be boolean
  mm/vmalloc: is_vmalloc_addr can be boolean
  mm/lru: is_file/active_lru can be boolean
  mm/mempolicy: vma_migratable can be boolean

 include/linux/hugetlb_inline.h |  6 +++---
 include/linux/memory_hotplug.h |  6 +++---
 include/linux/mempolicy.h      | 10 +++++-----
 include/linux/mm.h             |  4 ++--
 include/linux/mmzone.h         |  4 ++--
 mm/memory_hotplug.c            |  6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)

-- 
1.9.1

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

* [PATCH 0/5] mm: make several functions return bool
@ 2016-03-23  2:26 ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

This series only makes several functions return bool to
improve readability, no other functional changes.

Yaowei Bai (5):
  mm/hugetlb: is_vm_hugetlb_page can be boolean
  mm/memory_hotplug: is_mem_section_removable can be boolean
  mm/vmalloc: is_vmalloc_addr can be boolean
  mm/lru: is_file/active_lru can be boolean
  mm/mempolicy: vma_migratable can be boolean

 include/linux/hugetlb_inline.h |  6 +++---
 include/linux/memory_hotplug.h |  6 +++---
 include/linux/mempolicy.h      | 10 +++++-----
 include/linux/mm.h             |  4 ++--
 include/linux/mmzone.h         |  4 ++--
 mm/memory_hotplug.c            |  6 +++---
 6 files changed, 18 insertions(+), 18 deletions(-)

-- 
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	[flat|nested] 16+ messages in thread

* [PATCH 1/5] mm/hugetlb: is_vm_hugetlb_page can be boolean
  2016-03-23  2:26 ` Yaowei Bai
@ 2016-03-23  2:26   ` Yaowei Bai
  -1 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

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

No functional change.

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

diff --git a/include/linux/hugetlb_inline.h b/include/linux/hugetlb_inline.h
index 2bb681f..a4e7ca0 100644
--- a/include/linux/hugetlb_inline.h
+++ b/include/linux/hugetlb_inline.h
@@ -5,16 +5,16 @@
 
 #include <linux/mm.h>
 
-static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
+static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
 {
 	return !!(vma->vm_flags & VM_HUGETLB);
 }
 
 #else
 
-static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
+static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
 {
-	return 0;
+	return false;
 }
 
 #endif
-- 
1.9.1

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

* [PATCH 1/5] mm/hugetlb: is_vm_hugetlb_page can be boolean
@ 2016-03-23  2:26   ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

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

No functional change.

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

diff --git a/include/linux/hugetlb_inline.h b/include/linux/hugetlb_inline.h
index 2bb681f..a4e7ca0 100644
--- a/include/linux/hugetlb_inline.h
+++ b/include/linux/hugetlb_inline.h
@@ -5,16 +5,16 @@
 
 #include <linux/mm.h>
 
-static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
+static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
 {
 	return !!(vma->vm_flags & VM_HUGETLB);
 }
 
 #else
 
-static inline int is_vm_hugetlb_page(struct vm_area_struct *vma)
+static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
 {
-	return 0;
+	return false;
 }
 
 #endif
-- 
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] 16+ messages in thread

* [PATCH 2/5] mm/memory_hotplug: is_mem_section_removable can be boolean
  2016-03-23  2:26 ` Yaowei Bai
@ 2016-03-23  2:26   ` Yaowei Bai
  -1 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

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

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/memory_hotplug.h | 6 +++---
 mm/memory_hotplug.c            | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index adbef58..20d8a5d 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -247,16 +247,16 @@ static inline void mem_hotplug_done(void) {}
 
 #ifdef CONFIG_MEMORY_HOTREMOVE
 
-extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
+extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
 extern void try_offline_node(int nid);
 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
 extern void remove_memory(int nid, u64 start, u64 size);
 
 #else
-static inline int is_mem_section_removable(unsigned long pfn,
+static inline bool is_mem_section_removable(unsigned long pfn,
 					unsigned long nr_pages)
 {
-	return 0;
+	return false;
 }
 
 static inline void try_offline_node(int nid) {}
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 24ea063..87be160 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1406,7 +1406,7 @@ static struct page *next_active_pageblock(struct page *page)
 }
 
 /* Checks if this range of memory is likely to be hot-removable. */
-int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
+bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
 {
 	struct page *page = pfn_to_page(start_pfn);
 	struct page *end_page = page + nr_pages;
@@ -1414,12 +1414,12 @@ int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
 	/* Check the starting page of each pageblock within the range */
 	for (; page < end_page; page = next_active_pageblock(page)) {
 		if (!is_pageblock_removable_nolock(page))
-			return 0;
+			return false;
 		cond_resched();
 	}
 
 	/* All pageblocks in the memory block are likely to be hot-removable */
-	return 1;
+	return true;
 }
 
 /*
-- 
1.9.1

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

* [PATCH 2/5] mm/memory_hotplug: is_mem_section_removable can be boolean
@ 2016-03-23  2:26   ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

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

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/memory_hotplug.h | 6 +++---
 mm/memory_hotplug.c            | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index adbef58..20d8a5d 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -247,16 +247,16 @@ static inline void mem_hotplug_done(void) {}
 
 #ifdef CONFIG_MEMORY_HOTREMOVE
 
-extern int is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
+extern bool is_mem_section_removable(unsigned long pfn, unsigned long nr_pages);
 extern void try_offline_node(int nid);
 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages);
 extern void remove_memory(int nid, u64 start, u64 size);
 
 #else
-static inline int is_mem_section_removable(unsigned long pfn,
+static inline bool is_mem_section_removable(unsigned long pfn,
 					unsigned long nr_pages)
 {
-	return 0;
+	return false;
 }
 
 static inline void try_offline_node(int nid) {}
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 24ea063..87be160 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1406,7 +1406,7 @@ static struct page *next_active_pageblock(struct page *page)
 }
 
 /* Checks if this range of memory is likely to be hot-removable. */
-int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
+bool is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
 {
 	struct page *page = pfn_to_page(start_pfn);
 	struct page *end_page = page + nr_pages;
@@ -1414,12 +1414,12 @@ int is_mem_section_removable(unsigned long start_pfn, unsigned long nr_pages)
 	/* Check the starting page of each pageblock within the range */
 	for (; page < end_page; page = next_active_pageblock(page)) {
 		if (!is_pageblock_removable_nolock(page))
-			return 0;
+			return false;
 		cond_resched();
 	}
 
 	/* All pageblocks in the memory block are likely to be hot-removable */
-	return 1;
+	return true;
 }
 
 /*
-- 
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] 16+ messages in thread

* [PATCH 3/5] mm/vmalloc: is_vmalloc_addr can be boolean
  2016-03-23  2:26 ` Yaowei Bai
@ 2016-03-23  2:26   ` Yaowei Bai
  -1 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

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

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/mm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index dbf1edd..826d2fb 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -400,14 +400,14 @@ unsigned long vmalloc_to_pfn(const void *addr);
  * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
  * is no special casing required.
  */
-static inline int is_vmalloc_addr(const void *x)
+static inline bool is_vmalloc_addr(const void *x)
 {
 #ifdef CONFIG_MMU
 	unsigned long addr = (unsigned long)x;
 
 	return addr >= VMALLOC_START && addr < VMALLOC_END;
 #else
-	return 0;
+	return false;
 #endif
 }
 #ifdef CONFIG_MMU
-- 
1.9.1

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

* [PATCH 3/5] mm/vmalloc: is_vmalloc_addr can be boolean
@ 2016-03-23  2:26   ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

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

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/mm.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index dbf1edd..826d2fb 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -400,14 +400,14 @@ unsigned long vmalloc_to_pfn(const void *addr);
  * On nommu, vmalloc/vfree wrap through kmalloc/kfree directly, so there
  * is no special casing required.
  */
-static inline int is_vmalloc_addr(const void *x)
+static inline bool is_vmalloc_addr(const void *x)
 {
 #ifdef CONFIG_MMU
 	unsigned long addr = (unsigned long)x;
 
 	return addr >= VMALLOC_START && addr < VMALLOC_END;
 #else
-	return 0;
+	return false;
 #endif
 }
 #ifdef CONFIG_MMU
-- 
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] 16+ messages in thread

* [PATCH 4/5] mm/lru: is_file/active_lru can be boolean
  2016-03-23  2:26 ` Yaowei Bai
@ 2016-03-23  2:26   ` Yaowei Bai
  -1 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

This patch makes is_file/active_lru return bool to improve
readability due to these particular functions only using either
one or zero as their return value.

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/mmzone.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6de02ac3..652d60e 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -188,12 +188,12 @@ enum lru_list {
 
 #define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)
 
-static inline int is_file_lru(enum lru_list lru)
+static inline bool is_file_lru(enum lru_list lru)
 {
 	return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE);
 }
 
-static inline int is_active_lru(enum lru_list lru)
+static inline bool is_active_lru(enum lru_list lru)
 {
 	return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
 }
-- 
1.9.1

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

* [PATCH 4/5] mm/lru: is_file/active_lru can be boolean
@ 2016-03-23  2:26   ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

This patch makes is_file/active_lru return bool to improve
readability due to these particular functions only using either
one or zero as their return value.

No functional change.

Signed-off-by: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
---
 include/linux/mmzone.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 6de02ac3..652d60e 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -188,12 +188,12 @@ enum lru_list {
 
 #define for_each_evictable_lru(lru) for (lru = 0; lru <= LRU_ACTIVE_FILE; lru++)
 
-static inline int is_file_lru(enum lru_list lru)
+static inline bool is_file_lru(enum lru_list lru)
 {
 	return (lru == LRU_INACTIVE_FILE || lru == LRU_ACTIVE_FILE);
 }
 
-static inline int is_active_lru(enum lru_list lru)
+static inline bool is_active_lru(enum lru_list lru)
 {
 	return (lru == LRU_ACTIVE_ANON || lru == LRU_ACTIVE_FILE);
 }
-- 
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] 16+ messages in thread

* [PATCH 5/5] mm/mempolicy: vma_migratable can be boolean
  2016-03-23  2:26 ` Yaowei Bai
@ 2016-03-23  2:26   ` Yaowei Bai
  -1 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

This patch makes vma_migratable 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 <baiyaowei@cmss.chinamobile.com>
---
 include/linux/mempolicy.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 2696c1f..6978a99 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -172,14 +172,14 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol);
 extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
 
 /* Check if a vma is migratable */
-static inline int vma_migratable(struct vm_area_struct *vma)
+static inline bool vma_migratable(struct vm_area_struct *vma)
 {
 	if (vma->vm_flags & (VM_IO | VM_PFNMAP))
-		return 0;
+		return false;
 
 #ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
 	if (vma->vm_flags & VM_HUGETLB)
-		return 0;
+		return false;
 #endif
 
 	/*
@@ -190,8 +190,8 @@ static inline int vma_migratable(struct vm_area_struct *vma)
 	if (vma->vm_file &&
 		gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping))
 								< policy_zone)
-			return 0;
-	return 1;
+			return false;
+	return true;
 }
 
 extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);
-- 
1.9.1

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

* [PATCH 5/5] mm/mempolicy: vma_migratable can be boolean
@ 2016-03-23  2:26   ` Yaowei Bai
  0 siblings, 0 replies; 16+ messages in thread
From: Yaowei Bai @ 2016-03-23  2:26 UTC (permalink / raw
  To: akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel,
	baiyaowei

This patch makes vma_migratable 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 <baiyaowei@cmss.chinamobile.com>
---
 include/linux/mempolicy.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index 2696c1f..6978a99 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -172,14 +172,14 @@ extern int mpol_parse_str(char *str, struct mempolicy **mpol);
 extern void mpol_to_str(char *buffer, int maxlen, struct mempolicy *pol);
 
 /* Check if a vma is migratable */
-static inline int vma_migratable(struct vm_area_struct *vma)
+static inline bool vma_migratable(struct vm_area_struct *vma)
 {
 	if (vma->vm_flags & (VM_IO | VM_PFNMAP))
-		return 0;
+		return false;
 
 #ifndef CONFIG_ARCH_ENABLE_HUGEPAGE_MIGRATION
 	if (vma->vm_flags & VM_HUGETLB)
-		return 0;
+		return false;
 #endif
 
 	/*
@@ -190,8 +190,8 @@ static inline int vma_migratable(struct vm_area_struct *vma)
 	if (vma->vm_file &&
 		gfp_zone(mapping_gfp_mask(vma->vm_file->f_mapping))
 								< policy_zone)
-			return 0;
-	return 1;
+			return false;
+	return true;
 }
 
 extern int mpol_misplaced(struct page *, struct vm_area_struct *, unsigned long);
-- 
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] 16+ messages in thread

* Re: [PATCH 4/5] mm/lru: is_file/active_lru can be boolean
  2016-03-23  2:26   ` Yaowei Bai
@ 2016-03-23  3:17     ` Joe Perches
  -1 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2016-03-23  3:17 UTC (permalink / raw
  To: Yaowei Bai, akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel

On Wed, 2016-03-23 at 10:26 +0800, Yaowei Bai wrote:
> This patch makes is_file/active_lru return bool to improve
> readability due to these particular functions only using either
> one or zero as their return value.
> 
> No functional change.

These assignments to int should likely be modified too

$ git grep -w -n is_file_lru
include/linux/mmzone.h:191:static inline int is_file_lru(enum lru_list lru)
mm/vmscan.c:1404:                                   nr_taken, mode, is_file_lru(lru));
mm/vmscan.c:1525:                       int file = is_file_lru(lru);
mm/vmscan.c:1581:       int file = is_file_lru(lru);
mm/vmscan.c:1783:       int file = is_file_lru(lru);
mm/vmscan.c:1934:       if (is_file_lru(lru))
mm/vmscan.c:2129:                       int file = is_file_lru(lru);

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

* Re: [PATCH 4/5] mm/lru: is_file/active_lru can be boolean
@ 2016-03-23  3:17     ` Joe Perches
  0 siblings, 0 replies; 16+ messages in thread
From: Joe Perches @ 2016-03-23  3:17 UTC (permalink / raw
  To: Yaowei Bai, akpm
  Cc: n-horiguchi, kirill.shutemov, rientjes, iamjoonsoo.kim, hannes,
	vdavydov, kuleshovmail, vbabka, mgorman, linux-mm, linux-kernel

On Wed, 2016-03-23 at 10:26 +0800, Yaowei Bai wrote:
> This patch makes is_file/active_lru return bool to improve
> readability due to these particular functions only using either
> one or zero as their return value.
> 
> No functional change.

These assignments to int should likely be modified too

$ git grep -w -n is_file_lru
include/linux/mmzone.h:191:static inline int is_file_lru(enum lru_list lru)
mm/vmscan.c:1404:                                   nr_taken, mode, is_file_lru(lru));
mm/vmscan.c:1525:                       int file = is_file_lru(lru);
mm/vmscan.c:1581:       int file = is_file_lru(lru);
mm/vmscan.c:1783:       int file = is_file_lru(lru);
mm/vmscan.c:1934:       if (is_file_lru(lru))
mm/vmscan.c:2129:                       int file = is_file_lru(lru);

--
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] 16+ messages in thread

* Re: [PATCH 4/5] mm/lru: is_file/active_lru can be boolean
  2016-03-23  3:17     ` Joe Perches
@ 2016-03-23 11:44       ` Mel Gorman
  -1 siblings, 0 replies; 16+ messages in thread
From: Mel Gorman @ 2016-03-23 11:44 UTC (permalink / raw
  To: Joe Perches
  Cc: Yaowei Bai, akpm, n-horiguchi, kirill.shutemov, rientjes,
	iamjoonsoo.kim, hannes, vdavydov, kuleshovmail, vbabka, linux-mm,
	linux-kernel

On Tue, Mar 22, 2016 at 08:17:08PM -0700, Joe Perches wrote:
> On Wed, 2016-03-23 at 10:26 +0800, Yaowei Bai wrote:
> > This patch makes is_file/active_lru return bool to improve
> > readability due to these particular functions only using either
> > one or zero as their return value.
> > 
> > No functional change.
> 
> These assignments to int should likely be modified too
> 

Which would lead to oddities as the ints are used as offsets within
enums. Patch 2 has a problem where a bool is then used as part of a
bitmask operation.

I stopped looking fairly early on. Conversions from int to bool as part
of a cleanup-only series are almost never useful and sometimes introduce
subtle breakage. It is only worth the conversion when the helper is being
modified for some other purpose.

On that grounds, NAK to the whole series as small problems were quickly
obvious and it's not worth the brainpower to find all the problems when
the end result does not give us a tangible improvement.

-- 
Mel Gorman
SUSE Labs

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

* Re: [PATCH 4/5] mm/lru: is_file/active_lru can be boolean
@ 2016-03-23 11:44       ` Mel Gorman
  0 siblings, 0 replies; 16+ messages in thread
From: Mel Gorman @ 2016-03-23 11:44 UTC (permalink / raw
  To: Joe Perches
  Cc: Yaowei Bai, akpm, n-horiguchi, kirill.shutemov, rientjes,
	iamjoonsoo.kim, hannes, vdavydov, kuleshovmail, vbabka, linux-mm,
	linux-kernel

On Tue, Mar 22, 2016 at 08:17:08PM -0700, Joe Perches wrote:
> On Wed, 2016-03-23 at 10:26 +0800, Yaowei Bai wrote:
> > This patch makes is_file/active_lru return bool to improve
> > readability due to these particular functions only using either
> > one or zero as their return value.
> > 
> > No functional change.
> 
> These assignments to int should likely be modified too
> 

Which would lead to oddities as the ints are used as offsets within
enums. Patch 2 has a problem where a bool is then used as part of a
bitmask operation.

I stopped looking fairly early on. Conversions from int to bool as part
of a cleanup-only series are almost never useful and sometimes introduce
subtle breakage. It is only worth the conversion when the helper is being
modified for some other purpose.

On that grounds, NAK to the whole series as small problems were quickly
obvious and it's not worth the brainpower to find all the problems when
the end result does not give us a tangible improvement.

-- 
Mel Gorman
SUSE Labs

--
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] 16+ messages in thread

end of thread, other threads:[~2016-03-23 11:44 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-23  2:26 [PATCH 0/5] mm: make several functions return bool Yaowei Bai
2016-03-23  2:26 ` Yaowei Bai
2016-03-23  2:26 ` [PATCH 1/5] mm/hugetlb: is_vm_hugetlb_page can be boolean Yaowei Bai
2016-03-23  2:26   ` Yaowei Bai
2016-03-23  2:26 ` [PATCH 2/5] mm/memory_hotplug: is_mem_section_removable " Yaowei Bai
2016-03-23  2:26   ` Yaowei Bai
2016-03-23  2:26 ` [PATCH 3/5] mm/vmalloc: is_vmalloc_addr " Yaowei Bai
2016-03-23  2:26   ` Yaowei Bai
2016-03-23  2:26 ` [PATCH 4/5] mm/lru: is_file/active_lru " Yaowei Bai
2016-03-23  2:26   ` Yaowei Bai
2016-03-23  3:17   ` Joe Perches
2016-03-23  3:17     ` Joe Perches
2016-03-23 11:44     ` Mel Gorman
2016-03-23 11:44       ` Mel Gorman
2016-03-23  2:26 ` [PATCH 5/5] mm/mempolicy: vma_migratable " Yaowei Bai
2016-03-23  2:26   ` Yaowei Bai

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.