Skip to content

Commit ee8f248

Browse files
Becky Brucetorvalds
authored andcommitted
hugetlb: add phys addr to struct huge_bootmem_page
This is needed on HIGHMEM systems - we don't always have a virtual address so store the physical address and map it in as needed. [akpm@linux-foundation.org: cleanup] Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 2b37c35 commit ee8f248

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎include/linux/hugetlb.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,9 @@ struct hstate {
231231
struct huge_bootmem_page {
232232
struct list_head list;
233233
struct hstate *hstate;
234+
#ifdef CONFIG_HIGHMEM
235+
phys_addr_t phys;
236+
#endif
234237
};
235238

236239
struct page *alloc_huge_page_node(struct hstate *h, int nid);

‎mm/hugetlb.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1105,8 +1105,16 @@ static void __init gather_bootmem_prealloc(void)
11051105
struct huge_bootmem_page *m;
11061106

11071107
list_for_each_entry(m, &huge_boot_pages, list) {
1108-
struct page *page = virt_to_page(m);
11091108
struct hstate *h = m->hstate;
1109+
struct page *page;
1110+
1111+
#ifdef CONFIG_HIGHMEM
1112+
page = pfn_to_page(m->phys >> PAGE_SHIFT);
1113+
free_bootmem_late((unsigned long)m,
1114+
sizeof(struct huge_bootmem_page));
1115+
#else
1116+
page = virt_to_page(m);
1117+
#endif
11101118
__ClearPageReserved(page);
11111119
WARN_ON(page_count(page) != 1);
11121120
prep_compound_huge_page(page, h->order);

0 commit comments

Comments
 (0)