From nobody Tue May 09 15:30:14 2023 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 4QG2Cp4gmyz4BKBk; Tue, 9 May 2023 15:30:14 +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 4QG2Cp43y2z3r7T; Tue, 9 May 2023 15:30:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683646214; 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=Hr+JxeoyJyW5P1E35NKrsX/eJZuCLqhFdcpnUBZpD+0=; b=NmCheqN/VHeoh+zxwJE5jBEpRng287zyklpRYWcJmCGNxdDDxynJ9aZE1Z4Tth/JKEP0mr afizymAQ+4sjHPDlMbbDcMsSpGibQyjC8yC1BlXbK19iZawet9pk/J9hS9ja+yo75QvIPZ RitroL0y9oPoi+c1Id3/PxjWnt54s7GRcCQHLPUNqcQ2oaywKx9iO3FrO8Glip55llYS0r ++Rtd+Fs0UL1g40emdItpJuOOaDyHqAeVX9fleevFIQUzkB8za+Eh5Vy5IJqStxHuuC3Uh YAKi58vLF9hCKAqX5hO5uWQkk/YxOA+o09sDoK7hvAf3mtJ8mO4E83KKPlkYvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1683646214; 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=Hr+JxeoyJyW5P1E35NKrsX/eJZuCLqhFdcpnUBZpD+0=; b=QNy/uPRAuppn64PowC5ZUaeWOBcVnBjeyEyoQkTwhBG9l/0O9aRcDLANPApgzNQQNFJRYu bDobXC+OVoDm+1QMnUI34OufrUnb6iAV7Ub3fZLw5ZsdN46WEwVsRBeY3VMiotiPnKZJYX 1ZGh4AaLBnxuIsUks7iK8yil8Jk8PW9ld/q7PHsYL3eeCwZKh+tDtegXsyg1tISuwH2xcX z75nWgOS9Wft8g6nqfe3YToSPGrguKNJtL0ycCBxXRzvety1hLEAGwURastnxqy4ixkUtT ZyQfidd2EyEhn3ai9CE+is1zilfce/WkPoaekm2ujTCtJnB3ul/bu6JydsaUpA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1683646214; a=rsa-sha256; cv=none; b=jTGVC2Ux5Q1ZASv8KgbpdGsLZkUDYOZtyKONrqmHJMf9RBCB4lPkODBXTcvpub1udd7Wfk 0pI0zg4g3E1KX24wnsBTQCpBm0WKKmchEcUot9yWU5G8RSF1h3D7F10hRjkpRGDFJS1I23 SF8wWHmF34kMtCysdy43G3GMzKsNcCojGh7FAlH6mO8hIFjvC60v5M2bfXcH/bj/0SCUBP SyBhDDzpsBzxGesR+54J203bDsD1nWCoxMjc/e6mUDnkVvYdJhgrvpSRSLOpSR3EJIKwdK JBDpkPY5WK89aIyJ4+LI+RIxqKuwA5U/ifych5E/78139l9g98UEdTS1nniHBA== 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 4QG2Cp38pnzXwg; Tue, 9 May 2023 15:30:14 +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 349FUExx021857; Tue, 9 May 2023 15:30:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 349FUEWo021847; Tue, 9 May 2023 15:30:14 GMT (envelope-from git) Date: Tue, 9 May 2023 15:30:14 GMT Message-Id: <202305091530.349FUEWo021847@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: ccc6b87b3825 - main - quiesce_cpus(): do not overallocate generation array 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: ccc6b87b3825a235991d978e43d29431e012461f Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ccc6b87b3825a235991d978e43d29431e012461f commit ccc6b87b3825a235991d978e43d29431e012461f Author: Konstantin Belousov AuthorDate: 2023-05-05 20:21:38 +0000 Commit: Konstantin Belousov CommitDate: 2023-05-09 15:30:07 +0000 quiesce_cpus(): do not overallocate generation array Also switch to mallocarray(). Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39981 --- sys/kern/subr_smp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_smp.c b/sys/kern/subr_smp.c index 656c945fe8c2..745b1554371e 100644 --- a/sys/kern/subr_smp.c +++ b/sys/kern/subr_smp.c @@ -975,7 +975,8 @@ quiesce_cpus(cpuset_t map, const char *wmesg, int prio) error = 0; if ((prio & PDROP) == 0) { - gen = malloc(sizeof(u_int) * MAXCPU, M_TEMP, M_WAITOK); + gen = mallocarray(sizeof(u_int), mp_maxid + 1, M_TEMP, + M_WAITOK); for (cpu = 0; cpu <= mp_maxid; cpu++) { if (!CPU_ISSET(cpu, &map) || CPU_ABSENT(cpu)) continue;