<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_Virtual_Paging</id>
	<title>Kernel: Virtual Paging - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://tech-pubs.net/wiki/index.php?action=history&amp;feed=atom&amp;title=Kernel%3A_Virtual_Paging"/>
	<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_Virtual_Paging&amp;action=history"/>
	<updated>2026-04-21T21:02:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>http://tech-pubs.net/wiki/index.php?title=Kernel:_Virtual_Paging&amp;diff=471&amp;oldid=prev</id>
		<title>Raion at 23:55, 9 January 2026</title>
		<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_Virtual_Paging&amp;diff=471&amp;oldid=prev"/>
		<updated>2026-01-09T23:55:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 23:55, 9 January 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l107&quot;&gt;Line 107:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 107:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Porting: BSD simpler; lacks IRIX&amp;#039;s sophisticated coloring, NUMA freelists, and coalescing.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Porting: BSD simpler; lacks IRIX&amp;#039;s sophisticated coloring, NUMA freelists, and coalescing.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Overall, IRIX VM is classic SVR4 with heavy MIPS/NUMA/R10000 optimizations. illumos provides nearest modern analog; BSD too simplified for direct mapping. For replication: preserve pfdat flags, phead structure, node freelists, and coalescing logic.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Overall, IRIX VM is classic SVR4 with heavy MIPS/NUMA/R10000 optimizations. illumos provides nearest modern analog; BSD too simplified for direct mapping. For replication: preserve pfdat flags, phead structure, node freelists, and coalescing logic.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category: Kernel Documentation]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
	<entry>
		<id>http://tech-pubs.net/wiki/index.php?title=Kernel:_Virtual_Paging&amp;diff=460&amp;oldid=prev</id>
		<title>Raion: Created page with &quot;== Overview == The IRIX kernel virtual memory subsystem manages physical page allocation, deallocation, and mapping for kernel use. It features a sophisticated free page list organized by cache color buckets with separate queues for clean/stale and associated/unassociated pages, support for large pages (contiguous allocation and coalescing), NUMA-aware node-specific freelists, cache coloring and VCE avoidance, and optimizations for direct-mapped (K0/K1) vs K2 addresses....&quot;</title>
		<link rel="alternate" type="text/html" href="http://tech-pubs.net/wiki/index.php?title=Kernel:_Virtual_Paging&amp;diff=460&amp;oldid=prev"/>
		<updated>2026-01-04T03:42:30Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Overview == The IRIX kernel virtual memory subsystem manages physical page allocation, deallocation, and mapping for kernel use. It features a sophisticated free page list organized by cache color buckets with separate queues for clean/stale and associated/unassociated pages, support for large pages (contiguous allocation and coalescing), NUMA-aware node-specific freelists, cache coloring and VCE avoidance, and optimizations for direct-mapped (K0/K1) vs K2 addresses....&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Overview ==&lt;br /&gt;
The IRIX kernel virtual memory subsystem manages physical page allocation, deallocation, and mapping for kernel use. It features a sophisticated free page list organized by cache color buckets with separate queues for clean/stale and associated/unassociated pages, support for large pages (contiguous allocation and coalescing), NUMA-aware node-specific freelists, cache coloring and VCE avoidance, and optimizations for direct-mapped (K0/K1) vs K2 addresses.&lt;br /&gt;
Key characteristics:&lt;br /&gt;
&lt;br /&gt;
pfdat_t structures track per-page metadata (flags, use count, hash chains, etc.).&lt;br /&gt;
phead_t bucket arrays per node and page size manage free lists.&lt;br /&gt;
Aggressive cache line reuse and coloring to minimize conflicts.&lt;br /&gt;
Reservation system via memory pools to prevent deadlock.&lt;br /&gt;
Special handling for R10000 speculation bug (lowmem separation).&lt;br /&gt;
Poisoned page support for ECC/uncorrectable errors.&lt;br /&gt;
Kernel stack pool for fast allocation.&lt;br /&gt;
&lt;br /&gt;
The implementation prioritizes low-latency kernel allocation with careful TLB and cache management.&lt;br /&gt;
== Key Functions ==&lt;br /&gt;
Core Allocation&lt;br /&gt;
&lt;br /&gt;
kvpalloc / kvpalloc_node: Allocate virtual + physical pages (K2 + physical).&lt;br /&gt;
kvalloc: Allocate only K2 virtual space.&lt;br /&gt;
kpalloc / kpalloc_node: Map physical pages into existing K2 space.&lt;br /&gt;
pagealloc / pagealloc_node / pagealloc_size: Core physical page allocator (single or large pages).&lt;br /&gt;
contig_memalloc / kmem_contig_alloc: Physically contiguous allocation.&lt;br /&gt;
&lt;br /&gt;
Deallocation&lt;br /&gt;
&lt;br /&gt;
kvpfree / kvpffree: Free virtual + physical (handles K0/K1/K2).&lt;br /&gt;
kvfree: Free only K2 virtual space.&lt;br /&gt;
pagefree / pagefree_size: Return physical page to freelist (with coalescing).&lt;br /&gt;
kmem_contig_free: Free contiguous block.&lt;br /&gt;
&lt;br /&gt;
Large Page Support&lt;br /&gt;
&lt;br /&gt;
lpage_alloc_contig_physmem: Allocate large contiguous block.&lt;br /&gt;
lpage_free_contig_physmem: Free large block.&lt;br /&gt;
lpage_coalesce: Background merging of adjacent free base pages.&lt;br /&gt;
lpage_split: Break large page into smaller ones.&lt;br /&gt;
&lt;br /&gt;
Special Cases&lt;br /&gt;
&lt;br /&gt;
page_mapin / page_mapout: Temporary mapping for copy/zero.&lt;br /&gt;
page_copy / page_zero: COW and fault-time zeroing (with BTE on SN0).&lt;br /&gt;
page_discard / page_error_clean: Handle ECC/poisoned pages.&lt;br /&gt;
kstack_alloc / kstack_free: Kernel stack page pool.&lt;br /&gt;
&lt;br /&gt;
== Undocumented or IRIX-Specific Interfaces and Behaviors ==&lt;br /&gt;
Critical Structures (from pfdat.h, page.h, etc.)&lt;br /&gt;
&lt;br /&gt;
pfd_t (page frame data):&lt;br /&gt;
pf_flags: P_QUEUE, P_HASH, P_ANON, P_DONE, P_WAIT, P_DIRTY, P_DUMP, P_BULKDATA, P_ERROR, P_HWBAD, etc.&lt;br /&gt;
pf_use: Reference count.&lt;br /&gt;
pf_next/prev: Free list links.&lt;br /&gt;
pf_hchain: Hash chain.&lt;br /&gt;
pf_tag: Vnode or anon handle.&lt;br /&gt;
pf_pageno: File offset.&lt;br /&gt;
&lt;br /&gt;
phead_t (per-color bucket):&lt;br /&gt;
ph_count: Number of pages.&lt;br /&gt;
ph_list[PH_NLISTS]: CLEAN/STALE, ASSOC/NOASSOC (and POISONOUS on NUMA).&lt;br /&gt;
&lt;br /&gt;
Node-specific:&lt;br /&gt;
pg_free_t per node: freelists, phead arrays, rotors, counters.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Free List Organization&lt;br /&gt;
&lt;br /&gt;
Per-node, per-page-size phead arrays.&lt;br /&gt;
Cache color bucketed (pheadmask).&lt;br /&gt;
Separate lists: CLEAN/STALE × ASSOC/NOASSOC (plus POISONOUS).&lt;br /&gt;
Rotor for round-robin uncached allocation.&lt;br /&gt;
&lt;br /&gt;
NUMA and Migration&lt;br /&gt;
&lt;br /&gt;
Node-local freelists.&lt;br /&gt;
Round-robin or radial search fallback.&lt;br /&gt;
Poisoned page handling (directory clearing, discard queues).&lt;br /&gt;
&lt;br /&gt;
R10000 Speculation Workaround&lt;br /&gt;
&lt;br /&gt;
Low memory (&amp;lt;256MB) separated.&lt;br /&gt;
Special sxbrk variants (low/high memory).&lt;br /&gt;
Kernel reference tracking (krpf) for DMA safety.&lt;br /&gt;
&lt;br /&gt;
Cache and TLB Optimizations&lt;br /&gt;
&lt;br /&gt;
Direct K0/K1 preferred when possible.&lt;br /&gt;
VCE avoidance via color validation.&lt;br /&gt;
Stale → clean promotion with selective cache flush.&lt;br /&gt;
&lt;br /&gt;
== Similarities to illumos and BSD Kernel Implementations ==&lt;br /&gt;
illumos (Solaris-derived)&lt;br /&gt;
Strong similarity:&lt;br /&gt;
&lt;br /&gt;
Page freelist with hash buckets and color awareness.&lt;br /&gt;
kmem allocator for kernel objects (zones similar to IRIX zones).&lt;br /&gt;
Contiguous allocation via vmem.&lt;br /&gt;
Page daemon (vhand equivalent).&lt;br /&gt;
NUMA support evolved differently (resource pools).&lt;br /&gt;
&lt;br /&gt;
Porting: illumos kmem/page subsystem closest; lacks exact phead coloring and large-page coalescing.&lt;br /&gt;
BSD (FreeBSD)&lt;br /&gt;
More divergent:&lt;br /&gt;
&lt;br /&gt;
Simple page queues (free, cache, etc.).&lt;br /&gt;
UMA/kmem for slabs, vm_page for physical.&lt;br /&gt;
Contiguous via contigmalloc.&lt;br /&gt;
No per-color buckets or large-page splitting.&lt;br /&gt;
&lt;br /&gt;
Porting: BSD simpler; lacks IRIX&amp;#039;s sophisticated coloring, NUMA freelists, and coalescing.&lt;br /&gt;
Overall, IRIX VM is classic SVR4 with heavy MIPS/NUMA/R10000 optimizations. illumos provides nearest modern analog; BSD too simplified for direct mapping. For replication: preserve pfdat flags, phead structure, node freelists, and coalescing logic.&lt;/div&gt;</summary>
		<author><name>Raion</name></author>
	</entry>
</feed>