DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 4B3EdfVQ2375704
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 4B3EdfVQ2375704
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=ARRkSOPO
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94CED3858C66
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1733236779;
	bh=HPzBdQ4BaSDtLI38gvU9Y42i/rLTmh9vFVDljano5B0=;
	h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=ARRkSOPOOLr7XfkD83wRW2Y6sZMZqn8EcefGlPACa2VpBAJ6A3jnEqTgQgmqTKyDw
	 g2lnD9QbyBK9nUd6CJ4EtjLFEPIvju2/RuaC77V63lSa8EiQ8a67bh71U9K+MZj0BZ
	 kT3xzbgEMYbTPS+A/sFMYxqidRQ3R8FYaHdcANMA=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BBFA93858D35
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BBFA93858D35
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1733236745; cv=none;
 b=OKQX7hk3jlhDZDXK0aLy6Y40FmNyX0cEuH4UXnkd5+waFoOdafvpHTg+D5/cahmaFJmg2C/PRb5I4ZqjzcxlECrndT5WjkJ8k7grADTWOZYpM/YBocIp8Hg9KdLQWk+DNFR2jgcj4RMdqdORiF7vP3IgsBgVvKoJQ3QRH6uaps8=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1733236745; c=relaxed/simple;
 bh=gwACBY5P0brptER3Rd6r6i1CvbpbyvtgRAtAcohSUd8=;
 h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature;
 b=TRlpbZFbxs/LTMXGGofaE3hEeKyQoEYJkB+a7HBkO/5HL+dGFekhyW0OUywjMwmBEN618dxaQPzPKau1jzspaUkj04zij156v8VoQS/M1TGcGPA2YP8PH0MW+IOCkjXe0s+la+6sL8qMFS7SzTlZ5xo+aUif7jBbyHKzI/KzHlE=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBFA93858D35
Date: Tue, 3 Dec 2024 23:39:02 +0900
To: cygwin@cygwin.com
Subject: Re: Calling GetConsoleProcessList in tight loop allocates new
 buffer via condrv ioctl results in excessive page-faults with Windows
 Terminal
Message-Id: <20241203233902.37aec13ed7a0053dddbe7a83@nifty.ne.jp>
In-Reply-To: <20241203204242.4bd45fc54e31431ceaf94816@nifty.ne.jp>
References: <PH7PR11MB64522B9A097A9A5D963E5C23A4352@PH7PR11MB6452.namprd11.prod.outlook.com>
 <20241203204242.4bd45fc54e31431ceaf94816@nifty.ne.jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Takashi Yano via Cygwin <cygwin@cygwin.com>
Reply-To: Takashi Yano <takashi.yano@nifty.ne.jp>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

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>

-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple
