From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: MPS: User GC customizations Date: Thu, 04 Jul 2024 15:12:50 +0000 Message-ID: References: <87v81pbgzi.fsf@localhost> <87y16khvhy.fsf@localhost> <87frspqwhr.fsf@localhost> <87tth5pdqc.fsf@localhost> <87le2h47kj.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34980"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Ihor Radchenko , Eli Zaretskii , emacs-devel@gnu.org, eller.helmut@gmail.com To: =?utf-8?Q?Gerd_M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 04 17:58:51 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 1sPOrD-0008rl-LZ for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jul 2024 17:58:51 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPOoz-0001TO-2u; Thu, 04 Jul 2024 11:56:33 -0400 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 1sPO95-0005dG-RE for emacs-devel@gnu.org; Thu, 04 Jul 2024 11:13:15 -0400 Original-Received: from mail-40134.protonmail.ch ([185.70.40.134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPO8v-0002tR-P7; Thu, 04 Jul 2024 11:13:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1720105974; x=1720365174; bh=ee41AVDK1Q2xzWG4zDitU/hbHxiPmOCYmJcFPv74kTQ=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=g4WyK2hnP5Yi8jjmOcw2Hy5h/1r6AdSda3zDjsSzik43EaAgRdU8ywpCfnMwEHsaZ DlWASDH9facLX8UdlvWwQIbI1Mnn1l/Ino++j3GslC62Qgn9+DtFT+FIQ26eFtfpju bq28BE4quB9ilqHn5UVMMUbNfyzV5/4fANtGIOCRtN0R31GSH0rA/kZKuLdANL0MVv B3bryzWXnMSOKaLQOjYpOJi0L8Zvp3JfWkZKrmIs8ZN2nXZq+JhuzBpWJTLGp6Nkfj Ubgubd06tf/WBTE+IIy9a4RjdJMUbb0vW4hUCCCrdN/0bM4w1CyGmB7kx/N+mGvuYO IFL913qD9CZ2A== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 1ab468c8e2c27bad301949a38f976fd2512cf1da Received-SPF: pass client-ip=185.70.40.134; envelope-from=pipcet@protonmail.com; helo=mail-40134.protonmail.ch X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 04 Jul 2024 11:56:24 -0400 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:321333 Archived-At: On Thursday, July 4th, 2024 at 14:45, Gerd M=C3=B6llmann wrote: > Ihor Radchenko yantar92@posteo.net writes: >=20 > > > Define GC, so to speak, and define what triggering the GC means in a > > > concurrent, incremental GC :-) > >=20 > > AFAIU, the points of interests from real-time performance perspective > > are (1) when MPS has to pause the threads to do its job and how we can > > tweak it; (2) how long does it take to scan the arena to allocate new > > objects (synchronous process) and how this time is influenced by MPS > > settings. >=20 > Right. Alas, we don't have something for that. (And I don't know how to > do it either.) I think we can just set flags for "called MPS" and "in a scan function" and= look at them in the SIGPROF handler to distinguish the four cases?=20 My suspicion is that most problems are going to be due to large objects cre= ating large segments which we have to scan completely, but that's a (micro-= ?) optimization for another day. Would it be okay to keep track of the largest object/pvec of each type in i= gc.el/Figc_info? I've got a patch here which does that, and I think the num= ber is at least as interesting as the average :-) > > > What this variable does is give MPS notice that the client is current= ly > > > idle and it might be a good time to do some work. > >=20 > > Without understanding what effect setting this variable has on the Emac= s > > responsiveness, it does not seem very useful. (Exactly because MPS is > > concurrent) >=20 > That was kind of my point. We can use idle time for using this variable > and see what effect it has, especially in interactive use. Sorry if that > wasn't clear. I'm personally trying 0.1 (100ms) here at the moment. I think it might very well have an effect, but being able to tune the MPS i= s important, too, both for debugging and to improve performance. And the do= cumentation seems to be quite minimal. > > > > For example, my recent measurement of building agendas displayed 30= % of > > > > the time spend in GC. (whatever this means in the context of our ha= ndling > > > > of SIGPRF) > > >=20 > > > Exactly, whqt does it mean? And if we don't know, why is it an exampl= e > > > for anything? > >=20 > > AFAIU, on master, SIGPROF handled while our vanilla GC is running > > will record it. In contrast, on scratch/igc, SIGPROF will put all the > > time when igc_busy_p () is non-nil into "GC". >=20 > Right. And I wonder if that simply is because MPS is doing stuff in its > own thread. That (or another thread calling MPS to make an allocation) would definitely= show up as a false positive. > > And igc_busy_p is not only non-nil when MPS is pausing Emacs to do its > > job, but also during object allocation. So, on master, profiler "GC" > > field records real GC pauses, while on scratch/igc "GC" field is GC > > pauses + new object allocation. >=20 > The docs say >=20 > -- C Function: *note mps_bool_t: 129. mps_arena_busy (mps_arena_t > arena) >=20 > Return true if an *note arena: 16. is part of the way through > execution of an operation, false otherwise. >=20 > =E2=80=98arena=E2=80=99 is the arena. >=20 > Note: This function is intended to assist with debugging fatal > errors in the *note client program: d0. It is not expected to > be needed in normal use. If you find yourself wanting to use > this function other than in the use case described below, > there may be a better way to meet your requirements: please > *note contact us: d8. >=20 > What "partly through an operation" means is anyone's guess at this > point. Someone would have to consult the sources. The docs don't say > what you are suggesting, from my POV. IIRC it just checks whether the arena lock is held, whenever that might be. > > My figure of 30% says that igc_busy_p () is for 30% of CPU time, which > > is a significant number. But it is not very useful unless we get some > > idea about which part of it is memory allocation and which part of it i= s > > MPS pausing all Emacs threads. > >=20 > > Ideally, we should also have some way to get the allocation times on > > master. Then, we can compare them directly. >=20 > Maybe it would be interesting what the meansurements look like on macOS, > where the check for igc_busy are not needed in the SIGPROF handler. How sure are we of that, by the way? My understanding is there are two ways= signals can interfere with one another: SIGSEGV -> SIGPROF -> SIGSEGV (whi= ch wouldn't happen on macOS) and alloc -> SIGPROF -> SIGSEGV, which might. Pip