Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getprocs64.c - page size wrong ? #1

Open
mawelo opened this issue Oct 8, 2024 · 2 comments
Open

getprocs64.c - page size wrong ? #1

mawelo opened this issue Oct 8, 2024 · 2 comments

Comments

@mawelo
Copy link

mawelo commented Oct 8, 2024

In AIX the page size can vary from process to process. AIX supports multiple page sizes (typically 4 KB and 16 KB, but it can also support larger page sizes in specific configurations, such as 64 KB, 1 MB, or 16 MB depending on hardware and OS configuration). Therefore e.g. to calculate the resident set size (RSS) accurately, you need to retrieve the page size specific to each process.
So in my opinion this line is problematic:
(int)procs[i].pi_size4, / convert pages to KBytes */

@nigelargriffiths
Copy link
Owner

Hi,
Interesting question - here are my comments.
First. a single process can have multiple pages sizes and the kernel can migrate between the page sizes on the fly.
Second, the getprocs() and getproces64() system calls pre-date AIX having multiple page sizes by many years, so this is not reflected in the data returned by these functions.
The pi_size from the hearer file:
unsigned long pi_size; /* size of image (pages) */
is in number of 4KB pages. A bit of a shame it does not actually state that but then the C comment pre-dates any ideas of multiple page sizes.

I would expect the functions to to the maths for us to return the 4KB page count.
This is so that older programs using the data structure do not have to change and will not fail on news AIX releases.
If you doubt that then you could raise an AIX support case.

@mawelo
Copy link
Author

mawelo commented Oct 11, 2024

Hi Nigel, thank you very much for your reply. I believe you are correct in your assessment regarding the functions to match for us to return the 4KB page number. Based on your reasoning, this seems perfectly logical to me and very well-founded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants