[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: swapon command error



I can't contribute to solving the problem you state, but it is not clear
that it is the real problem at all.

You do not describe the system on which you want to add a swap file or
the problem that is meant to solve, but the list addressed,
debian-laptop, suggests it might be a laptop. If that is true, and if
the root problem is poor performance or insufficient main memory for the
workload, adding swap is unlikely to solve it.

At best, adding swap allows the system scheduler to substitute paging to
storage that is hundreds to tens of thousands of times slower than main
memory when there is not enough RAM available. That is reasonable in
server environments in which there are dozens to hundreds of active jobs
in memory and many of them may be waiting at any given time for slow
operations like network or storage I/O.

On a laptop being used interactively, it often is not reasonable to have
swap at all or, at most, more than a small amount to handle occasional,
but rare, instances of full memory to avoid a system crash. Significant
swap activity, whether to a device or an even slower file, is very
unlikely to improve performance.

The best way to improve performance issues caused by insufficient memory
is to add memory. Running fewer jobs or opening fewer browser tabs may
improve performance, but adding swap to an actively swapping system and
keeping the workload the same (or increasing it) is quite unlikely to
improve performance, and might make it worse.

Regards,
Tom Dial


On 9/9/21 08:16, lin dimitri wrote:
> Hi,
> 
> I am trying to increase my swap memory, below is the commands I used:-
> $ sudo swapon --show
> $ sudo swapoff -a
> $ sudo fallocate -l 4G /swapfile
> $ sudo chmod 600 /swapfile
> $ sudo mkswap /swapfile
> $ sudo swapon /swapfile
> swapon failed: Function not implemented
> 
> i got above error.
> 
> I have CONFIG_SWAP=y in /proc/config.gz.
> 
> i don't know how this can be solved
> 
> plz help.
> 
> 
> Regards,
> 
> lin
> 


Reply to: