brintos

brintos / linux-shallow public Read only

0
0
Text · 1.4 KiB · d46acf9 Raw
52 lines · c
1// SPDX-License-Identifier: GPL-2.02#include <linux/mm.h>3#include <linux/page-isolation.h>4 5unsigned int _debug_guardpage_minorder;6 7bool _debug_pagealloc_enabled_early __read_mostly8			= IS_ENABLED(CONFIG_DEBUG_PAGEALLOC_ENABLE_DEFAULT);9EXPORT_SYMBOL(_debug_pagealloc_enabled_early);10DEFINE_STATIC_KEY_FALSE(_debug_pagealloc_enabled);11EXPORT_SYMBOL(_debug_pagealloc_enabled);12 13DEFINE_STATIC_KEY_FALSE(_debug_guardpage_enabled);14 15static int __init early_debug_pagealloc(char *buf)16{17	return kstrtobool(buf, &_debug_pagealloc_enabled_early);18}19early_param("debug_pagealloc", early_debug_pagealloc);20 21static int __init debug_guardpage_minorder_setup(char *buf)22{23	unsigned long res;24 25	if (kstrtoul(buf, 10, &res) < 0 ||  res > MAX_PAGE_ORDER / 2) {26		pr_err("Bad debug_guardpage_minorder value\n");27		return 0;28	}29	_debug_guardpage_minorder = res;30	pr_info("Setting debug_guardpage_minorder to %lu\n", res);31	return 0;32}33early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);34 35bool __set_page_guard(struct zone *zone, struct page *page, unsigned int order)36{37	if (order >= debug_guardpage_minorder())38		return false;39 40	__SetPageGuard(page);41	INIT_LIST_HEAD(&page->buddy_list);42	set_page_private(page, order);43 44	return true;45}46 47void __clear_page_guard(struct zone *zone, struct page *page, unsigned int order)48{49	__ClearPageGuard(page);50	set_page_private(page, 0);51}52