2

My understanding is they cannot be. Even in the case where there is too much memory crunch, kernel and its data structures will have to stay in the memory, no matter what.

But still wanted to confirm.

Piyush Kansal
  • 1,201
  • 4
  • 18
  • 26
  • 2
    I think I found the answer: http://stackoverflow.com/questions/4535379/do-kernel-pages-get-swapped-out – Piyush Kansal Dec 27 '11 at 20:06
  • 1
    i just updated the answer in the link above you provided. So the answer is YES - under SWSUSP scenario. Kernel documentation link provided. – Peter Teoh Jan 24 '17 at 10:59
  • @PeterTeoh: Thanks for the update. Swapping is the only option during suspend/hibernate of a device like a laptop. My question was mostly w.r.t. the live swapping when the system is up and running. – Piyush Kansal Jan 24 '17 at 22:20

2 Answers2

0

No. Not implemented. The kernel can decrease its footprint by pruning caches but cannot swap. On most modern hardware by the time you get so far as swapping kernel would help you're in serious trouble anyway.

Joshua
  • 40,822
  • 8
  • 72
  • 132
-1

I cannot assure this but I think Linux can swap even kernel-pages with some restrictions, for example it cannot swap those pages that contain all the swapping logic or interrupts logic. Again, I cannot assure this.

Ole
  • 19
  • 1
  • I think this can be answered by someone who has actually worked on kernel code. But still, a general consensus should be that it cannot be swapped. – Piyush Kansal Dec 30 '11 at 17:41