Fork me on GitHub

root/mm/swapper.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. kswapd

   1 /*
   2  * fiwix/mm/swapper.c
   3  *
   4  * Copyright 2018-2022, Jordi Sanfeliu. All rights reserved.
   5  * Distributed under the terms of the Fiwix License.
   6  */
   7 
   8 #include <fiwix/asm.h>
   9 #include <fiwix/kernel.h>
  10 #include <fiwix/limits.h>
  11 #include <fiwix/process.h>
  12 #include <fiwix/sleep.h>
  13 #include <fiwix/sched.h>
  14 #include <fiwix/tty.h>
  15 #include <fiwix/memdev.h>
  16 #include <fiwix/serial.h>
  17 #include <fiwix/lp.h>
  18 #include <fiwix/ramdisk.h>
  19 #include <fiwix/floppy.h>
  20 #include <fiwix/ide.h>
  21 #include <fiwix/buffer.h>
  22 #include <fiwix/mm.h>
  23 #include <fiwix/fs.h>
  24 #include <fiwix/locks.h>
  25 #include <fiwix/filesystems.h>
  26 #include <fiwix/stdio.h>
  27 #include <fiwix/ipc.h>
  28 
  29 /* kswapd continues the kernel initialization */
  30 int kswapd(void)
  31 {
  32         STI();
  33 
  34         /* char devices */
  35         memdev_init();
  36         serial_init();
  37         lp_init();
  38 
  39         /* block devices */
  40         ramdisk_init();
  41         floppy_init();
  42         ide_init();
  43 
  44         /* data structures */
  45         sleep_init();
  46         buffer_init();
  47         sched_init();
  48         mount_init();
  49         inode_init();
  50         fd_init();
  51         flock_init();
  52 
  53 #ifdef CONFIG_SYSVIPC
  54         ipc_init();
  55 #endif /* CONFIG_SYSVIPC */
  56         mem_stats();
  57         fs_init();
  58         mount_root();
  59         init_init();
  60 
  61         for(;;) {
  62                 sleep(&kswapd, PROC_UNINTERRUPTIBLE);
  63                 if((kstat.pages_reclaimed = reclaim_buffers())) {
  64                         continue;
  65                 }
  66                 printk("WARNING: %s(): out of memory and swapping is not implemented yet, sorry.\n", __FUNCTION__);
  67                 wakeup(&get_free_page);
  68         }
  69 }

/* [previous][next][first][last][top][bottom][index][help] */