Rewrite the lunabuild toolchain with enhanced feature (#60)
[lunaix-os.git] / lunaix-os / kernel / mm / LConfig
1
2 @"Memory Management"
3 @(parent := kernel_feature)
4 def memory_subsystem():
5     """ Config the memory subsystem """
6
7     @"Physical Memory"
8     def physical_mm():
9         """ Physical memory manager  """
10
11         @flag
12         def pmalloc_method_simple() -> bool:
13             when (pmalloc_method is "simple")
14         
15         @flag
16         def pmalloc_method_buddy() -> bool:
17             when (pmalloc_method is "buddy")
18         
19         @flag
20         def pmalloc_method_ncontig() -> bool:
21             when (pmalloc_method is "ncontig")
22
23         @"Allocation policy"
24         def pmalloc_method() -> "simple" | "buddy" | "ncontig":
25             """ Allocation policy for phiscal memory  """
26             
27             return "simple"
28
29         @"PMalloc Thresholds"
30         def pmalloc_simple_po_thresholds():
31
32             require  (pmalloc_method_simple)
33             
34             @"Maximum cached order-0 free pages"
35             def pmalloc_simple_max_po0() -> int:
36                 """ free list capacity for order-0 pages  """
37                 
38                 return 4096
39
40             @"Maximum cached order-1 free pages"
41             def pmalloc_simple_max_po1() -> int:
42                 """ free list capacity for order-1 pages  """
43
44                 return 2048
45             
46             @"Maximum cached order-2 free pages"
47             def pmalloc_simple_max_po2() -> int:
48                 """ free list capacity for order-2 pages  """
49
50                 return 2048
51             
52             @"Maximum cached order-3 free pages"
53             def pmalloc_simple_max_po3() -> int:
54                 """ free list capacity for order-3 pages  """
55                 
56                 return 2048
57             
58             @"Maximum cached order-4 free pages"
59             def pmalloc_simple_max_po4() -> int:
60                 """ free list capacity for order-4 pages  """
61
62                 return 512
63             
64             @"Maximum cached order-5 free pages"
65             def pmalloc_simple_max_po5() -> int:
66                 """ free list capacity for order-5 pages  """
67
68                 return 512
69             
70             @"Maximum cached order-6 free pages"
71             def pmalloc_simple_max_po6() -> int:
72                 """ free list capacity for order-6 pages  """
73
74                 return 128
75             
76             @"Maximum cached order-7 free pages"
77             def pmalloc_simple_max_po7() -> int:
78                 """ free list capacity for order-7 pages  """
79
80                 return 128
81             
82             @"Maximum cached order-8 free pages"
83             def pmalloc_simple_max_po8() -> int:
84                 """ free list capacity for order-8 pages  """
85
86                 return 64
87             
88             @"Maximum cached order-9 free pages"
89             def pmalloc_simple_max_po9() -> int:
90                 """ free list capacity for order-9 pages  """
91
92                 return 32