From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-05.nifty.com (conssluserg-05.nifty.com [210.131.2.90]) by sourceware.org (Postfix) with ESMTPS id D12C93861872 for ; Wed, 8 Sep 2021 09:45:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D12C93861872 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=nifty.ne.jp Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp Received: from Express5800-S70 (z221123.dynamic.ppp.asahi-net.or.jp [110.4.221.123]) (authenticated) by conssluserg-05.nifty.com with ESMTP id 1889jBVH008123 for ; Wed, 8 Sep 2021 18:45:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com 1889jBVH008123 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1631094311; bh=0fUkUwqLrNhmHvC8miAd7rnMRlGUJpckmN6GkjlIRgk=; h=Date:From:To:Subject:In-Reply-To:References:From; b=MIpsZCQT9ELq8vSbTgSaoFeKoiUpQYegs5DhiKeMRcFT/5C+CiVu7f2OdGdi90UcY Ouc4c/VVnFx1m/kdsxtIEnURGtPRSNfndglEDMztnOzRCCkGWzLCYtB7jGG8gjxFwG eE+V4KYM0rlsA6D3WPflzv617Q/KpLqJzferdm5D+Tn7m2+LYmQ8pzOyjZumqOFIST GQc4tItYOY7hPEPlRIL6xnUpxi+mRSUcrab3BXd9WEW1w+M8U4hgeU6aqFdDVuggFS wH2j3C/X61Oo6R+/LXOUOFcB1315N+/nBwi1DKgpqlSTUORfvvLOPPWJfaCjrPnOqc ioBfyQzObN6DQ== X-Nifty-SrcIP: [110.4.221.123] Date: Wed, 8 Sep 2021 18:45:11 +0900 From: Takashi Yano To: cygwin-developers@cygwin.com Subject: Re: cygrunsrv + sshd + rsync = 20 times too slow -- throttled? Message-Id: <20210908184511.75c901b132c71911aaaa6ad6@nifty.ne.jp> In-Reply-To: References: <20210826062934.54f2f2216021c095bb7ba13b@nifty.ne.jp> <3b560051-ab27-f392-ca4b-d1fd9b5733b0@cornell.edu> <20210827202440.47706fc2fc07c5e9a1bc0047@nifty.ne.jp> <20210907122631.65452be8d021ec72259431d5@nifty.ne.jp> <20210907195023.31ad8194457bb90c2b6971b4@nifty.ne.jp> <20210908090748.3e70ed5aea3fa3c320b5ae0d@nifty.ne.jp> <20210908131141.bf63a795ce13c8dd8f5c13a8@nifty.ne.jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2021 09:45:35 -0000 On Wed, 8 Sep 2021 11:26:21 +0200 Corinna Vinschen wrote: > On Sep 8 11:01, Corinna Vinschen wrote: > > On Sep 8 13:11, Takashi Yano wrote: > > > On Wed, 8 Sep 2021 09:07:48 +0900 > > > Takashi Yano wrote: > > > > On Tue, 7 Sep 2021 19:50:23 +0900 > > > > Takashi Yano wrote: > > > > > > > > > @@ -796,7 +792,8 @@ pipe_cleanup (select_record *, select_stuff *stuff) > > > > > pi->stop_thread = true; > > > > > SetEvent (pi->bye); > > > > ~~~~~~~~~~~~~~~~~~~ > > > > This is not correct. SetEvent() wakes-up one of thread_pipe()s, > > > > but it may be other thread than one which should be stopped. > > > > > > > > > pi->thread->detach (); > > > > > - CloseHandle (pi->bye); > > > > > + if (me->fh->get_select_evt () == NULL) > > > > > + CloseHandle (pi->bye); > > > > > } > > > > > delete pi; > > > > > stuff->device_specific_pipe = NULL; > > > > > > > > I think it also should be > > > > > + for (ULONG i = 0; i < get_obj_handle_count (select_evt); i++) > > > > > + SetEvent (select_evt); > > > > > > > > Actually I want to use PulseEvent() here if it is not **UNRELIABLE**. > > > > https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/28648-pulseevent-is-an-unreliable-function > > > > > > > > Does using semaphore object instead of event, and releasing > > > > resources equal to the number of handles make sense? > > > > > > No it does not. One thread may consume semaphore multiple times.... > > > > What exactly is the problem in the code which results in high CPU > > load? Can you explain this a bit? Maybe we need an entirely > > different approach to avoid that. > > I saw your new patch, but I don't see the problem. I typed a lot of > keys in mintty quickly and what happens is that the load of mintty > goes up to 9% on a 4 CPU system, but only temporarily while typing. > How do you reproduce the problem? Did you apply the patch 0001-Cygwin-select-Introduce-select_evt-event-for-pipe.patch or 0001-Cygwin-select-Introduce-select_sem-semaphore-for-pip.patch ? With these patch, the problem does not occur. The problem occurs with the commit dccde0dc. With my 4 core 8 thread CPU, CPU loads goes up to 12-13 % if I type keys using key repeat (30cps) after the commit dccde0dc. -- Takashi Yano