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

lib: qmem show changes (header and max) #2859

Merged
merged 2 commits into from
Aug 30, 2018

Conversation

louberger
Copy link
Member

 add header to show qmem, align table with headers
 add tracking of max # allocs and max bytes alloc'ed

@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 17, 2018

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/2859 43227f2
Date 08/17/2018
Start 13:40:10
Finish 14:03:19
Run-Time 23:09
Total 1816
Pass 1816
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2018-08-17-13:40:10.txt
Log autoscript-2018-08-17-13:40:55.log.bz2

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-4890/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


Warnings Generated during build:

Checkout code: Successful with additional warnings:

Report for memory_vty.c | 2 issues
===============================================
< WARNING: line over 80 characters
< #105: FILE: /tmp/f1-23293/memory_vty.c:105:

CLANG Static Analyzer Summary

  • Github Pull Request 2859, comparing to Git base SHA e0909ff

No Changes in Static Analysis warnings compared to base

4 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-4890/artifact/shared/static_analysis/index.html

Copy link
Contributor

@eqvinox eqvinox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work correctly under MT scenarios.

lib/memory.c Outdated
oldsize = 1 + atomic_fetch_add_explicit(&mt->n_alloc, 1,
memory_order_relaxed);

if (oldsize > atomic_load_explicit(&mt->n_max, memory_order_relaxed))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not how atomics work.

lib/memory.c Outdated
oldsize = mallocsz +
atomic_fetch_add_explicit(&mt->total, mallocsz,
memory_order_relaxed);
if (oldsize > atomic_load_explicit(&mt->max_size, memory_order_relaxed))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, this won't work correctly in MT.

@louberger
Copy link
Member Author

louberger commented Aug 19, 2018 via email

@eqvinox
Copy link
Contributor

eqvinox commented Aug 20, 2018

Yes but it's a close enough approximation. Do you really want to lock this code?

Point of the atomics is to not lock ;) ...

We can track the max, but I would actually prefer tracking the total lifetime numbers (i.e. separately count allocations and frees, instead of having frees decrement the allocs.) Do you specifically want the max?

(max can be done in atomics too, albeit slightly more complicated)

@louberger
Copy link
Member Author

louberger commented Aug 20, 2018 via email

@eqvinox
Copy link
Contributor

eqvinox commented Aug 20, 2018

@louberger alright gimme a bit to find my goat for the atomics gods.

@eqvinox
Copy link
Contributor

eqvinox commented Aug 23, 2018

I'm gonna close this for the moment, I'm working on it and will have a new PR up in a few days probably. We've lived without the numbers for years, we can survive a few days 😄

@eqvinox eqvinox closed this Aug 23, 2018
@louberger
Copy link
Member Author

louberger commented Aug 23, 2018 via email

@louberger louberger reopened this Aug 26, 2018
Copy link
Contributor

@mjstapp mjstapp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a reference to lib/thread.c where a different atomic pattern is being used for something similar

lib/memory.c Outdated
oldsize = 1 + atomic_fetch_add_explicit(&mt->n_alloc, 1,
memory_order_relaxed);

if (oldsize > atomic_load_explicit(&mt->n_max, memory_order_relaxed))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've got some code in lib/thread.c that's using atomic_compare_exchange_weak_explicit() in a loop to accomplish this sort of thing - maybe that pattern could be reused?

@louberger
Copy link
Member Author

louberger commented Aug 28, 2018 via email

@mjstapp
Copy link
Contributor

mjstapp commented Aug 28, 2018

hmm - that's only for older compilers, isn't it - and ... it's not really a lock - it's just a barrier? I mean, in order to support MT we have to take some precautions, even though there's sometimes a cost involved.

@louberger louberger force-pushed the working/master/meminfo branch from 43227f2 to 6497310 Compare August 28, 2018 20:56
@louberger
Copy link
Member Author

@eqvinox @mjstapp okay revised with suggested changes and additions. @donaldsharp Note that the result is an approximation in the MT case -- I'm intentionally not testing the result of atomic_compare_exchange_weak_explicit which would fully cover the MT case, but the while loop required is overly expensive IMO. I'll fully cover the MT case if others think this is critical.

@NetDEF-CI

This comment has been minimized.

@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 28, 2018

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/2859 6497310
Date 08/28/2018
Start 17:08:42
Finish 17:31:52
Run-Time 23:10
Total 1816
Pass 1816
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2018-08-28-17:08:42.txt
Log autoscript-2018-08-28-17:09:26.log.bz2

For details, please contact louberger

     add header to show qmem, align table with headers
     add tracking of max # allocs and max bytes alloc'ed

Signed-off-by: Lou Berger <lberger@labn.net>
Signed-off-by: Lou Berger <lberger@labn.net>
@louberger louberger force-pushed the working/master/meminfo branch from 6497310 to 7a15333 Compare August 28, 2018 23:22
@LabN-CI
Copy link
Collaborator

LabN-CI commented Aug 28, 2018

💚 Basic BGPD CI results: SUCCESS, 0 tests failed

Results table
_ _
Result SUCCESS git merge/2859 7a15333
Date 08/28/2018
Start 19:30:19
Finish 19:53:58
Run-Time 23:39
Total 1816
Pass 1816
Fail 0
Valgrind-Errors 0
Valgrind-Loss 0
Details vncregress-2018-08-28-19:30:19.txt
Log autoscript-2018-08-28-19:31:20.log.bz2

For details, please contact louberger

@NetDEF-CI
Copy link
Collaborator

Continuous Integration Result: SUCCESSFUL

Congratulations, this patch passed basic tests

Tested-by: NetDEF / OpenSourceRouting.org CI System

CI System Testrun URL: https://ci1.netdef.org/browse/FRR-FRRPULLREQ-5078/

This is a comment from an EXPERIMENTAL automated CI system.
For questions and feedback in regards to this CI system, please feel free to email
Martin Winter - mwinter (at) opensourcerouting.org.


CLANG Static Analyzer Summary

  • Github Pull Request 2859, comparing to Git base SHA 96487ee

No Changes in Static Analysis warnings compared to base

4 Static Analyzer issues remaining.

See details at
https://ci1.netdef.org/browse/FRR-FRRPULLREQ-5078/artifact/shared/static_analysis/index.html

@eqvinox eqvinox merged commit 66a9aa8 into FRRouting:master Aug 30, 2018
@louberger louberger deleted the working/master/meminfo branch March 17, 2020 11:58
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

Successfully merging this pull request may close these issues.

5 participants