From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935536AbeB1Wcr (ORCPT ); Wed, 28 Feb 2018 17:32:47 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:44488 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935455AbeB1WcK (ORCPT ); Wed, 28 Feb 2018 17:32:10 -0500 From: Matthew Wilcox To: linux-mm@kvack.org Cc: Matthew Wilcox , Martin Schwidefsky , linux-kernel@vger.kernel.org Subject: [PATCH v3 3/4] mm: Mark pages allocated through vmalloc Date: Wed, 28 Feb 2018 14:31:56 -0800 Message-Id: <20180228223157.9281-4-willy@infradead.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180228223157.9281-1-willy@infradead.org> References: <20180228223157.9281-1-willy@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Matthew Wilcox Use a bit in page_type to mark pages which have been allocated through vmalloc. This can be helpful when debugging or analysing crashdumps. Signed-off-by: Matthew Wilcox --- include/linux/page-flags.h | 6 ++++++ mm/vmalloc.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index d151f590bbc6..8142ab716e90 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -643,6 +643,7 @@ PAGEFLAG_FALSE(DoubleMap) #define PG_buddy 0x00000080 #define PG_balloon 0x00000100 #define PG_kmemcg 0x00000200 +#define PG_vmalloc 0x00000400 #define PageType(page, flag) \ ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) @@ -681,6 +682,11 @@ PAGE_TYPE_OPS(Balloon, balloon) */ PAGE_TYPE_OPS(Kmemcg, kmemcg) +/* + * Pages allocated through vmalloc are tagged with this bit. + */ +PAGE_TYPE_OPS(Vmalloc, vmalloc) + extern bool is_free_buddy_page(struct page *page); __PAGEFLAG(Isolated, isolated, PF_ANY); diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ebff729cc956..3bc0538fc21b 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1536,6 +1536,7 @@ static void __vunmap(const void *addr, int deallocate_pages) struct page *page = area->pages[i]; BUG_ON(!page); + __ClearPageVmalloc(page); __free_pages(page, 0); } @@ -1705,6 +1706,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, area->nr_pages = i; goto fail; } + __SetPageVmalloc(page); area->pages[i] = page; if (gfpflags_allow_blocking(gfp_mask|highmem_mask)) cond_resched(); -- 2.16.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f200.google.com (mail-pf0-f200.google.com [209.85.192.200]) by kanga.kvack.org (Postfix) with ESMTP id F26206B0008 for ; Wed, 28 Feb 2018 17:32:11 -0500 (EST) Received: by mail-pf0-f200.google.com with SMTP id g66so2196916pfj.11 for ; Wed, 28 Feb 2018 14:32:11 -0800 (PST) Received: from bombadil.infradead.org (bombadil.infradead.org. [2607:7c80:54:e::133]) by mx.google.com with ESMTPS id y4si1572216pgc.601.2018.02.28.14.32.08 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Feb 2018 14:32:08 -0800 (PST) From: Matthew Wilcox Subject: [PATCH v3 3/4] mm: Mark pages allocated through vmalloc Date: Wed, 28 Feb 2018 14:31:56 -0800 Message-Id: <20180228223157.9281-4-willy@infradead.org> In-Reply-To: <20180228223157.9281-1-willy@infradead.org> References: <20180228223157.9281-1-willy@infradead.org> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org Cc: Matthew Wilcox , Martin Schwidefsky , linux-kernel@vger.kernel.org From: Matthew Wilcox Use a bit in page_type to mark pages which have been allocated through vmalloc. This can be helpful when debugging or analysing crashdumps. Signed-off-by: Matthew Wilcox --- include/linux/page-flags.h | 6 ++++++ mm/vmalloc.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index d151f590bbc6..8142ab716e90 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -643,6 +643,7 @@ PAGEFLAG_FALSE(DoubleMap) #define PG_buddy 0x00000080 #define PG_balloon 0x00000100 #define PG_kmemcg 0x00000200 +#define PG_vmalloc 0x00000400 #define PageType(page, flag) \ ((page->page_type & (PAGE_TYPE_BASE | flag)) == PAGE_TYPE_BASE) @@ -681,6 +682,11 @@ PAGE_TYPE_OPS(Balloon, balloon) */ PAGE_TYPE_OPS(Kmemcg, kmemcg) +/* + * Pages allocated through vmalloc are tagged with this bit. + */ +PAGE_TYPE_OPS(Vmalloc, vmalloc) + extern bool is_free_buddy_page(struct page *page); __PAGEFLAG(Isolated, isolated, PF_ANY); diff --git a/mm/vmalloc.c b/mm/vmalloc.c index ebff729cc956..3bc0538fc21b 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -1536,6 +1536,7 @@ static void __vunmap(const void *addr, int deallocate_pages) struct page *page = area->pages[i]; BUG_ON(!page); + __ClearPageVmalloc(page); __free_pages(page, 0); } @@ -1705,6 +1706,7 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, area->nr_pages = i; goto fail; } + __SetPageVmalloc(page); area->pages[i] = page; if (gfpflags_allow_blocking(gfp_mask|highmem_mask)) cond_resched(); -- 2.16.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: email@kvack.org