3

Iso kernel (Linux 5.4.60), Iso hardware, Iso config apart from case A: CONFIG_PAGE_TABLE_ISOLATION=y and, case B: CONFIG_PAGE_TABLE_ISOLATION=n

iomem reports an identical map (apart from Kernel code size being marginally lower in case B)

However, cat /proc/meminfo reports MemTotal case B < MemTotal case A (about 20K)

Of course I understand that it is totally marginal. However, I would like to know how disabling KPTI (Kernel Page Table Isolation) can decrease MemTotal.

(Of course I crosschecked several time.)


EDIT : More detailed info under mainline Linux 5.4.66 (x86_64) :

CASE A (CONFIG_PAGE_TABLE_ISOLATION=y) :

8.166.984 KB memtotal (as reported by /proc/meminfo)

Memory: 8163640K/8387700K available (8194K kernel code, 415K rwdata, 1528K rodata, 776K init, 788K bss, 224060K reserved, 0K cma-reserved) (as reported at bootime)

CASE A' (CONFIG_PAGE_TABLE_ISOLATION=y) but boot nopti :

No change from the above reports ????

CASE B (CONFIG_PAGE_TABLE_ISOLATION=n) :

8.166.964 KB memtotal (as reported by /proc/meminfo) => -20KB / CASE A ???

Memory: 8163640K/8387700K available (8194K kernel code, 407K rwdata, 1528K rodata, 756K init, 816K bss, 224060K reserved, 0K cma-reserved)

In other words :

  • 8K smaller data segment, 20K smaller init for a 8+20 increase of the bss segment.

To add to the initial question which remains (for me the more iportant) :

1/ How comes unsetting CONFIG_PAGE_TABLE_ISOLATION reduces memtotal by 20K ?

2/ Where are the 2MB of RAM consumed as announced in the §15.3 of the documentation ?

3/ How comes booting nopti does not have the same impact on kernel's memory than unsetting CONFIG_PAGE_TABLE_ISOLATION ?

7
  • 2
    That is very weird; I checked, and as far as I can tell, all the object files which change depending on this setting are smaller (sometimes much smaller) when it’s disabled! What does the Memory: line in the boot logs say in both cases on your system? – Stephen Kitt Sep 15 '20 at 15:42
  • Thanks a lot @StephenKitt for not leaving me alone with this one. BTW, according to kernel.org/doc/html/latest/x86/pti.html (§15.3 overhead), I would have expected ~+2M in the kernel bss with kpti=y. This normally decreasing memtotal. Your experiment adds to the weirdness in that accounting for smaller .o which should logically bring a smaller kernel code section when the above document states there should be no change in the kernel image. Your experiment could well explain another curious observation I had made : (cont.) – MC68020 Sep 15 '20 at 19:13
  • (Cont.) Booting "nopti" case A was giving a different memtotal than booting case B. Anyway... no longer under 5.4.60, I'll retry my experiments under 5.4.64 ASAP expecting to provide the information you requested. – MC68020 Sep 15 '20 at 19:13
  • @StephenKitt : I updated the OP with more detailed infos. – MC68020 Sep 22 '20 at 11:01
  • I don't understand: What is Iso? – ctrl-alt-delor Dec 27 '20 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.