I run a memory-hungry process (mkcromfs) which consumes more memory than I have physical memory on my latop, so it is paging and swappin and thrashing all the time and loadavg is about 2 (compcache is already in use with usual swap partition as well), but slowly moving forward (Although I afraid it will finally try to allocate >2GB and crash draining 2 days of thrashing).

When I want to use the laptop for something else, I stop the process, start X server, firefox and other programs. The problem is that when I start Firefox the loadavg jumps to 10 and the system becomes almost unresponsive at all (long time to turn on/off caps lock, slow mouse cursor position updates, slow switching from X server to Linux console, slow login).

The stopped mkcromfs still holds a lot of memory (464.8 MiB and slowly falling) and moves it to swap only when more memory is needed for some other program, which results in a great slowdown.

How to tell the Linux to swap out this process entirely (e.g. I'm not intending to resume it in short term), possibly waking from swap other data? Also it will be useful to be able to specify the exact swap device to swap the given process out (for example, mkcromfs's memory is useless in ramzswap).

Update: Now I just write a 400-600M of data from /dev/erandom to tmpfs and it makes mkcromfs to shrink. Is there more proper way?

1 Answer 1


You can try playing with sysctl "swappiness" parameter... IIRC the higher the value, the more "likely to swap" is. Take a look here

  • 1
    Yes, I turn swappiness to 100 when I stop mkcromfs and to 0 when I start it again. Not understand how ulimit could help.
    – Vi.
    Apr 7, 2010 at 15:01
  • well, with ulimit you can also set a maximum memory used, either real and/or virtual, maximum cpu time and the like... it could help freeing up some resources... Apr 8, 2010 at 7:56
  • 1. RLIMIT_AS - not this one, RLIMIT_DATA - not this one, RLIMIT_MEMLOCK - not this one. Which? 2. Is there normal (without injcode) way to change limits of other process? 3. Looks like rlimits cause processes to return errors. Think I want should be transparent to the process.
    – Vi.
    Apr 8, 2010 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .