diff mbox series

hugetlb: Remove check_coalesce_bug debug code

Message ID 20200219233610.13808-1-almasrymina@google.com (mailing list archive)
State New, archived
Headers show
Series hugetlb: Remove check_coalesce_bug debug code | expand

Commit Message

Mina Almasry Feb. 19, 2020, 11:36 p.m. UTC
Commit b5f16a533ce8a ("hugetlb: support file_region coalescing
again") made changes to the resv_map code which are hard to test, it
so added debug code guarded by CONFIG_DEBUG_VM which conducts an
expensive operation that loops over the resv_map and checks it for
errors.

Unfortunately, some distros have CONFIG_DEBUG_VM on in their default
kernels, and we don't want this debug code behind CONFIG_DEBUG_VM
and called each time a file region is added. This patch removes this
debug code. I may look into making it a test or leave it for my local
testing.

Signed-off-by: Mina Almasry <almasrymina@google.com>

Cc: David Rientjes <rientjes@google.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org

Fixes: b5f16a533ce8a ("hugetlb: support file_region coalescing again")

---
 mm/hugetlb.c | 43 -------------------------------------------
 1 file changed, 43 deletions(-)

--
2.25.0.265.gbab2e86ba0-goog

Comments

Mike Kravetz Feb. 20, 2020, 12:07 a.m. UTC | #1
On 2/19/20 3:36 PM, Mina Almasry wrote:
> Commit b5f16a533ce8a ("hugetlb: support file_region coalescing
> again") made changes to the resv_map code which are hard to test, it
> so added debug code guarded by CONFIG_DEBUG_VM which conducts an
> expensive operation that loops over the resv_map and checks it for
> errors.
> 
> Unfortunately, some distros have CONFIG_DEBUG_VM on in their default
> kernels, and we don't want this debug code behind CONFIG_DEBUG_VM
> and called each time a file region is added. This patch removes this
> debug code. I may look into making it a test or leave it for my local
> testing.
> 
> Signed-off-by: Mina Almasry <almasrymina@google.com>
> 
> Cc: David Rientjes <rientjes@google.com>
> Cc: Mike Kravetz <mike.kravetz@oracle.com>
> Cc: Shakeel Butt <shakeelb@google.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: linux-kernel@vger.kernel.org
> 
> Fixes: b5f16a533ce8a ("hugetlb: support file_region coalescing again")

Thanks!

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>

The review also applies to the original patch with the removal of
this code.
diff mbox series

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 94e27dfec0435..3febbbda3dc2b 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -289,48 +289,6 @@  static bool has_same_uncharge_info(struct file_region *rg,
 #endif
 }

-#if defined(CONFIG_DEBUG_VM) && defined(CONFIG_CGROUP_HUGETLB)
-static void dump_resv_map(struct resv_map *resv)
-{
-	struct list_head *head = &resv->regions;
-	struct file_region *rg = NULL;
-
-	pr_err("--------- start print resv_map ---------\n");
-	list_for_each_entry(rg, head, link) {
-		pr_err("rg->from=%ld, rg->to=%ld, rg->reservation_counter=%px, rg->css=%px\n",
-		       rg->from, rg->to, rg->reservation_counter, rg->css);
-	}
-	pr_err("--------- end print resv_map ---------\n");
-}
-
-/* Debug function to loop over the resv_map and make sure that coalescing is
- * working.
- */
-static void check_coalesce_bug(struct resv_map *resv)
-{
-	struct list_head *head = &resv->regions;
-	struct file_region *rg = NULL, *nrg = NULL;
-
-	list_for_each_entry(rg, head, link) {
-		nrg = list_next_entry(rg, link);
-
-		if (&nrg->link == head)
-			break;
-
-		if (nrg->reservation_counter && nrg->from == rg->to &&
-		    nrg->reservation_counter == rg->reservation_counter &&
-		    nrg->css == rg->css) {
-			dump_resv_map(resv);
-			VM_BUG_ON(true);
-		}
-	}
-}
-#else
-static void check_coalesce_bug(struct resv_map *resv)
-{
-}
-#endif
-
 static void coalesce_file_region(struct resv_map *resv, struct file_region *rg)
 {
 	struct file_region *nrg = NULL, *prg = NULL;
@@ -435,7 +393,6 @@  static long add_reservation_in_range(struct resv_map *resv, long f, long t,
 	}

 	VM_BUG_ON(add < 0);
-	check_coalesce_bug(resv);
 	return add;
 }