-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Intel RDT plugin: add support for groups of PIDs. #2891
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1, looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @wandralx, looks good for me.
@rpv-tomsk any thoughts/comments? when can I expect PR to be accepted? Thank you! |
@rubenk any thoughts/comments? when can I expect PR to be accepted? Thank you! |
Can I check this plugin on Core2Duo CPU ?
|
@rpv-tomsk thank you for your interest! Unfortunately no, to be able to check this plugin, you need one of Intel(R) Xeon(R) processors. For detailed info about required hardware and kernel versions please see README file: For info about /proc/cpuinfo flag bits please see: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
Thank you for your big work on Collectd.
I think this plugin and this update is very interesting and useful.
While looking into code, I found ways to do its code more clear and optimized, I hope.
I propose you to rework this utility and plugin:
Use dynamical array and realloc()
instead of linked list of pids and rework types:
typedef struct pids_list_s {
pid_t **pids;
size_t size;
size_t allocated; //only (re)allocate when needed.
} pids_list_t;
typedef struct proc_pids_s {
proc_comm_t proccess_name;
pids_list_t *prev;
pids_list_t *curr;
} proc_pids_t;
So, functions will be simplier, with less arguments:
-int pids_list_diff(pids_list_t *prev, pids_list_t *curr, pids_list_t **added,
- size_t *added_num, pids_list_t **removed,
- size_t *removed_num) {
+int proc_pids_diff(const proc_pids_t *proc, pids_list_t *added, pids_list_t *removed)
-pids_list_add_pids_list()
+pids_list_clone()
-fetch_pids_for_procs()
+update_proc_pids(proc_pids_t **proc_pids, size_t proc_pids_num); //Use global array and call this only once per read cycle
... and so on...
In plugin code:
*) Move pqos_mon_data
into rdt_name_group_s
.
*) Update structure a bit:
struct rdt_name_group_s {
char *desc; -- This will to to `plugin_instance`
//char **names; -- Remove in favour of `process_name` of `proc_pids_t`.
proc_pids_t *proc_pids_array; -- Remove `_array` suffix here
size_t proc_pids_num; -- Was `num_names` before renaming
size_t monitored_pids_count; -- Unsure if these two needs to be touched.
enum pqos_mon_event events;
};
*) Create global dynamical array of proc_pids_t
. That will be passed to update_proc_pids()
, so /proc
will be parsed only once. When doing oconfig_to_ngroups()
, proc_pids_t
should be allocated, and put into two arrays - one global, and one in ngroup
.
*) In update_proc_pids()
you can just swap prev/curr->pids
pointers and prev/curr->size
, and set curr->size = 0
before new pids added into curr
.
*) When adding new pids into pids_list_t
do realloc()
only when needed, by checking allocated
field.
*) In read_pids_data()
iterate by ngroups
as before.
*) In rdt_refresh_ngroup()
you can use arrays of pid_t
directly, pids_list_to_array()
will not be needed.
And so on. There is wide field for optimization and refactoring, so I can't write all details here w/o writing the code.
What can you say about such rework?
Unfortunately, I have no equipment to test this plugins, all available Xeon processors are too old.
DEBUG(RDT_PLUGIN ": Available events to monitor: %#x", events); | ||
|
||
rdt->num_ngroups = n; | ||
for (int i = 0; i < n; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation does not take into account that one option can be used in config several times.
Validation can be put into rdt_config()
, after all options are processed in 'for' cycle. Other changes may also be required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This helper function is called by rdt_config only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation does not take into account that one option can be used in config several times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation does not take into account that one option can be used in config several times.
Yes, currently we support only single Processes or Cores option. We plan to extend that in the future.
src/utils_proc_pids.c
Outdated
int init_result = initialize_proc_pids( | ||
procs_names_array, procs_names_array_size, proc_pids_array); | ||
if (0 != init_result) | ||
return -1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
closedir(proc_dir)
is missing here.
src/utils_proc_pids.c
Outdated
continue; | ||
} | ||
|
||
/* Try to find comm in input procs array (proc_pids_array has same names) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proc_pids_array has same names
- that is unclear.
If names are the same, why do we need to copy they in initialize_proc_pids()
in each cycle?
You can just do direct compare with procs_names_array[i]
and you even need not to have proccess_name
in proc_pids_s
then. And, as there is only one field in that structure, then that structure is not needed too.
But I have another proposal to rework this utility and plugin.
src/utils_proc_pids.c
Outdated
int read_result = | ||
read_proc_name(procfs_path, entry, comm, sizeof(proc_comm_t)); | ||
if (read_result <= 0) { | ||
ERROR(UTIL_NAME ": Comm file skipped. Read result: %d", read_result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typical system can have processes starting and finishing in unpredictable time.
Race conditions can occur. Logging ERROR for each such case of terminated process is excessive.
I think, no message is required here at all, like in processes
plugin.
groups_refresh: | ||
for (size_t i = 0; i < g_rdt->num_ngroups; i++) { | ||
int refresh_result = | ||
rdt_refresh_ngroup(&(g_rdt->ngroups[i]), g_rdt->pngroups[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will call fetch_pids_for_procs()
for each configured group, and will scan /proc
multiple times.
I think that is suboptimal and I have proposal how to optimize this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proc_pids_update moved before the for loop. Now list of pids is fetched only once.
Thanks @rpv-tomsk for the review. Working on these internally. Will have few updates very soon. |
Great news! |
adds intel_rdt_tests file with unit-tests of newly introduced functions. Change-Id: I0e26322caa19f57b7d660807646bd437586cd80d Signed-off-by: Starzyk, MateuszX <mateuszx.starzyk@intel.com>
Add temporary functions to enable further development of rdt plugin. These stubbed functions will be removed once libpqos extends it's API. Change-Id: I39dd428e39fd6055774dfc39b4c0690aedee4ebe Signed-off-by: Starzyk, MateuszX <mateuszx.starzyk@intel.com>
"Processes" option added. Change-Id: I7f62a51fc06e0c7503caa7860807f1c8e09b2fa1 Signed-off-by: Andralojc, WojciechX <wojciechx.andralojc@intel.com>
Change-Id: I569d72d0f12dca314e865f0b9236dc09a053c5e5 Signed-off-by: Andralojc, WojciechX <wojciechx.andralojc@intel.com>
Change-Id: I677c8215f89c04cedcb4c9e7d630f187a76a6cc7 Signed-off-by: Andralojc, WojciechX <wojciechx.andralojc@intel.com>
Change-Id: Ib5a7d318bde69ee8f496b39ca74b3ee4e58d8f5b Signed-off-by: Starzyk, MateuszX <mateuszx.starzyk@intel.com>
Refactor certain functions to be testable. Change-Id: I5adb6ed1b076f0cebc70641f04dd101d4e89b9cc Signed-off-by: Starzyk, MateuszX <mateuszx.starzyk@intel.com>
Change-Id: I3737a39c40d89a8782ef9c3d8195351f0fdeb278
… static to dynamic Change-Id: I3936fe78cfcbb4ce053d38ff1a3236c21eac9fd7 Signed-off-by: Michal Aleksinski <michalx.aleksinski@intel.com>
Extract pids config to seperate file. Extract pids config tests to seperate file. Change-Id: I2978db56b15a126eced12f40baac631517303e04 Signed-off-by: Mateusz Starzyk <mateuszx.starzyk@intel.com>
Signed-off-by: Wojciech Andralojc <wojciechx.andralojc@intel.com> Change-Id: I325ea0728dd1eb65776f239b0d7977cc02f9c8db
Change-Id: I161c8df1e6a4c4c4e0dd4e20601323ef7a1c18f5
Change-Id: Ibcf8c2fd6d1b490cbeeef7480c49da84389104f4
Change-Id: Ibb0dc6fe59eb77a217ab3b45ec0c1437bc9eb281
Change-Id: Ia7c9bf5dca2b871b05c9ed3876059e6d34bd943e
Change-Id: Ia932f377c5194240aab910d052e422b99ea542a5
DEBUG(RDT_PLUGIN ": Available events to monitor: %#x", events); | ||
|
||
rdt->num_ngroups = n; | ||
for (int i = 0; i < n; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This implementation does not take into account that one option can be used in config several times.
…ds list Change-Id: Ic99acd51be69d2678f25bdde9ca37011ad24fe99
Hi @rpv-tomsk, Currently we support only single use of Processes or Cores option. This is the case also for some other plugins. It's a good idea, but maybe we should improve it in the future, not in this PR. |
I would go with @kwiatrox suggestion. Could we have this accepted for 5.9 release and have the updates done just after as a new PR? |
I just want to include only qualitative code. I think there is no much code changes needed to allow multiple use of |
Thanks @rpv-tomsk. We see 5.9 release hasnt happened yet and so we are working on the updates as indicated. |
Add a check to avoid placing multiple Cores or Processes options in intel_rdt configuration in order to avoid misuse and errors. Change-Id: I82504a650bf9c568862da9f129a84a3079990496 Signed-off-by: Kamil Wiatrowski <kamilx.wiatrowski@intel.com>
Hi, Team. I will not merge none of PR untill it will be possible for me to merge my PR too. Thanks for your attention. |
Thank you all for your contribution. |
ChangeLog: intel_rdt: Add support for groups of PIDs monitoring
intel_rdt plugin takes processes’ names as single items or as groups.
Plugin will reconfigure pqos library when given process is terminated or created.
For each process or group of processes following statistics are collected: