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

Remove use of update() in funccount #417

Merged
merged 3 commits into from
Feb 23, 2016
Merged

Remove use of update() in funccount #417

merged 3 commits into from
Feb 23, 2016

Conversation

drzaeus77
Copy link
Collaborator

This is an alternative fix for #415, funccount being called in a recursive context.

Brenden Blanco added 3 commits February 23, 2016 13:10
It is sometimes useful to zero out the entries of table without erasing
the keys. Add a zero() function to make this easy.

Signed-off-by: Brenden Blanco <[email protected]>
Add a helper to translate from kernel name to symbol. As part of this,
slightly refactor the ksym globals (which are internal implementation
and not part of the api) so that there is one array of tuples instead of
two arrays.

Signed-off-by: Brenden Blanco <[email protected]>
Hash map updates are not safe in recursive context. Change the
implementation of funccount to be read-only by converting
lookup_or_init() to lookup(). When run in interval mode, zero the counts
table instead of clearing it.

Signed-off-by: Brenden Blanco <[email protected]>
@@ -186,6 +186,10 @@ def clear(self):
for k in self.keys():
self.__delitem__(k)

def zero(self):
for k in self.keys():
self[k] = self.Leaf()
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this part actually clear it in a hash map.
Isn't zero-ing it in python memory only?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, everything implemented in this file is write-through.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

To be specific, this will invoke __setitem__(key, value)

Copy link
Member

Choose a reason for hiding this comment

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

yeah found it. so it will call update_elem() which will do kmalloc in user context which is ok.

Copy link
Member

Choose a reason for hiding this comment

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

hmm then delete should be ok as well.

4ast added a commit that referenced this pull request Feb 23, 2016
Remove use of update() in funccount
@4ast 4ast merged commit 3ce27b5 into master Feb 23, 2016
@goldshtn
Copy link
Collaborator

How would you propose to deal with this issue in argdist? Unlike here, the keys are actually arbitrary structures and aren't known in advance...

@drzaeus77 drzaeus77 deleted the funccount_alternate branch April 19, 2016 01:19
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.

None yet

3 participants