From nobody Thu Nov 30 22:37:00 2023 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sh9zc34XJz52twn for ; Thu, 30 Nov 2023 22:37:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sh9zc0jnvz3by5 for ; Thu, 30 Nov 2023 22:37:00 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701383820; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=imsTSWpeB7GXEqKAsuyaN9sb4JLcixujSYQLq/mUYOU=; b=NlZMjVApcVriuE/dVYTPF/WSPyoXuXcYa+0Cz2+p7+eM0KGxN4j1sa5Hq8kbifO/enRXEB 8ZLbnAlV6KSm3FGuG73OHotf1rFN+YoGdYoTBhMaCWyYMDN3T41LvkipjUXMS5zaSp62ch bVyizcxWhGmO7qvqiUSYnfncEZQ+KwfqQX29b2UgagdXYm5z0PoTNXgpoTtA4A2ZLgLD4/ DiQH3J34d06u9Hucn2qayk+eTpAYcHtUvxcMOqGSv7FselSzAFOG/N81Da27tOokkRWZWZ e4HOOn3jZcbgON+jwjEEr0rqL4nVeqX0V/37Knar5epo9g8AIHgJCKnngM91FQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701383820; a=rsa-sha256; cv=none; b=WpwIH9n5Rla6iS9gBAZ5qcCSoSB7Y8fDBrB07iHXTo7O2L3cV98RruniteJuog6iWjG5Lc NzbeNWNx5IrQvopvr7BI0vfUPjfyuG+dTbamKUB1x1wVXnzlQLZlprjV0bOgTZc+U7mPmx H8EYeCpBxaO3oMnLHWtZTjeYS5qrmHsYDZXybAn0mHXy7ga09AD+//D59MOlLoDUQzVjve kdbC7YhmmXqjcttZIXGJ8YautX0WRdM+zBXIxqQxdStqeyXAOH7vgZCwvJPNtIpNrXpgMh FpvitDSG3Taro+56uRaYlr7u3Xsxy6HB9HU99qImDMd8PZIpuOZJDkL4Bbz0LQ== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sh9zb6tbPz17Pt for ; Thu, 30 Nov 2023 22:36:59 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 3AUMaxDo049156 for ; Thu, 30 Nov 2023 22:36:59 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 3AUMaxI6049155 for bugs@FreeBSD.org; Thu, 30 Nov 2023 22:36:59 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 275436] tmpfs does not honor memory limits on writes Date: Thu, 30 Nov 2023 22:37:00 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 15.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: karels@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D275436 --- Comment #2 from Mike Karels --- (In reply to Konstantin Belousov from comment #1) First, the primary purpose of this bug is to document that there is a probl= em with writes exceeding the stated limit on the file system size. The fact t= hat I can write multiple gigabytes after df shows remaining space of 0 indicate= s a problem. I had no expectation that this workaround would be a correct fix, or I would have put it into a review. I do think that the memory free target should be taken into account. If tm= pfs attempts to use all of free memory, the VM system is likely to try to raise= the free memory, paging/swapping as needed. btw, my original reason for lookin= g at this is that I misunderstood the meaning in the man page, which says that a size of 0 represents "the available amount of memory (including main memory= and swap space)". I assumed that this included all of main memory, which is clearly excessive, and instead it means the currently-available memory. Bu= t if we actually use all of memory + swap, the system will be killing processes = (in this case, starting with my memory hog but then the shells, nfsd, and more)= .=20 Note that under the circumstances I am testing, tmpfs refuses to create a n= ew file, but will write gigabytes to existing files. This seems to be due to = the lack of any check on free space (whether stored or dynamically-computed) in= the write path, unlike file creation. My goal was to adjust the default limit = so that it was reasonably safe, which I think also needs to be done. I don't think my workaround introduces a problem with holes. The tmpfs_reg_resize routine is used only for writes, so the pages in the calculation will actually be written and recorded in the vm_object. I think that, for file systems with no specific limit, the available memory limit needs to be shared by any tmpfs file systems. They can't each use al= l of memory + swap. Also, it probably doesn't make sense for file systems with a specific limit to attempt writes when there is insufficient memory availabl= e, unless the limit they are given is supposed to be a commitment, allowing ot= her memory users to be killed. (The workaround doesn't distinguish between file systems with/without a specific size, in part because tmpfs_reg_resize does= n't currently refer to the file system itself.) Does tmpfs actually store a current/recent memory limit for file systems th= at don't have a preset size? If it did, maybe higher levels would block write= s. The size limit actually works for file systems with a non-zero size. Howev= er, a size limit would have to be refreshed periodically, or on demand. df will display an available size of 0, but statfs computes that on the fly. --=20 You are receiving this mail because: You are the assignee for the bug.=