----- Original Message -----
Hello Dave,
I am still locating problems of the SLES9. Until now, nothing was
found, and I will continue checking the difference. Once I fix them,
I
will send the patch. The attachment only fixes the problem of output.
--
--
Regards
Qiao Nuohan
I see that in all "ipcs -M" displays where there are a number of
shared memory pages swapped out, it shows something like this:
SHMID_KERNEL KEY SHMID UID PERMS BYTES NATTCH STATUS
ffff810026d75ed0 00000000 360452 3369 600 393216 2 dest
PAGES ALLOCATED: 96 RESIDENT: 48 SWAPPED: 36
SWAP PERFORMANCE ATTEMPTS: 0 SUCCESSES: 0
VFS_INODE: ffff81003d927d58
where on every one of them, the "SWAP PERFORMANCE" values are always zero.
So then I saw that your code just hardwires them to "0L":
fprintf(fp, "PAGES ALLOCATED: %ld RESIDENT: %ld SWAPPED: %ld\n",
(shm_info.bytes+PAGESIZE()-1) >> PAGESHIFT(),
shm_info.rss, shm_info.swap);
fprintf(fp, "SWAP PERFORMANCE ATTEMPTS: %ld SUCCESSES: %ld\n",
0L, 0L);
fprintf(fp, "VFS_INODE: %lx\n", shm_info.shm_inode);
And looking at recent kernel sources, Linux stopped using those two
fields since version 2.6 -- it just returns 0 to the SHM_INFO shmctl
system call.
Here is relevant part of the shmctl(2) man page:
SHM_INFO (Linux specific)
Returns a shm_info structure whose fields contain information
about system resources consumed by shared memory. This struc-
ture is defined in <sys/shm.h> if the _GNU_SOURCE feature test
macro is defined:
struct shm_info {
int used_ids; /* # of currently existing
segments */
unsigned long shm_tot; /* Total number of shared
memory pages */
unsigned long shm_rss; /* # of resident shared
memory pages */
unsigned long shm_swp; /* # of swapped shared
memory pages */
unsigned long swap_attempts; /* Unused since Linux 2.4 */
unsigned long swap_successes; /* Unused since Linux 2.4 */
};
So that line of output is completely meaningless, and should be
dropped entirely.
That being the case, I'm now thinking that the -M option may be unnecessary?
The shared memory output could be restricted to just 2 lines:
SHMID_KERNEL KEY SHMID UID PERMS BYTES NATTCH STATUS
ffff810026d75ed0 00000000 360452 3369 600 393216 2 dest
PAGES ALLOCATED/RESIDENT/SWAPPED: 96/48/36 VFS_INODE: ffff81003d927d58
Dave