Re: How to unwind stack to seek for specific caller?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: pgpWz_ETZ1ZwZ.pgp
Description: PGP signature

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

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

  Powered by Linux