Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Nov 2023 19:19:02 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 275436] tmpfs does not honor memory limits on writes
Message-ID:  <bug-275436-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275436

            Bug ID: 275436
           Summary: tmpfs does not honor memory limits on writes
           Product: Base System
           Version: 15.0-CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: karels@freebsd.org

Created attachment 246673
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D246673&action=
=3Dedit
sample patch that works around the problem

The tmpfs file system checks for available memory when a file is created, b=
ut
not during writes.  If I create a file, then run the system nearly out of
memory, I can write to that file until processes are killed because the sys=
tem
is out of memory, and in some cases the system is so screwed up that a shut=
down
cannot be run.  A df shows continuously growing usage and size while showin=
g 0
for free space all along; this can go on for gigabytes.  Note, this is usin=
g a
tmpfs file system with the default size.

I'll attach a patch that adds a check in the write path, which helps.  It s=
till
runs the system out of memory and swap, so there are two additional changes=
 in
the patch: one divides swap space by two, and the other asks the VM system =
for
the free memory in excess of the free target, using that in place of simply
free memory.  I am not convinced that any of the changes are correct, but t=
hey
help considerably.  With these changes, a large memory process keeps running
although swap is exhausted when the writes fail.  More details or tests
available on request.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-275436-227>