From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Peter Ludemann Newsgroups: gmane.emacs.bugs Subject: bug#38644: 26.3; emacs uses 100% CPU with auto-revert-mode Date: Sat, 4 Jan 2020 10:50:16 -0800 Message-ID: References: <83fthj3p1b.fsf@gnu.org> <87woauyckt.fsf@gmx.de> <877e2fm9z1.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000df26f3059b54e7f3" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="60946"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 38644@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 04 19:51:14 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1inoW1-000FhZ-Gg for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Jan 2020 19:51:13 +0100 Original-Received: from localhost ([::1]:36056 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inoVz-00042d-T6 for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 Jan 2020 13:51:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40119) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1inoVs-00042J-Px for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2020 13:51:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1inoVq-0003o1-Nt for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2020 13:51:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37400) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1inoVq-0003nN-Hr for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2020 13:51:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1inoVq-0001s6-Gh for bug-gnu-emacs@gnu.org; Sat, 04 Jan 2020 13:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Peter Ludemann Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Jan 2020 18:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38644 X-GNU-PR-Package: emacs Original-Received: via spool by 38644-submit@debbugs.gnu.org id=B38644.15781638617186 (code B ref 38644); Sat, 04 Jan 2020 18:51:02 +0000 Original-Received: (at 38644) by debbugs.gnu.org; 4 Jan 2020 18:51:01 +0000 Original-Received: from localhost ([127.0.0.1]:43373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inoVo-0001ro-NT for submit@debbugs.gnu.org; Sat, 04 Jan 2020 13:51:01 -0500 Original-Received: from mail-lf1-f45.google.com ([209.85.167.45]:34704) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1inoVn-0001rX-Dl for 38644@debbugs.gnu.org; Sat, 04 Jan 2020 13:51:00 -0500 Original-Received: by mail-lf1-f45.google.com with SMTP id l18so25745816lfc.1 for <38644@debbugs.gnu.org>; Sat, 04 Jan 2020 10:50:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=m/vTU+aoxRbnSNH0W8EGcgzRGSQ+qwIBhJxHeE4l88E=; b=adFq7dJUDGEZTHlqevGRTkqua58h1FjSVVVzO+3EkG44kixueRPe7UqzvvUT+EhsfY pDZXtH7lc4gTQn8lrxHcCGWz4RzYfIpg3c0co+/RM+Xlj3LFNOCKStjXVIKKgx4tHkeb 2Pv7iHXhfotseFmuTGsxYFj+MaJlI3uVcqf3egDr/j7KrDKxRkawb4fC8A0bgmb69HZo LP70jNuiSCxXNPmBycai1gDfsCMo0d9EwkZNzw17NowulL+pFs0ittm1KvvGDIyT1kcf 3E4vsJ2BlnYHntF+Igvv7FnqDpxYVY9EbZ8mlPGuKL5JeHmj3ubd0BPuVD9k6s8nssgY BoJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=m/vTU+aoxRbnSNH0W8EGcgzRGSQ+qwIBhJxHeE4l88E=; b=VUV3JR7gdQgmStVzQJVrmO9c9yhSz/SI93tivj0DXlPtO8CuZKHystH7WZVC+0GLTx QDticsJAiyfldeaii56jfT76bkyxtIeABAhPpbJTr5CAbL6K4drPa19Gql25QGk8MaR1 XMG00VnUGaTp5UGy96X09elTGORvRajEwP6DXe/MYoaXME6cQN8IOzLo6+rEH/x8+qs1 Iqb0KVSpUe0l8iJsvEHeaUp1vrVr1i6+oYvrWWzMVKQONaFueTf6ZyjIY3G9ezU+YMtI 129hbuXPMWYZKSx20LuGfwxvzdxLvqd3P3GxxqX6+a1Tia+pfoLWBSmzjdKxztLx5dWQ xNsQ== X-Gm-Message-State: APjAAAWYLAj8+g6WpBUbq+Lwfs/NvFslcwbFpZRzJPl9y7SbkjD416g5 ALRApI24knHG2pPmkL7S9d+tPf5P+zcfQ9/cXf8= X-Google-Smtp-Source: APXvYqzr11832fj/jlfNK34ZvnlpOwzEuvd10T27l0Vl/ILnlR/sJHi2BubodVX/TJ4otpdp9zS+OgFqMZp8qErbp7A= X-Received: by 2002:ac2:4adc:: with SMTP id m28mr51482950lfp.26.1578163853271; Sat, 04 Jan 2020 10:50:53 -0800 (PST) In-Reply-To: <877e2fm9z1.fsf@gmx.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:174172 Archived-At: --000000000000df26f3059b54e7f3 Content-Type: text/plain; charset="UTF-8" A few small comments/questions inline ... On Sun, 29 Dec 2019 at 07:23, Michael Albinus wrote: > Peter Ludemann writes: > > Hi Peter, > > >> In bug#33194, a patch for Emacs 27.0.50 is mentioned. Do you have a > >> chance to run this for test? > > > > Emacs 27.0.50 somewhat fixes the problem with global-auto-revert-mode, > > using the same desktop file (and same open files) that was causing > > problems with Emacs 26.3. (Sorry I took so long to test this.) > > Thanks for the feedback, the fix in Emacs 27 seems to work. > Correction: Emacs 28.05, cloned from git://git.sv.gnu.org/emacs.git and built using the instructions at https://www.emacswiki.org/emacs/EmacsSnapshotAndDebian#toc3 > > Emacs CPU utilization is now ~30-80% (according to top(1)) instead of > > 100%; and responsiveness is good. Of course, it would be nicer if > > emacs CPU utilization were less, so that I could fully utilize that > > core (I only have 4 cores, so losing half a core is notable on large > > tests). > > If I count correctly, your desktop file contains 489 buffers. Heavy load > for global-auto-revert-mode. > This is the result of working on a project for several months (using emacs-daemon). For example, 94 of those files are from Python and SWI-Prolog standard libraries, because I needed to get implementation details ("use the source, Luke"); and I'm using pieces from about 5 packages, whose source I also need to look at. So, it's a little sloppy, but not unreasonable, I think. > > > Michael Albinus - you had a number of other questions ... do you still > > want them (or some of them) answered? > > No, I don't believe so. > > > PS: Here's the desktop file, in case that can give some clue as to > > what file or directory is causing problems. The "compilation" > > processes both input from and output into /tmp/pykythe_test -- as you > > can see, there are a couple of open files from that directory, but > > they're not being continuously updated, only once or twice per test. > > auto-revert watches directories. Even if you watch only some few files > in a directory (I count 29 buffers which are bound to "/tmp"), there > will be lot of file notification events when other files in that > directory are changed. Maybe it helps to set auto-revert-use-notify to > nil for those files? You could do it via directory-local variales, as in > If I understand you correctly, Emacs doesn't watch individual files but instead watches the directories that those files are in ... if a file changes, then the directory will be changed with the file is written/closed. Is this a correct understanding? (Presumably the reason for this is that if files /path/to/dir/A, /path/to/dir/B, /path/to/dir/C are open in buffers, it suffices to only watch for changes to /path/to/dir; and if /path/to/dir/D is opened, no change to the watch list is needed.) > > (dir-locals-set-class-variables 'auto-revert-with-polling > '((nil . ((auto-revert-use-notify . nil))))) > > (dir-locals-set-directory-class > "/tmp/" 'auto-revert-with-polling) > > (This is untested.) > I haven't tested this because emacs 28.05 gives me adequate performance and I can live with turning global-auto-revert on/off when I do a big test (turning it off makes the test run a bit faster because there's another 0.5 CPU available for the test). Thanks again! - peter > > best, > > - peter > > Best regards, Michael. > --000000000000df26f3059b54e7f3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
A few small comments/questions inline ...

On Sun, 29 Dec 2019 at 07:23, Michael Albinus <michael.albinus@gmx.de> wrote:
Peter Ludemann &l= t;peter.ludem= ann@gmail.com> writes:

Hi Peter,

>> In bug#33194, a patch for Emacs 27.0.50 is mentioned. Do you have = a
>> chance to run this for test?
>
> Emacs 27.0.50 somewhat fixes the problem with global-auto-revert-mode,=
> using the same desktop file (and same open files) that was causing
> problems with Emacs 26.3. (Sorry I took so long to test this.)

Thanks for the feedback, the fix in Emacs 27 seems to work.

Correction: Emacs 28.05, cloned from=C2=A0git://git.sv.gnu.org/emacs.git= =C2=A0and built=C2=A0using the instructions at=C2=A0https://www.emacswiki.org/emacs/EmacsSnapshotAndDebi= an#toc3


> Emacs CPU utilization is now ~30-80% (according to top(1)) instead of<= br> > 100%; and responsiveness is good. Of course, it would be nicer if
> emacs CPU utilization were less, so that I could fully utilize that > core (I only have 4 cores, so losing half a core is notable on large > tests).

If I count correctly, your desktop file contains 489 buffers. Heavy load for global-auto-revert-mode.

This is the res= ult of working on a project for several months (using emacs-daemon). For ex= ample, 94 of those files are from Python and SWI-Prolog standard libraries,= because I needed to get implementation details ("use the source, Luke= "); and I'm using pieces from about 5 packages, whose source I als= o need to look at.

So, it's a little sloppy, but not unreasonable,= I think.
=C2=A0

> Michael Albinus - you had a number of other questions ... do you still=
> want them (or some of them) answered?

No, I don't believe so.

> PS: Here's the desktop file, in case that can give some clue as to=
> what file or directory is causing problems. The "compilation"= ;
> processes both input from and output into /tmp/pykythe_test -- as you<= br> > can see, there are a couple of open files from that directory, but
> they're not being continuously updated, only once or twice per tes= t.

auto-revert watches directories. Even if you watch only some few files
in a directory (I count 29 buffers which are bound to "/tmp"), th= ere
will be lot of file notification events when other files in that
directory are changed. Maybe it helps to set auto-revert-use-notify to
nil for those files? You could do it via directory-local variales, as in

If I understand you correctly, Emacs doesn'= ;t watch individual files but instead watches the directories that those fi= les are in ... if a file changes, then the directory will be changed with t= he file is written/closed. Is this a correct understanding? (Presumably the= reason for this is that if files /path/to/dir/A, /path/to/dir/B, /path/to/= dir/C are open in buffers, it suffices to only watch for changes to /path/t= o/dir; and if /path/to/dir/D is opened, no change to the watch list is need= ed.)
=C2=A0

(dir-locals-set-class-variables 'auto-revert-with-polling
=C2=A0 =C2=A0'((nil . ((auto-revert-use-notify . nil)))))

(dir-locals-set-directory-class
=C2=A0 =C2=A0"/tmp/" 'auto-revert-with-polling)

(This is untested.)

I haven't tested this bec= ause emacs 28.05 gives me adequate performance and I can live with turning = global-auto-revert on/off when I do a big test (turning it off makes the te= st run a bit faster because there's another 0.5 CPU available for the t= est).

Thanks again!

- peter


> best,
> - peter

Best regards, Michael.
--000000000000df26f3059b54e7f3--