From nobody Sat Dec 24 05:42:07 2022 X-Original-To: bugs@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 4NfCc02dvCz1J1mH for ; Sat, 24 Dec 2022 05:42:08 +0000 (UTC) (envelope-from bugzilla-noreply@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 4NfCc00H8Dz4Gm2 for ; Sat, 24 Dec 2022 05:42:08 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1671860528; 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=+TLkRcJvzqaYxMJFwXmrftHv0oQ+IqKDer7JLuH5SQs=; b=JiUOnmJM5uDxsW4HTr7Vskdf8vrqd5+P7Giybj/0b3yv9ROET2UB738z9F7lCYBcHaay/M R8Bk4BBuVkfMssGbkrIomyXL81qRhniubM1a6BlcplefDA8c8httph7rrclAjosIpdzxJj R93Scl7BxnQZ9V4PJGnFksH1pxmuNvQNFtjaIxiSHuKd6BWoEJZ3TX72RAx83pe4NP/WQG MvDkdM/YyfSNCu+HKXY2mjT7C32mbLeTXIuDLB/1CXBk96x0AXkLUfx/2q5xV6no+3ohCy nvGcfvT4Yv5IlNb4yE/yEsy5ezNs7rjYJPhi2qwPPrzcQYDkutD52GzHXXLbgg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1671860528; a=rsa-sha256; cv=none; b=Zkyu95iphARcyozZfJGLqzVRaOrLqrJrPtgYOI64SAH+7uW/TlqbgLUiodK7NnCfmhg8nF pGLOGZiRDp3qnialXkyfqRMI9spaQ48MarQPSuYXvnHzkkJg7BSxl0bTWQts8JSEyDOtQf K9a0TEsjSjsoGjHOxO07TrVV4OINspiZ7/K0eDXB2y3WFJlirH3xVIRTcDkOgBZ0hSLYnT yZhKXPV77SeP6mS3/NYiiYxI69GNTRTUR2ajDmmeP/rtvKRjrHQzPN2Xhdm0kMAieGOcgj GT+GEINXOnl6Y5f7B3lEUdBQ0CUHj7ldKUk5a06J0BZsq3VVmXcX53Sd/+vgGg== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4NfCbz6VSpz12SP for ; Sat, 24 Dec 2022 05:42:07 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 2BO5g77x016946 for ; Sat, 24 Dec 2022 05:42:07 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 2BO5g72O016945 for bugs@FreeBSD.org; Sat, 24 Dec 2022 05:42:07 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 268532] [patch] [libthr] pthread_mutex_destroy/pshared_gc slow when destroying many process shared locks Date: Sat, 24 Dec 2022 05:42:07 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: atle.solbakken@gmail.com X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268532 Bug ID: 268532 Summary: [patch] [libthr] pthread_mutex_destroy/pshared_gc slow when destroying many process shared locks Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: atle.solbakken@gmail.com Created attachment 238992 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D238992&action= =3Dedit Patch The garbage collection function of process shared locks, pshared_gc, is cal= led whenever a process shared lock is destroyed. The GC function has a loop whi= ch checks entries in a hashmap of linked lists, looping through all registered locks. If a process has a lot of process shared locks, like more than a few hundre= d, the GC function causes destruction of these locks to take a long time (exponential). This is noticeable especially if many locks are to be destro= yed at the same time. There are probably multiple solutions for this, like calling the GC function only every X lock destruction, by having a time limit or by calling it upon some other event. The provided patch limits how often the GC function can run to at most ever= y 25 milliseconds per process. If i understand it correctly, the only potential = GC required after lock destruction should be in other processes, which have th= eir own timers. Best regards Atle --=20 You are receiving this mail because: You are the assignee for the bug.=