--- zzzz-none-000/linux-5.4.213/mm/page_alloc.c 2022-09-15 10:04:56.000000000 +0000 +++ alder-5690pro-762/linux-5.4.213/mm/page_alloc.c 2024-08-14 09:02:12.000000000 +0000 @@ -3122,18 +3122,21 @@ * Note: this is probably too low level an operation for use in drivers. * Please consult with lkml before using this in your driver. */ -void split_page(struct page *page, unsigned int order) +void __split_page(struct page *page, unsigned int order, unsigned long pc) { int i; VM_BUG_ON_PAGE(PageCompound(page), page); VM_BUG_ON_PAGE(!page_count(page), page); - for (i = 1; i < (1 << order); i++) + avm_set_page_current_pc(page, pc); + for (i = 1; i < (1 << order); i++) { set_page_refcounted(page + i); + avm_set_page_current_pc(page + i, pc); + } split_page_owner(page, 1 << order); } -EXPORT_SYMBOL_GPL(split_page); +EXPORT_SYMBOL_GPL(__split_page); int __isolate_free_page(struct page *page, unsigned int order) { @@ -4742,7 +4745,7 @@ */ struct page * __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order, int preferred_nid, - nodemask_t *nodemask) + nodemask_t *nodemask, unsigned long pc) { struct page *page; unsigned int alloc_flags = ALLOC_WMARK_LOW; @@ -4803,6 +4806,11 @@ trace_mm_page_alloc(page, order, alloc_mask, ac.migratetype); +#if defined(CONFIG_AVM_PAGE_TRACE) + if (likely(page)) { + avm_set_page_current_pc(page,pc); + } +#endif return page; } EXPORT_SYMBOL(__alloc_pages_nodemask); @@ -4967,13 +4975,14 @@ EXPORT_SYMBOL(page_frag_free); static void *make_alloc_exact(unsigned long addr, unsigned int order, - size_t size) + size_t size, unsigned long pc + ) { if (addr) { unsigned long alloc_end = addr + (PAGE_SIZE << order); unsigned long used = addr + PAGE_ALIGN(size); - split_page(virt_to_page((void *)addr), order); + __split_page(virt_to_page((void *)addr), order, pc); while (used < alloc_end) { free_page(used); used += PAGE_SIZE; @@ -5006,7 +5015,7 @@ gfp_mask &= ~__GFP_COMP; addr = __get_free_pages(gfp_mask, order); - return make_alloc_exact(addr, order, size); + return make_alloc_exact(addr, order, size, _RET_IP_); } EXPORT_SYMBOL(alloc_pages_exact); @@ -5033,7 +5042,7 @@ p = alloc_pages_node(nid, gfp_mask, order); if (!p) return NULL; - return make_alloc_exact((unsigned long)page_address(p), order, size); + return make_alloc_exact((unsigned long)page_address(p), order, size, 0L); } /** @@ -5278,6 +5287,13 @@ struct zone *zone; pg_data_t *pgdat; +#if defined(CONFIG_AVM_ENHANCED) + int v_mem = get_used_vmalloc_mem(); + + if (v_mem >= 0) + printk("vmalloc-used: %dKiB (%d pages)\n", v_mem >> 10, v_mem >> PAGE_SHIFT); +#endif/*--- #if defined(CONFIG_AVM_ENHANCED) ---*/ + for_each_populated_zone(zone) { if (show_mem_node_skip(filter, zone_to_nid(zone), nodemask)) continue; @@ -6886,7 +6902,7 @@ mem_map = NODE_DATA(0)->node_mem_map; #if defined(CONFIG_HAVE_MEMBLOCK_NODE_MAP) || defined(CONFIG_FLATMEM) if (page_to_pfn(mem_map) != pgdat->node_start_pfn) - mem_map -= offset; + mem_map -= offset + (pgdat->node_start_pfn - ARCH_PFN_OFFSET); #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ } #endif