arch/x86/mm/hugetlbpage.c
Source file repositories/reference/linux-study-clean/arch/x86/mm/hugetlbpage.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/mm/hugetlbpage.c- Extension
.c- Size
- 1119 bytes
- Lines
- 53
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
linux/init.hlinux/fs.hlinux/mm.hlinux/sched/mm.hlinux/hugetlb.hlinux/pagemap.hlinux/err.hlinux/sysctl.hlinux/compat.hasm/mman.hasm/tlb.hasm/tlbflush.hasm/elf.h
Detected Declarations
function Copyrightfunction gigantic_pages_initfunction arch_hugetlb_cma_order
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* IA-32 Huge TLB Page Support for Kernel.
*
* Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
*/
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/sched/mm.h>
#include <linux/hugetlb.h>
#include <linux/pagemap.h>
#include <linux/err.h>
#include <linux/sysctl.h>
#include <linux/compat.h>
#include <asm/mman.h>
#include <asm/tlb.h>
#include <asm/tlbflush.h>
#include <asm/elf.h>
#ifdef CONFIG_X86_64
bool __init arch_hugetlb_valid_size(unsigned long size)
{
if (size == PMD_SIZE)
return true;
else if (size == PUD_SIZE && boot_cpu_has(X86_FEATURE_GBPAGES))
return true;
else
return false;
}
#ifdef CONFIG_CONTIG_ALLOC
static __init int gigantic_pages_init(void)
{
/* With compaction or CMA we can allocate gigantic pages at runtime */
if (boot_cpu_has(X86_FEATURE_GBPAGES))
hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
return 0;
}
arch_initcall(gigantic_pages_init);
#endif
#endif
unsigned int __init arch_hugetlb_cma_order(void)
{
if (boot_cpu_has(X86_FEATURE_GBPAGES))
return PUD_SHIFT - PAGE_SHIFT;
return 0;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/fs.h`, `linux/mm.h`, `linux/sched/mm.h`, `linux/hugetlb.h`, `linux/pagemap.h`, `linux/err.h`, `linux/sysctl.h`.
- Detected declarations: `function Copyright`, `function gigantic_pages_init`, `function arch_hugetlb_cma_order`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.