From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Releasing the thread global_lock from the module API Date: Sun, 3 Mar 2024 17:42:30 +0200 Message-ID: References: <86cysdrja3.fsf@gnu.org> <86a5nhrdv0.fsf@gnu.org> <868r31rbxn.fsf@gnu.org> <865xy5r8e3.fsf@gnu.org> <864jdpr5zy.fsf@gnu.org> <8634t9qgl2.fsf@gnu.org> <87plwck2q5.fsf@catern.com> <868r30pnxv.fsf@gnu.org> <87le70jrwr.fsf@catern.com> <864jdnq1vx.fsf@gnu.org> <87cysbjvw7.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31243"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: sbaugh@catern.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Mar 03 16:43:28 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rgnzr-0007tL-OZ for ged-emacs-devel@m.gmane-mx.org; Sun, 03 Mar 2024 16:43:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rgnzA-0007CH-Uv; Sun, 03 Mar 2024 10:42:45 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgnz9-0007C1-EP for emacs-devel@gnu.org; Sun, 03 Mar 2024 10:42:43 -0500 Original-Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rgnz4-0000AR-1S for emacs-devel@gnu.org; Sun, 03 Mar 2024 10:42:43 -0500 Original-Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 1B1AD32001AB; Sun, 3 Mar 2024 10:42:34 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 03 Mar 2024 10:42:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1709480553; x=1709566953; bh=kbiDvkNYeIaPKFm8jk/9714vkZ5EeqO/uIV9zM8XR8M=; b= lHsLZdVBh+Bi9iI66tmjfKak82tkdinbBY/OyikyH+ERVU+BxZcYJj7pXI0SitAS 9jUpjcY15j45yVnWvhCm8I7jzWw9jmq13BncEHP6bwC8bbqfafX495Aj8nRzzH2y IvQ6gVXfEORni5cocwp6DZXbd770KzL2DqjdJEny4/nW9DriHNbkdhkDsJVVgE4Q VbbUZDEx4cktsryLNlE/y4iKUk0uLF+/4SsHEZOS5MqVbtHU/BkD+5fL3lIzfTVr K036NzJo1+CXDwHG3ZIVWg8kBGNB4Sq2GQrXkar5JHL5H1NF43WIPAdPWs2hmEP1 GohBW4wSxyRsGLAERKzqzQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1709480553; x= 1709566953; bh=kbiDvkNYeIaPKFm8jk/9714vkZ5EeqO/uIV9zM8XR8M=; b=B fo2Dflch1z2JbfXzmCXlMWB3Aep4XYTclRQe5rBp4LzPUeOekJEAVjTITmFGpsQR vQWzepaxHMaOvac7gn2yNsAVY329XMa3Ia+6an9l73EiMmvhD7u+npbtmJTpuf8W 6tPmc9Hr3UUtjsrChsMPWGL9AKRZ0xOSe1gQojSlWCmN2S9s3P6VyarVg9bdQI0Q NTjjhe+eXs4dHRpJ6aU6mzUnp6TKUUcBHYJl5Fi/EZTBLveIhoYAugo4HfRaQ+Je aeJzWAQyGT++Xbc/E80cXZh+GxkXBt4hb/UPF/591jFoAwj0NLLLtCJlfZ4N4JpL rG6QnwYK0JYcEtRIv3akw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrheehgdejlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesthejre dttddvjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhht ohhvrdguvghvqeenucggtffrrghtthgvrhhnpedthfeuvddtveelgeeuleevvdejveehff evveehvdeuffdtfefhvdeugefgtefgtdenucevlhhushhtvghrufhiiigvpedtnecurfgr rhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 3 Mar 2024 10:42:32 -0500 (EST) Content-Language: en-US In-Reply-To: <87cysbjvw7.fsf@catern.com> Received-SPF: pass client-ip=64.147.123.24; envelope-from=dmitry@gutov.dev; helo=wout1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:316758 Archived-At: On 03/03/2024 15:19, sbaugh@catern.com wrote: >>> How about this: >>> >>> native_output = env->call_without_lock(some_native_function, native_input); >>> >>> call_without_lock would be a function which releases the global lock, >>> calls a specified function, then acquires the global lock again. >> Sorry, I don't agree to adding such interfaces to Emacs. And if you >> are still not convinced, let's agree to disagree. > That is understandable, but I think you are not yet appreciating that > this can be a very useful way to introduce parallelism with high > performance. And that env->call_without_lock is no less safe than the > method you suggested using. > > Is there anything that would convince you of such things? Perhaps some data from benchmarking real-life code? For example, you could take the route proposed by Eli, implement your intended workload, make some measurements, and then try to calculate whether the native thread creation overhead makes a noticeable difference.