[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38644: 26.3; emacs uses 100% CPU with auto-revert-mode

From: Peter Ludemann
Subject: bug#38644: 26.3; emacs uses 100% CPU with auto-revert-mode
Date: Sat, 4 Jan 2020 10:50:16 -0800

A few small comments/questions inline ...

On Sun, 29 Dec 2019 at 07:23, Michael Albinus <address@hidden> wrote:
Peter Ludemann <address@hidden> 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)))))

   "/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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]