From nobody Fri Jan 28 14:13:36 2022 X-Original-To: dev-commits-src-branches@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 502D11976E28; Fri, 28 Jan 2022 14:13:36 +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 4JlfZS1mq2z3JNy; Fri, 28 Jan 2022 14:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643379216; 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=hTodp82b9MjJTftPwbdSly9KdTvB1H/b1yGk4DMbNPA=; b=O8/2aJgq7M6ggXeUMskUOxdwQHJzLqOerTeXgGv+db/Kpdtzflicl9h51x6HEdn8asLKeI Gl4q9IEFkSL/WwcxqZvudDUp+dBJebv+UzjprAv7mzDmc+rqZeXn7HI4ZwKJdTevLZ1tRy PKsDearlRmdzvwC16jIHbSvQ0a/7JJg5era/Oz3eJAZGQxgl8bPQeTabxI6NVZ4cMZbiVG LUnN/qB0tX6MP4ibhCBBrnlICY1GjVTvNx7OFHsObMyMCwVKLgmrD59bAA6I5fO6cvamAP rJ+bSkkkF/wyBfgEiiuOdAJ44K/bKjnAAwyTdzs8Im9ZayZLmGhm9yC9/+LrrA== 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 1A6E82B564; Fri, 28 Jan 2022 14:13:36 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 20SEDaNR054618; Fri, 28 Jan 2022 14:13:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20SEDaqd054617; Fri, 28 Jan 2022 14:13:36 GMT (envelope-from git) Date: Fri, 28 Jan 2022 14:13:36 GMT Message-Id: <202201281413.20SEDaqd054617@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 0883a572d27e - stable/13 - uma: Avoid polling for an invalid SMR sequence number List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 0883a572d27ed147d9d9b1ce2e601bbdc8177aee Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643379216; 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=hTodp82b9MjJTftPwbdSly9KdTvB1H/b1yGk4DMbNPA=; b=iZCLvSKRHv7W57++yY9F/AVxkG0xyNwW9lvFTft3Ex5pKC37yCNkByoz2+sEjqGILOI4QN T4+aUCNCVSyLMXDlz64CwmvkBJv5u2gP7EmOZgfKvkhu6oQMCrrze/Enq2z8W6w0b/a1BT LEjqeg/MKXZbuElvX2bbvPOlMRIUlMUJJF82NbEClUvlm+JEGqa7j+go9y/06gM0CSPCNA 3dL6XoYTNZI6Jzcw8bl4VmR9+QGxpnE0nw4E1qc2fu+omPfpERWBSU6ZC8HYswcCu+16X5 HbjaDOeZ12J+KzAUHrIR1r41sthPdEB6Qs4XHNwGvxtluI5U167ohPMQ56ZgbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643379216; a=rsa-sha256; cv=none; b=aIesLSiivhOhtULUpNt7Tp8PC6/cnqSleatX9wkOzLq5ApQkx1vlRdMiqfbbM/RfIvwhsE ZpkBuiAImTs2EWx8rmkptZnM9glN/f32m1TX8Yr7z4c1/hHMQhgm3XKWQ1z0IP7Jno7biM dmH8CL6lfVWEGXI+CTS1YKHpM60pOheSFLRtESiKVBKbqzEyhEoITrR8GGmCkvgSUAT+Cp EchVqJHfhTlosB4LEqtRJLwCVMI4bAEMF10A117JBYcBRxDSmW+bDIXAxMNN6wp5H8hWqn AW2ktH4CCUgxKYpY64Sw7QkBzkRvi3FdvvIWHJL7PL4Hg8Kmc6XxlGdtEyIrFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=0883a572d27ed147d9d9b1ce2e601bbdc8177aee commit 0883a572d27ed147d9d9b1ce2e601bbdc8177aee Author: Mark Johnston AuthorDate: 2022-01-14 20:06:48 +0000 Commit: Mark Johnston CommitDate: 2022-01-28 14:13:24 +0000 uma: Avoid polling for an invalid SMR sequence number Buckets in an SMR-enabled zone can legitimately be tagged with SMR_SEQ_INVALID. This effectively means that the zone destructor (if any) was invoked on all items in the bucket, and the contained memory is safe to reuse. If the first bucket in the full bucket list was tagged this way, UMA would unnecessarily poll per-CPU state before attempting to fetch a full bucket from the list. Sponsored by: The FreeBSD Foundation (cherry picked from commit a04ce833f9ba058ec3e04f686bd56fa0691bfcf0) --- sys/vm/uma_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 3888ff26cca8..eb3773904db6 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -996,6 +996,7 @@ cache_fetch_bucket(uma_zone_t zone, uma_cache_t cache, int domain) { uma_zone_domain_t zdom; uma_bucket_t bucket; + smr_seq_t seq; /* * Avoid the lock if possible. @@ -1005,7 +1006,8 @@ cache_fetch_bucket(uma_zone_t zone, uma_cache_t cache, int domain) return (NULL); if ((cache_uz_flags(cache) & UMA_ZONE_SMR) != 0 && - !smr_poll(zone->uz_smr, zdom->uzd_seq, false)) + (seq = atomic_load_32(&zdom->uzd_seq)) != SMR_SEQ_INVALID && + !smr_poll(zone->uz_smr, seq, false)) return (NULL); /*