From nobody Tue Jul 15 15:19:05 2025 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 4bhNBf1cMgz62Vnr; Tue, 15 Jul 2025 15:19:06 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bhNBd6mbxz3VVH; Tue, 15 Jul 2025 15:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752592746; 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=HDHiBHQY4F5zlW/KcqOnu43sml3+xQPTyVPOOFeiCD8=; b=OZIyYEm8lBFCqQwemm/o6+oSTeuGFzRrdUUZWT85dsn/x3NECrqC4p2ky6Upuwd2J60ivt 80wXjouuCdGpHmZO99Xve0k2qvzeYVr5kjuBUtdzGqWZCoqobNjA0q65xSI1fIssymgkxl Dox+YcKM9QbwJqTuWhP3aMxFKd4s9y9xH0qXCxvluOE0Ebt1PDyy5NU9TLJrEV6zM9sjl2 KTyXnCNiVqahPuNyiN62fZUXe9LHyIQOkLbNdgHV+WQkr5UeMV7rqUktxVrTaFKK2hhHRt HIjw6QBCJclUy1+Hnk79e0i8Wa0F4zKr92h1YskRnrdfO0u5WoeaoZtZiwFmFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1752592746; 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=HDHiBHQY4F5zlW/KcqOnu43sml3+xQPTyVPOOFeiCD8=; b=YvtMocJbjHXbah5zCSwZXjIcWfT2mifZkxywYYGaBbfehvGUR9sV39rq6XkNsTmm4bDFJe K9K2G3WEEP0sWdI/NOB6KTC5agq4U0DR1xdCWT5sZ1tCRr0Rihi2savEVhUjkzUI1YEC4S ULWaMw/dhVJgG887i80stvQH+bxgLTnFM8gU/Y+KPfoxDieY+/fj7CRXGcWZ9bNBYcsyBj IgyIX8V1m3kI9tPvqxV7u2PhWcmRhLlI9fDAEj9RuZW6mOTHrJWybAWVNBUj9vJgLTVF+O xD43MT2tbs0xSYdIBmK1vbNKroliZHzGRJ7hINiJNnlRDAdpzzj2+inFztjYDg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1752592746; a=rsa-sha256; cv=none; b=L8HXFcBFej1MpXShTo/0SHUheT4udUsqXaS5yJqf3LsffuSh2LZn5rR65RFFdSkKinaNH4 yuwy0FOk4gHkSUq1lcK3vuckb6kElTcxHhtw8oaCfJpuRZ8nJWEz09StqsqCUXfFZnJb0D apkLELueOq5KP1fQCtEKsmZtJWskttLH6I5eboHGTZ3z9COaC+QTrglz/MZepw6NV1Hnl1 y0d12gutRjN7PyL15+A4gf/AuOjp3MOrRRBgMlgZDKLN28A0l7/P6X1xGrPqB40dGzh133 hpXOgnrntmWGzhL1vgAxsM/VthhKd++O1qOgXpKBNI7NZlvxB0JFLcsAZkPK4Q== 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 4bhNBd6DYJzlWy; Tue, 15 Jul 2025 15:19:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 56FFJ50o013982; Tue, 15 Jul 2025 15:19:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 56FFJ5pN013979; Tue, 15 Jul 2025 15:19:05 GMT (envelope-from git) Date: Tue, 15 Jul 2025 15:19:05 GMT Message-Id: <202507151519.56FFJ5pN013979@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 5c76e9f45796 - main - swap_pager: Convert swap-space-full flags to bools 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5c76e9f4579677482b0f96d4b3581f5e1ea2e072 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=5c76e9f4579677482b0f96d4b3581f5e1ea2e072 commit 5c76e9f4579677482b0f96d4b3581f5e1ea2e072 Author: Mark Johnston AuthorDate: 2025-07-15 15:16:57 +0000 Commit: Mark Johnston CommitDate: 2025-07-15 15:16:57 +0000 swap_pager: Convert swap-space-full flags to bools No functional change intended. Reviewed by: alc, kib MFC after: 2 weeks Sponsored by: Modirum MDPay Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51321 --- sys/vm/swap_pager.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 86b75a2d7989..d6bd06226d04 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -384,8 +384,8 @@ swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred) #endif } -static int swap_pager_full = 2; /* swap space exhaustion (task killing) */ -static int swap_pager_almost_full = 1; /* swap space exhaustion (w/hysteresis)*/ +static bool swap_pager_full = true; /* swap space exhaustion (task killing) */ +static bool swap_pager_almost_full = true; /* swap space exhaustion (w/hysteresis) */ static struct mtx swbuf_mtx; /* to sync nsw_wcount_async */ static int nsw_wcount_async; /* limit async write buffers */ static int nsw_wcount_async_max;/* assigned maximum */ @@ -642,14 +642,14 @@ swp_sizecheck(void) { if (swap_pager_avail < nswap_lowat) { - if (swap_pager_almost_full == 0) { + if (!swap_pager_almost_full) { printf("swap_pager: out of swap space\n"); - swap_pager_almost_full = 1; + swap_pager_almost_full = true; } } else { - swap_pager_full = 0; + swap_pager_full = false; if (swap_pager_avail > nswap_hiwat) - swap_pager_almost_full = 0; + swap_pager_almost_full = false; } } @@ -958,11 +958,10 @@ swp_pager_getswapspace(int *io_npages) swp_sizecheck(); swdevhd = TAILQ_NEXT(sp, sw_list); } else { - if (swap_pager_full != 2) { + if (!swap_pager_full) { printf("swp_pager_getswapspace(%d): failed\n", *io_npages); - swap_pager_full = 2; - swap_pager_almost_full = 1; + swap_pager_full = swap_pager_almost_full = true; } swdevhd = NULL; } @@ -2863,10 +2862,8 @@ swapoff_one(struct swdevt *sp, struct ucred *cred, u_int flags) sp->sw_id = NULL; TAILQ_REMOVE(&swtailq, sp, sw_list); nswapdev--; - if (nswapdev == 0) { - swap_pager_full = 2; - swap_pager_almost_full = 1; - } + if (nswapdev == 0) + swap_pager_full = swap_pager_almost_full = true; if (swdevhd == sp) swdevhd = NULL; mtx_unlock(&sw_dev_mtx);