How to unwind stack to seek for specific caller?
valdis.kletnieks at vt.edu
valdis.kletnieks at vt.edu
Fri Aug 3 08:41:56 EDT 2018
On Fri, 03 Aug 2018 15:14:45 +0300, Lev Olshvang said:
> But I need to find out whether my function y() was called from linux kernel
> function x().\
What problem are you trying to solve? If it's your function, don't you already
*know* which functions call it?
And if being called from code A requires different behavior than if it was
called from B, the *right* answer is to create a flag and pass it. That
requires less code, is simpler than trying to unwind the stack, and makes it
easier if 6 months from now you call a call from routine C.
For an example, see the memory-allocation flags GFP_ATOMIC and similar - if
you're adding another call site that needs it, you just add GFP_ATOMIC to the
flags.
And I'm willing to bet that most of those GFP_ flags were *all* originally "we
have to do something special if we try to do memory allocation from That One
Problem Spot. :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 486 bytes
Desc: not available
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20180803/333604c2/attachment.sig>
More information about the Kernelnewbies
mailing list