From nobody Sun Jun 16 17:13:18 2024 X-Original-To: dev-commits-src-main@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 4W2KNK0RzHz5P8Rl; Sun, 16 Jun 2024 17:13:21 +0000 (UTC) (envelope-from unkadoug@gmail.com) Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "WR4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4W2KNJ5ZBqz4bCk; Sun, 16 Jun 2024 17:13:20 +0000 (UTC) (envelope-from unkadoug@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: by mail-oi1-x22c.google.com with SMTP id 5614622812f47-3c9c36db8eeso2079909b6e.0; Sun, 16 Jun 2024 10:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718557999; x=1719162799; darn=freebsd.org; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=MtjM9GSl4/eJw41CI/xjSisQ4Z8l5MncP90gE4DhqxA=; b=dvbsjY3XxiIUMFL9h0KetrhcQg0hJLt/kWhZ3NoZKU5UCdEJipUZT6CIxHcnBPX9V4 +WNQ5/zXZ2JM+oF8HI7f1VRZt9oyE5v/AayPvPDZXp2vtRDTUJu7BMTsfeLANK0dwPB4 IyKfSrONAoQ+QMo3PukIbggG6HLvuiKO9cCTyYLCUTc0j0YbtWcXzrVeKdOeagQgSUDW OzxZDRZYqrNtiugvkXP9FoZY8kHqbiBpn79lGGvvkiFPw1YMcO7woQLt5iE0T2ftmqUz EM0adcVHMhpQzW8dGScoeDURhaeIS9NrCfp2hT0mnAXGH7xtQQU01rougG4gfiN/oz4Y nJwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718557999; x=1719162799; h=content-transfer-encoding:in-reply-to:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=MtjM9GSl4/eJw41CI/xjSisQ4Z8l5MncP90gE4DhqxA=; b=MAGG8CvW0E0nnRTxAu7jC24VLTJyC9n7X4Z5qc7kHQ3uWfRpZTKA+LquInl1pBkago NkLrYXmG19/nLMOAU3HgqZSUkk6ETc3Hy6pIB6UoN39I94y/M5WeUak0aELAHcwoTYEm k2GY58LH/CH63qOQzwShV6X7XbfYQ+HhIRiL8N0Vyu61WuBgAGldwCE+zOlz0g5LcMDf YRAQUGnYvujPA7ujUnL7hP1hkmNoaEP6BTtz19PDpeLMpAAkUsltudP65DSuGY6i3Eh4 bIoWy8BYVsV0pz+Vbr9iCehfdsYKzlTqFK0Ss1b1Wa4Tr7cdehCnIBoyCMex676ZDzjy sl4g== X-Forwarded-Encrypted: i=1; AJvYcCXWR8uaGlG3m/wpEzD9gzXgPxE0z3q/nFYzIoQIgIEs+z1Sm3QfSWSYP47OPEbH+rzzwHRkbJ+moeKS4x3A/3sqsND7bBv6oKyGEswsyz1GAULaWkd6dODkKQJAzFuLc7wwHsAm7V1MyWRYC+qIph6EcQ== X-Gm-Message-State: AOJu0Yxd9btPmPixIcN4nl8O23fJDgpOqqVbPsnPSkU28ZYQIOUPa9J9 MsC1wlVgRbpEB/3dBPaJVS+/EKz1dhPwSV6mMlhjhN0feYIzey/9JplxDi7e X-Google-Smtp-Source: AGHT+IHBQoVjnW2dtRIOf+XciHLgJ+EtolhlN88GvUG3o5+6juUDPAv17O2eoBxeIoLu4nLQEdBl3A== X-Received: by 2002:a05:6808:148e:b0:3d2:3811:bc78 with SMTP id 5614622812f47-3d24e8f8a44mr8970329b6e.28.1718557999442; Sun, 16 Jun 2024 10:13:19 -0700 (PDT) Received: from [108.254.203.202] (108-254-203-202.lightspeed.hstntx.sbcglobal.net. [108.254.203.202]) by smtp.gmail.com with ESMTPSA id 5614622812f47-3d2475e49absm1249751b6e.12.2024.06.16.10.13.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 16 Jun 2024 10:13:18 -0700 (PDT) From: Doug Moore X-Google-Original-From: Doug Moore Message-ID: <0fbfd389-21e8-d1df-b640-46c283124888@freebsd.org> Date: Sun, 16 Jun 2024 12:13:18 -0500 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: git: dd0e5c02ab13 - main - swap_pager: small improvement to find_least Content-Language: en-US To: Peter Holm Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org References: <202406111638.45BGcnhX099470@gitrepo.freebsd.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US] X-Rspamd-Queue-Id: 4W2KNJ5ZBqz4bCk Thank you, Peter.  That was a stupid mistake and I have now undone it. On 6/16/24 07:13, Peter Holm wrote: > On Tue, Jun 11, 2024 at 04:38:49PM +0000, Doug Moore wrote: >> The branch main has been updated by dougm: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=dd0e5c02ab13b9eb240d42a71a8f41a8b036bd33 >> >> commit dd0e5c02ab13b9eb240d42a71a8f41a8b036bd33 >> Author: Doug Moore >> AuthorDate: 2024-06-11 16:36:23 +0000 >> Commit: Doug Moore >> CommitDate: 2024-06-11 16:36:23 +0000 >> >> swap_pager: small improvement to find_least >> >> Drop an unneeded test, a branch and a needless computation to save a >> few instructions. >> >> Reviewed by: kib >> Differential Revision: https://reviews.freebsd.org/D45558 >> --- >> sys/vm/swap_pager.c | 19 +++++++------------ >> 1 file changed, 7 insertions(+), 12 deletions(-) >> >> diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c >> index a07a38481490..15f227457bba 100644 >> --- a/sys/vm/swap_pager.c > Doug, > > Here's an easy way to reproduce the issue: > > 12:43 ~ $ sort /dev/zero & > [1] 3650 > 12:43 ~ $ sort /dev/zero & > [2] 3651 > 12:43 ~ $ sort /dev/zero & > [3] 3652 > 12:43 ~ $ panic: Negative index: -16 > cpuid = 8 > time = 1718534645 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe010855fa50 > vpanic() at vpanic+0x13f/frame 0xfffffe010855fb80 > panic() at panic+0x43/frame 0xfffffe010855fbe0 > swap_pager_find_least() at swap_pager_find_least+0x105/frame 0xfffffe010855fc20 > vm_object_collapse() at vm_object_collapse+0x68b/frame 0xfffffe010855fca0 > vmspace_fork() at vmspace_fork+0xb68/frame 0xfffffe010855fd30 > fork1() at fork1+0x4f8/frame 0xfffffe010855fda0 > sys_fork() at sys_fork+0x54/frame 0xfffffe010855fe00 > amd64_syscall() at amd64_syscall+0x158/frame 0xfffffe010855ff30 > fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe010855ff30 > --- syscall (2, FreeBSD ELF64, fork), rip = 0xaba1c31565a, rsp = 0xaba1b0cecb8, rbp = 0xaba1b0cf220 --- > KDB: enter: panic > [ thread pid 3653 tid 100349 ] > Stopped at $0,0x104d5c2(%rip) > db> x/s version > version: FreeBSD 15.0-CURRENT #2 main-n270778-d26c565597b8-dirty: Sun Jun 16 12:32:39 CEST 2024\012 pho@mercat1.netperf.freebsd.org:/usr/src/sys/amd64/compile/PHO\012 > db> > > --- a/sys/vm/swap_pager.c > +++ b/sys/vm/swap_pager.c > @@ -2303,6 +2303,7 @@ swap_pager_find_least(vm_object_t object, vm_pindex_t pindex) > if (sb == NULL) > return (object->size); > for (i = pindex - sb->p; i < SWAP_META_PAGES; i++) { > + KASSERT((i >= 0), ("Negative index: %d", i)); > if (sb->d[i] != SWAPBLK_NONE) > return (sb->p + i); > } > > - Peter