Re: Inline Functions ...

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

 



On Thu, Sep 18, 2008 at 5:22 PM, Sandeep K Sinha <sandeepksinha@xxxxxxxxx> wrote:
Hi Mahaveer,

On Thu, Sep 18, 2008 at 3:59 PM, mahaveer darade <mah.darade@xxxxxxxxx> wrote:


On Thu, Sep 18, 2008 at 5:41 AM, Balraj Dahiya <dahbal76@xxxxxxxxx> wrote:
Hi All,
 
Why we use Inline Functions in Linux Kernel? What is the importance of Inline functions and where we should use them?

its just a suggestion( not mandatory )  to compiler to substitute code of function into caller.
there are plenty of scenarios to think of its usage.

What do you mean by its "not mandatory" ? Well, the compiler has to follow the standards, if specified. And "inline" keyword is stated quite clearly everywhere. And it has a very trivial meaning.

Hi,
    'inline' is just to state that, the programmer wishes to inline the function. The compiler at compile time decides whether or not a particular function is to be actually inlined. If it decides against inlining then, even the keyword cannot force it. The compiler gets to decide whether inlining would really benefit the code. If the size of the inlined function is too big then, it probably would be detrimental to the performance due to increase in code size which would eventually cause cache misses.


Can you tell me any scenario, where you would mark a function to be inline and not expect to be patched into the caller.
 

Apart from size constraints, directly recursive functions might also not be inlined. 
Also, without the 'static' keyword, the compiler will have to search outside the file to patch the code. Hence, it might decide to ignore the 'inline'  keyword in such a case too.
 

Kindly CMIIW.

Best regards,
Pranav
pranavsbrain.peshwe.com


[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