-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
dpdk: rework hugepage hints to use per-numa information v2 #9898
Conversation
Previous integration of hugepage analysis only fetched data from /proc/meminfo. However this proved to be often deceiving mainly for providing only global information and not taking into account different hugepage sizes (e.g. 1GB hugepages) and different NUMA nodes. Ticket: OISF#6419
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #9898 +/- ##
==========================================
- Coverage 82.45% 82.30% -0.16%
==========================================
Files 972 973 +1
Lines 273057 273213 +156
==========================================
- Hits 225156 224859 -297
- Misses 47901 48354 +453
Flags with carried forward coverage won't be shown. Click here to find out more. |
Information: QA ran without warnings. Pipeline 16735 |
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.
cppcheck
src/util-hugepages.c:120:9: warning: %hd in format string (no. 1) requires 'short' but the argument type is 'unsigned short'. [invalidPrintfArgType_sint]
snprintf(path, sizeof(path),
^
src/util-hugepages.c:129:13: warning: %hd in format string (no. 1) requires 'short *' but the argument type is 'unsigned short *'. [invalidScanfArgType_int]
if (fscanf(f, "%hd", &hugepages[i].allocated) != 1) {
^
src/util-hugepages.c:137:9: warning: %hd in format string (no. 1) requires 'short' but the argument type is 'unsigned short'. [invalidPrintfArgType_sint]
snprintf(path, sizeof(path),
^
src/util-hugepages.c:146:13: warning: %hd in format string (no. 1) requires 'short *' but the argument type is 'unsigned short *'. [invalidScanfArgType_int]
if (fscanf(f, "%hd", &hugepages[i].free) != 1) {
^
src/util-hugepages.c:126:20: warning: Either the condition '!f' is redundant or there is possible null pointer dereference: f. [nullPointerRedundantCheck]
fclose(f);
^
src/util-hugepages.c:124:13: note: Assuming that condition '!f' is not redundant
if (!f) {
^
src/util-hugepages.c:126:20: note: Null pointer dereference
fclose(f);
^
src/util-hugepages.c:143:20: warning: Either the condition '!f' is redundant or there is possible null pointer dereference: f. [nullPointerRedundantCheck]
fclose(f);
^
src/util-hugepages.c:141:13: note: Assuming that condition '!f' is not redundant
if (!f) {
^
src/util-hugepages.c:143:20: note: Null pointer dereference
fclose(f);
^
src/util-hugepages.c:126:20: error: Null pointer dereference [nullPointer]
fclose(f);
^
src/util-hugepages.c:143:20: error: Null pointer dereference [nullPointer]
fclose(f);
^
scan-build about the same
In function 'SystemHugepagePerNodeGetHugepageInfoLinux',
inlined from 'SystemHugepagePerNodeGetHugepageInfo' at util-hugepages.c:178:11,
inlined from 'SystemHugepageSnapshotCreate' at util-hugepages.c:300:23:
util-hugepages.c:126:13: warning: argument 1 null where non-null expected [-Wnonnull]
126 | fclose(f);
| ^~~~~~~~~
In file included from suricata-common.h:64,
from suricata.h:67,
from util-hugepages.c:24:
/usr/include/stdio.h: In function 'SystemHugepageSnapshotCreate':
/usr/include/stdio.h:183:12: note: in a call to function 'fclose' declared 'nonnull'
183 | extern int fclose (FILE *__stream) __nonnull ((1));
| ^~~~~~
In function 'SystemHugepagePerNodeGetHugepageInfoLinux',
inlined from 'SystemHugepagePerNodeGetHugepageInfo' at util-hugepages.c:178:11,
inlined from 'SystemHugepageSnapshotCreate' at util-hugepages.c:300:23:
util-hugepages.c:143:13: warning: argument 1 null where non-null expected [-Wnonnull]
143 | fclose(f);
| ^~~~~~~~~
/usr/include/stdio.h: In function 'SystemHugepageSnapshotCreate':
/usr/include/stdio.h:183:12: note: in a call to function 'fclose' declared 'nonnull'
183 | extern int fclose (FILE *__stream) __nonnull ((1));
| ^~~~~~
util-hugepages.c:126:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
fclose(f);
^~~~~~~~~
util-hugepages.c:143:13: warning: Null pointer passed to 1st parameter expecting 'nonnull' [core.NonNullParamChecker]
fclose(f);
^~~~~~~~~
2 warnings generated.
NodeInfo *nodes = SCCalloc(node_cnt, sizeof(*nodes)); | ||
if (nodes == NULL) { | ||
FatalError("failed to allocate memory for NUMA node info"); | ||
return NULL; |
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.
unreachable due to FatalError
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.
return statement removed
SCFree(s); | ||
} | ||
|
||
SystemHugepageSnapshot *SystemHugepageSnapshotCreate(void) |
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.
can you add a comment about the return values?
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.
added
Continues in #10164 |
Follow-up #9735
Previous integration of hugepage analysis only fetched data from /proc/meminfo. However, this proved to be often deceiving mainly for providing only global information and not taking into account different hugepage sizes (e.g. 1GB hugepages) and different NUMA nodes.
Describe changes:
https://redmine.openinfosecfoundation.org/issues/6419