From nobody Tue Dec 19 15:34:01 2023 X-Original-To: dev-commits-src-all@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 4Svghp1ktcz54Qp5; Tue, 19 Dec 2023 15:34:02 +0000 (UTC) (envelope-from git@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 4Svghp0msQz3DSZ; Tue, 19 Dec 2023 15:34:02 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703000042; 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; bh=33F0YSTGQoPBRQl47mIc2Hll9IfKZ56Jj8uG3gqsfSo=; b=JXpPlWyEvELUFkPHkSX4hIWlAoeXy3BStOzybsRuEW4hG9zJvg9Upb5KDv+9M+75QTJIrC SmP1hKTma+uhJIch+relFSdBPnqDS/ifVqKbNuyGu7z38KRrfcHi/2Savmm9Qdw4PD0Uzy XbXvCHs+ff3WmZbkqC12zThLV3Q6C4fYnzzUU38pMBCsoNuScy/ieFUpDxlxDxtwsSSDl1 Tg2UtxKTHgiBVLmzv+6c5pEjNbMbC5sxTCC1XLWYlWQUe24E2tl+3vLIQDwhHYpVS8K/ci Gv9aBGfUWS4WO2yFwtm+Px9ONu2kC7H40sBSoSmhCEtFRITCN+zFSbgPhk51qw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1703000042; a=rsa-sha256; cv=none; b=JLeN+DQY/lDXk7O5JTUV7GQLWMrGP1PC6+9I5nPVbH+/LF1WUeAS4KzkMVl8YacVvVJDg1 nz7VmU4a1Hl2TGaf5HGfBt+OI0JQQz3JEiLxlB6HOHHNulyjeb9EG6Guv4WaQMhfF29NsO A1I9el+XFStJasn/2gvzC8gQYQeK9r5spn5tEEMICVTh7Ksd0pNy26wT4R9JhSkChwuHo+ oyCXBQOtGX3pzhOXC+D5xjIgma0/HkQO8mE+AvTh9aVtXV0f570zyjxfXAzHZ8TzmMpt3T H3EZ8KAOzbYleMI+giW6pRCXyN6q2dEimCtMlLGgSIo6dPo1xjld6EQiar0xiw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1703000042; 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; bh=33F0YSTGQoPBRQl47mIc2Hll9IfKZ56Jj8uG3gqsfSo=; b=djav8pjQKN6H6aKnFcdFj93L/KWdeq0wk/9PTmp+Pc9hMK08EwTAn4yrAFwUbn3+GHvQMH 52G7rMsFJsycPQGztsR9mGU7N/HJYoNW6oZX6ZIzG8AJjKcQtGsIGIGuZhE3wsqytVRJVn s/V7wYmX+n7SXVPz63va+MWYeTJ4SIavPFDgejw+WC9WSoPJ757wslsa0H3ulFJAhtsSPa QHJ4opJUeVIUaVVDFNwLRJTv+YsrS6jjOMlgbP0aTTmOzb4EIxAZvbJEBUdI6weADdSt2L MZ3eWsrLXyk+i/K9gcuPADmfa4lj3j79Vr0P371YZUVB4AZWStqpOZrytsa/eQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 4Svghn70ncz19Bk; Tue, 19 Dec 2023 15:34:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3BJFY1N7030845; Tue, 19 Dec 2023 15:34:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3BJFY1cp030842; Tue, 19 Dec 2023 15:34:01 GMT (envelope-from git) Date: Tue, 19 Dec 2023 15:34:01 GMT Message-Id: <202312191534.3BJFY1cp030842@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mike Karels Subject: git: ed19c0989fe7 - main - tmpfs: enforce size limit on writes when file system size is default List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: karels X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ed19c0989fe77ec3c9d7bdb752bab6bbef4c0be6 Auto-Submitted: auto-generated The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=ed19c0989fe77ec3c9d7bdb752bab6bbef4c0be6 commit ed19c0989fe77ec3c9d7bdb752bab6bbef4c0be6 Author: Mike Karels AuthorDate: 2023-12-19 15:32:58 +0000 Commit: Mike Karels CommitDate: 2023-12-19 15:32:58 +0000 tmpfs: enforce size limit on writes when file system size is default tmpfs enforced the file system size limit on writes for file systems with a specified size, but not when the size was the default. Add enforcement when the size is default: do not allocate additional pages if the available memory + swap falls to the reserve level. Note, enforcement is also done when attempting to create a file, both with and without an explicit file system size. PR: 275436 MFC after: 1 month Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D43010 --- sys/fs/tmpfs/tmpfs_subr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index 2fe7f7e3ca58..e255c6488613 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -290,6 +290,8 @@ tmpfs_can_alloc_page(vm_object_t obj, vm_pindex_t pindex) if (tm == NULL || vm_pager_has_page(obj, pindex, NULL, NULL) || tm->tm_pages_max == 0) return (true); + if (tm->tm_pages_max == ULONG_MAX) + return (tmpfs_mem_avail() >= 1); return (tm->tm_pages_max > atomic_load_long(&tm->tm_pages_used)); }