From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: "Lavrentiev, Anton (NIH/NLM/NCBI) [C]" <lavr@ncbi.nlm.nih.gov>
Cc: cygwin@cygwin.com
Subject: Re: getpriority() and top display for priority is inconsistent
Date: Tue, 06 Aug 2019 20:08:00 -0000 [thread overview]
Message-ID: <20190806200837.GW11632@calimero.vinschen.de> (raw)
In-Reply-To: <BL0PR0901MB4308798C7E132A9D569FB9AAA5D50@BL0PR0901MB4308.namprd09.prod.outlook.com>
[-- Attachment #1: Type: text/plain, Size: 1510 bytes --]
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.
>
> 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":
>
> /* 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 = 8; /* Default value. */ else
> priority = pbi.BasePriority;
>
> But that's an inconsistent way of generating the value, because it is
> supposed to be the one that "getpriority()" returns.
>
> 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).
>
> 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
--
Corinna Vinschen
Cygwin Maintainer
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2019-08-06 20:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-06 18:54 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-06 20:08 ` Corinna Vinschen [this message]
2019-08-07 0:45 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-07 8:08 ` Corinna Vinschen
2019-08-07 19:28 Lavrentiev, Anton (NIH/NLM/NCBI) [C] via cygwin
2019-08-08 8:00 ` Corinna Vinschen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190806200837.GW11632@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
--cc=lavr@ncbi.nlm.nih.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).