From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 107622 invoked by alias); 6 Aug 2019 20:08:54 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 107611 invoked by uid 89); 6 Aug 2019 20:08:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-104.2 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy= X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.126.133) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Aug 2019 20:08:53 +0000 Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M3UhO-1hvdj002GQ-000Zjm; Tue, 06 Aug 2019 22:08:40 +0200 Received: by calimero.vinschen.de (Postfix, from userid 500) id A93E0A80690; Tue, 6 Aug 2019 22:08:37 +0200 (CEST) Date: Tue, 06 Aug 2019 20:08:00 -0000 From: Corinna Vinschen To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" Cc: cygwin@cygwin.com Subject: Re: getpriority() and top display for priority is inconsistent Message-ID: <20190806200837.GW11632@calimero.vinschen.de> Reply-To: cygwin@cygwin.com Mail-Followup-To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" , cygwin@cygwin.com References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hm39DdI+xc+0zcX9" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-SW-Source: 2019-08/txt/msg00086.txt.bz2 --hm39DdI+xc+0zcX9 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-length: 1489 On Aug 6 18:54, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin wrote: > I have noticed a discrepancy between the process priority shown by > "top" vs. what getpriority() returns. >=20 > I'm using the procps-based "top", so it reads the priority value from > /proc/PID/stat. The value gets there via code found in > "fhandler_process.cc": >=20 > /* The BasePriority returned to a 32 bit process under WOW64 is > apparently broken, for 32 and 64 bit target processes. 64 bit > processes get the correct base priority, even for 32 bit processes. > */ if (wincap.is_wow64 ()) priority =3D 8; /* Default value. */ else > priority =3D pbi.BasePriority; >=20 > But that's an inconsistent way of generating the value, because it is > supposed to be the one that "getpriority()" returns. >=20 > Also, it looks like the higher value in "pbi.BasePriority" corresponds > to a higher process priority, while Unix priority is higher when the > value is less (20 - nice, generally). >=20 > It looks like it should have been done by calling a utility function, > winprio_to_nice(GetPriorityClass(CurrentProcess())), and setting up > both the priority field (as "NZERO + winprio_to_nice()") and the > following "nice" field (which is currently set to permanent zero) with > what winprio_to_nice() returns. You seem to have worked it out already so please send a patch in git format-patch foramt to the cygwin-patches mailing list. Thanks, Corinna --=20 Corinna Vinschen Cygwin Maintainer --hm39DdI+xc+0zcX9 Content-Type: application/pgp-signature; name="signature.asc" Content-length: 833 -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAl1J3kUACgkQ9TYGna5E T6BDaw/9H3cv2ERXUrFTNAdtbm4jnoaomhua/brohJbZ7hCu2ztxvklfZDh2Q9e2 nMyHIu/ySMeJfGPjTnoe4nWju3YcvOl2rtMJbUBirTO7nIk/ZCaHiANnySO3x0UO +aXexJW4zx1/O0+dcGxuH2gRLKqfS+g3ClFQ36pLhNxy55eZbIpdi71wCTXB+znS 0bVc9e2qZ8xuuPjbBrB/yPusVodsjD/xF+KIN4i3ZNi0os3olCPnqZGWhEtSTlmm ELtofCX6HT8meNo26XPZWvCy0uK2R9gC1+wRgBnhmPiUWi7SdqnuNko5bmXFoV4K zu5rApq2Sa8STf/KhnSZb2lGgv2OBRBm23fo8Y7kO6F4FyO8o+mepPoPDwFjyicP iyWlJY9YJQtNVAiJ1gQkitDEo3Z20GLYRMbzNoW9JSAXzW0Ka9qs4lqvo7YT3/rR i6m78ztiJwUhp25FBtekTC841tdvidnBnlau/z5ZbSZcn6vDhPes5kXKDU6Dku4P 0nb6FIhB4F8khBZ3K5kNE1b8lz5qsxSO1AT/Lmkl6doO31ifdHWS1M/fPpn4CkHI q2lpG3Rako5iHMw/xNgDrinp1caKH7ZTPw8sKOPHTpW7nq7bAreMixhj4xHThGa+ ffVpCOyfTgw/qMJRx6JuzXLcQHPJax8x8XZ7ousHdegGMOSbBiA= =7M1f -----END PGP SIGNATURE----- --hm39DdI+xc+0zcX9--