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. :)

Attachment: pgpG_JgpbR3tq.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to