From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: User GC customizations Date: Thu, 04 Jul 2024 16:30:06 +0200 Message-ID: References: <87v81pbgzi.fsf@localhost> <86a5j1fhd1.fsf@gnu.org> <87y16khvhy.fsf@localhost> <87frspqwhr.fsf@localhost> <87tth5pdqc.fsf@localhost> <86sewp8djd.fsf@gnu.org> 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="6632"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: yantar92@posteo.net, pipcet@protonmail.com, emacs-devel@gnu.org, eller.helmut@gmail.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Jul 04 16:30:36 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 1sPNTo-0001Zz-Jr for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Jul 2024 16:30:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPNTT-00030c-2Q; Thu, 04 Jul 2024 10:30:15 -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 1sPNTQ-0002yI-T0 for emacs-devel@gnu.org; Thu, 04 Jul 2024 10:30:13 -0400 Original-Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPNTO-0000Zu-Kc; Thu, 04 Jul 2024 10:30:12 -0400 Original-Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-58b447c51bfso943843a12.2; Thu, 04 Jul 2024 07:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720103408; x=1720708208; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U4oKI1KbQaLZtq3ZMYubrftNDcaIPBeGH1KVV+hYZ7A=; b=SKb6H0GVb1ln0Bj1e4jMcP5ZKu+dIm+aD9QtE2KKX/J1FfgiD+lsT0gnO6Kil5ClDA A3d+O0fMfTzjtyxRcBrZEXArIwvpokfWeXHUyv6nTfhb+AH6RcPgVbt2C+ewKvaNnSsK DssZf9is5WXxq/Zcnlf9ylvK1BUMb/MY6OaYtEfjHSwNzcuj/iX2hIcsoWTw87xJJZ0v hmlCpMAAFPGWHZPKKQSI8Ts0A9XsFJY0yC734PMkHmL0G06Cnb9QHwRMganj7Qw5tftU CndMRdaxsmP+LCBz926WkE3V0u12fQfJgA0MdsgWa0iFk3GLN9WmIYYialkJRf/yBqtP lGag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720103408; x=1720708208; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=U4oKI1KbQaLZtq3ZMYubrftNDcaIPBeGH1KVV+hYZ7A=; b=M7fRyL4KPLFdyyt71ORC8bDLUL446lpvbjFYwGpCtuZpHOoQienQpvEjJ4krB3z7lt nqcYvi0Al5jjrv493YBYUqv2GuNlWV+QmB6u9ux7AvwrnUGqaQksbY1ZXOPsJYucANFA KvMdqF4WvOlb5xwtriMSgLSNLj30KIMqWSm645CrFEFilDTDLuTFXskmysvoKBYstgWy y15J0wxNN/eCbmz2DsElrb+b2v22m/a6bRVrCHDfIFWbt3TYHeb+XiQ3HHxN/WVFNUgj QwE1twKQg8Is9hDaMZoMJYwcEhqXnMK9Be0GWP5MkLPL4PV6uAkB3O6bXAIl0TymdgWv 4DTA== X-Forwarded-Encrypted: i=1; AJvYcCV/CtQDu39ToI1dy1KS8dZ2CxYdcQZNHppls1t/9oW+WkQQHHpkCxntqtO39l8j2yeerN54+SkTW8Ky/oFyrJGNt6iX X-Gm-Message-State: AOJu0YyRWmzHv+bY/i+nW8/UfUCbd6pdVz5t0Nk0vYMr0tN40TEjyyuV XqC6/TSEvJqYfEFS1HDpJgJZqwZWbdjZCQRxpZ5QetS3cF/wiRsl X-Google-Smtp-Source: AGHT+IEi1jJsFVpiqRe6tkbNrAapie1Ee2t8Nyrv/G9aVQCVSNxgzwubrux1BZC36j4+o2JPGG27jg== X-Received: by 2002:a05:6402:34cc:b0:57c:9da5:fc09 with SMTP id 4fb4d7f45d1cf-58e59c4345emr1062988a12.23.1720103408165; Thu, 04 Jul 2024 07:30:08 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36fa8.dip0.t-ipconnect.de. [217.227.111.168]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-58d5a53dc23sm1926012a12.54.2024.07.04.07.30.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 07:30:07 -0700 (PDT) In-Reply-To: <86sewp8djd.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 04 Jul 2024 16:58:14 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::52f; envelope-from=gerd.moellmann@gmail.com; helo=mail-ed1-x52f.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:321321 Archived-At: Eli Zaretskii writes: >> From: Gerd M=C3=B6llmann >> Cc: Pip Cet , Eli Zaretskii , >> emacs-devel@gnu.org, eller.helmut@gmail.com >> Date: Thu, 04 Jul 2024 14:51:16 +0200 >>=20 >> >> igc-step-interval is a variable defined in =E2=80=98C source code= =E2=80=99. >> >> >> >> Its value is 0.1 >> >> >> >> How much time is MPS allowed to spend in GC when Emacs is idle. >> >> The value is in seconds, and should be a non-negative number. It c= an >> >> be either an integer or a float. The default value is 0 which mean= s . >> >> don=E2=80=99t do something when idle. Negative values and values t= hat are not numbers >> >> are handled as if they were the default value. >> >> >> >> It's for interactive use. >> > [...] >> What this variable does is give MPS notice that the client is currently >> idle and it might be a good time to do some work. > > Is that really what this variable does? My reading of the > documentation is that it tells MPS how soon to stop GC which it > started when Emacs was idle. IOW, it's not about _triggering_ GC, > it's about _ending_ it. And the reason, AFAIU, is to avoid making > Emacs responses slow because MPS started GC when it detected that > Emacs is idle. I'm taking my view from this;: 2.4.6 Using idle time for collection ------------------------------------ Some types of program have =E2=80=9Cidle time=E2=80=9D in which they are = waiting for an external event such as user input or network activity. The MPS provides a function, *note mps_arena_step(): 19c, for making use of idle time to make memory management progress. ... =20=20 The name interval I've taken from=20 -- C Function: *note mps_bool_t: 129. mps_arena_step (mps_arena_t arena, double interval, double multiplier) =E2=80=98interval=E2=80=99 is the time, in seconds, the MPS is permitt= ed to take. It must not be negative, but may be =E2=80=980.0=E2=80=99. Alas, it doesn't promise to always obey interval: The MPS makes every effort to return from this function within =E2=80=98interval=E2=80=99 seconds, b= ut cannot guarantee to do so, as it may need to call your own scanning code. It uses =E2=80=98multiplier=E2=80=99 to decide whether to commence lon= g-duration operations that consume CPU (such as a full collection): it will only start such an operation if it is expected to be completed within =E2=80=98multiplier * interval=E2=80=99 seconds. (Haven't found out yet to prevent full collections with a message "client predicts plenty of idle time" or some such yet. Please see the comment in igc.c where mps_arena_step is called.)