From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by sourceware.org (Postfix) with ESMTPS id BC3143858400 for ; Mon, 18 Oct 2021 10:51:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BC3143858400 Authentication-Results: sourceware.org; dmarc=fail (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MZkYx-1mFYK51LTb-00WpzI for ; Mon, 18 Oct 2021 12:51:38 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id 76A03A80D40; Mon, 18 Oct 2021 12:51:37 +0200 (CEST) Date: Mon, 18 Oct 2021 12:51:37 +0200 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: cygrunsrv + sshd + rsync = 20 times too slow -- throttled? Message-ID: Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: <61adb3e0-9ef5-50ee-d422-6ee718d633c8@cornell.edu> <20210921082230.4e7f2421c729c0f74b4a8cfe@nifty.ne.jp> <20210921173035.d3f61cb132b7dab80fed352c@nifty.ne.jp> <682e0f1f-7a5e-be88-6f96-32284423bc94@cornell.edu> <20210922003614.3a39a2e91632a58105a99fde@nifty.ne.jp> <20210923172601.8fcd5304f606b96377ce75f0@nifty.ne.jp> <20210924000318.d5a248f6efb4362eda6fa243@nifty.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210924000318.d5a248f6efb4362eda6fa243@nifty.ne.jp> X-Provags-ID: V03:K1:5fJw6igq7V1PF4FcT+q2XMtkH1KVk0UCHdBscqYey8vRac/dkY/ fQ1VMdjp6+a7OqEtTd8Ay/v5j9rjCyrHW0ihgoUlp9zYGs2mX6zT0zoSVRWD+E/4YGz5G2S REDKM65ApL02dc6RCwUZoe2CqiN95/bxe8kpl4iTv3T/+4vqaPS8/BdNE3z7tnGJ/haFQJJ P7TckhQ+eqU490B6CfBcg== X-UI-Out-Filterresults: notjunk:1;V03:K0:WIID7Yeia9Q=:B22AdsZkN90PME/g5fAy58 hMfcg5BtOGOgqzFKawVLGoXtbgk8hc1jtU1x2qXma43dEA86gcT3oPjVwDvYUoiZrx+zFKMt7 t2cjiqJRkrNKYLVrbxh95Bn35vDWy+zsQL3vzR8MVsNGnA3EEI9VQdKBLBWHZx7FreW6OD3HX Qix88MTDkY1/yMIdzjpaO/teH1Ho+N+FItkGS56ibvjIbjfumHKNQmmn6ndwDgAw1CN2cUEhW X0qKlYOkPjVX5g8odXFFrqQqg9CZ+fz8tOfS517dY295GYJSzhsl4BYScN8Zd5JKgNnI4SkB9 +YAaepTq33WqbliLuBY0s05uywcTFMMbtUlfOog77Xd/0gPoRvAbJnAiC6ETZW2h1DrelP5Da AHeNPk3f+bgiLXVvAExfKrj3IGjTLlIbkxeXDcdRS/ldSwGpWhLjOn0owAz9sEJ6jmbWtV1Nu oBRRpb7BdYXpHoA4xpO/0NvsigWuEiHQMPF6d4VObv04fd+eJGkMSRIFUCVUXFnbPoEl71HXY KdggaxPpv3UaFdG8a9NI5R25uGha+OOh81XLfaWdltV/mW/dRuMqGJE2EX1WsbcJZX5nnv0uu i5W8SJP2BDeagWqIKCVxDK31cyGE/NofOGv4Iy53LtVB0Y92T3dDXJ07WyDW+/3rzLGVbsJNG mfyP7cvZ22McfXzFXsnmHUdYGGGBoYlWF7KAuf6QlKjDTTeYXpLm2CQgBB01He4VdEW4p7I4O V0HSHC7Dx910GYyNCGkt8/hIU7eDDYHizfCNyuj/Jf34Ja/lZk75giwRKvU= X-Spam-Status: No, score=-99.8 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, 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: Mon, 18 Oct 2021 10:51:42 -0000 Hi Takashi, Hi Ken, first of all, thanks for keeping at it! On Sep 24 00:03, Takashi Yano wrote: > On Thu, 23 Sep 2021 09:03:13 -0400 > Ken Brown wrote: > > On 9/23/2021 4:26 AM, Takashi Yano wrote: > > > * Make temporary_query_hdl() faster. > > > > Thanks! Again, I'm not familiar with the Windows functions that you used, so > > Corinna should review this too when she returns. > > > > I have one question: > > > > The documentation at > > https://docs.microsoft.com/en-us/windows/win32/api/psapi/nf-psapi-enumprocesses > > says, "There is no indication given when the buffer is too small to store all > > process identifiers. Therefore, if lpcbNeeded equals cb, consider retrying the > > call with a larger array." > > > > Does this mean that EnumProcesses could return TRUE even if the buffer is too small? > > Ah, right. Thanks for pointing out that mistake. > I have fixed that. The patch looks basically ok, but we shouldn't use PSAPI calls inside Cygwin. I'm a bit fuzzy on the details, but we had some problems with PSAPI way back when. One of them, prominently, is the fact that the entry points have changed in the past. EnumProcess from psapi.dll is now k32_EnumProcess from kernel32.dll or whatever, since the headers are using PSAPI_VERSION 2 as default. Linking against that will break Vista. If you change this to PSAPI_VERSION 1, OTOH, you will have to add the psapi symbols to autoload.cc. Why don't you just use winpids, as in: winpids pids; pids.set (true); for (int i = 0; i < pids.npids; ++i) ... pids.reset (); This will use NtQuerySystemInformation (SystemProcessInformation) under the hood. Of course, winpids adds a bit of unnecessary overhead by checking for procinfo stuff, so maybe you may want to use NtQuerySystemInformation (SystemProcessInformation) directly and just copy/paste the minimally required code from the `else' branch in winpids::enum_processes. Thanks, Corinna