Calling GetConsoleProcessList in tight loop allocates new buffer via condrv ioctl results in excessive page-faults with Windows Terminal
Takashi Yano
takashi.yano@nifty.ne.jp
Tue Dec 3 14:39:02 GMT 2024
On Tue, 3 Dec 2024 20:42:42 +0900
Takashi Yano wrote:
> On Mon, 2 Dec 2024 19:57:25 +0000
> Steven Buehler wrote:
> > I am experiencing an abnormal number of page-faults per second (averaging 800 to over 2000) when using Cygwin within the Windows Terminal app. This produces visible stutters and cursor movement during terminal screen redraws.
> >
> > I have opened an issue on the Windows Terminal GitHub issues page. The initial investigation by one of the Windows Terminal developers has determined that "Cygwin is calling console APIs in its steady state. It looks like it's calling GetConsoleProcessList in a tight loop, which results in the allocation of a new buffer that is returned to their process via condrv's ioctl interface. I don't think there's anything we can do about that, other than stopping them from doing so."
> >
> > Following this response, I am attempting to bring this issue to the Cygwin developer team's awareness for a possible resolution. Please see https://github.com/microsoft/terminal/issues/18264 for a detailed discussion and accompanying video demonstration of the page-fault counter.
>
> Thanks for the report.
> However, I cannot reproduce your problem.
> Which cygwin version do you use?
I cound finally reproduce it.
With Windows Terminal (Release version: 1.21.3231.0), this does
not happen. Also, if the shell is tcsh (not bash), this does not
happen as well.
With Windows Termianl 1.22.3232.0 and bash, I cound reproduce that.
As the issue does not occur with 1.21.3231.0, isn't this a regression
of Windows Terminal (preview)?
I cannot understand the reason why calling GetConsoleProcessList()
exhosts the buffer memory, because the buffer lpdwProcessList is
allocated by cygwin side (not in condrv). If we cannot call
GetConsoleProcessList() frequently, I think it is the problem
of Windows API side.
--
Takashi Yano <takashi.yano@nifty.ne.jp>
More information about the Cygwin
mailing list