Alternate method of running swapon?

Jeffrey Walton noloader at gmail.com
Wed Jan 8 15:08:42 EST 2020


On Wed, Jan 8, 2020 at 1:43 PM Valentin Vidić
<vvidic at valentin-vidic.from.hr> wrote:
>
> On Wed, Jan 08, 2020 at 01:33:21PM -0500, Jeffrey Walton wrote:
> > I believe this is the relevant part from the Pastebin:
> >
> > readlink("/swapfile", 0x7ffefb4c0810, 4096) = -1 EINVAL (Invalid argument)
> > stat("/swapfile", {st_mode=S_IFREG|0600, st_size=2147483648, ...}) = 0
> > open("/swapfile", O_RDONLY)             = 3
> > read(3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"...,
> > 65536) = 65536
> > close(3)                                = 0
> > swapon("/swapfile", 0)                  = -1 EPERM (Operation not permitted)
>
> Yes, the swapon call fails with this error. You can check the kernel
> name with uname -a, but it probably runs a custom build and you can't
> reboot with a different one to enable swap functionality.

It looks like this is coming from the OpenVZ folks. They feel a
swapfile would negatively impact performance, so it is disabled.

(I'm not sure how a DoS is considered a good result, given an OOM kill
just about always knocks out MySQL).

Jeff



More information about the Kernelnewbies mailing list