library: eliminate distorted history 1st time switches
Upon reflection, at the point where the 'priming read' was introduced, any possibility of history distortions was also eliminated. This was true because all of the 'old' (zeroed) data will have been replaced with 'new' data whenever a user finally calls get, select & reap. Thus, any DELTA values will automatically reflect that interval between 'new' and subsequent retrieval calls. [ diskstats didn't actually employ a 1st time switch ] [ like the others so we have changed a comment only. ] [ but that module will retain something similar used ] [ inside node_update whenever a new node is created. ] Reference(s): . priming read added to slabinfo commit5d5a52a380
. priming read added to diskstats commitecd64f4445
. priming read added to meminfo, stat, vmstat commit1a2b62c779
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
@ -121,7 +121,6 @@ struct fetch_support {
|
||||
struct slabinfo_info {
|
||||
int refcount;
|
||||
FILE *slabinfo_fp;
|
||||
int slabinfo_was_read;
|
||||
int nodes_alloc; /* nodes alloc()ed */
|
||||
int nodes_used; /* nodes using alloced memory */
|
||||
struct slabs_node *nodes; /* first slabnode of this list */
|
||||
@ -495,10 +494,6 @@ static int read_slabinfo_failed (
|
||||
else
|
||||
return -ERANGE;
|
||||
|
||||
if (!info->slabinfo_was_read) {
|
||||
memcpy(&info->slabs.old, &info->slabs.new, sizeof(struct slabs_summ));
|
||||
info->slabinfo_was_read = 1;
|
||||
}
|
||||
return retval;
|
||||
} // end: read_slabinfo_failed
|
||||
|
||||
@ -814,7 +809,8 @@ PROCPS_EXPORT int procps_slabinfo_new (
|
||||
|
||||
/* do a priming read here for the following potential benefits: |
|
||||
1) see if that caller's permissions were sufficient (root) |
|
||||
2) make delta results potentially useful, even if 1st time | */
|
||||
2) make delta results potentially useful, even if 1st time |
|
||||
3) elimnate need for history distortions 1st time 'switch' | */
|
||||
if ((rc = read_slabinfo_failed(p))) {
|
||||
procps_slabinfo_unref(&p);
|
||||
return rc;
|
||||
|
Reference in New Issue
Block a user