Welcome to the Linux Foundation Forum!

Interrupts

while understanding the interrupts, I saw the below line in hardirq.h.

#define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)</p>

Can anyone please tell me what is 1UL means in the above line.

Thanks in advance

Regards

Kumar

Comments

  • marc
    marc Posts: 647
    ravi.chakram wrote:
    while understanding the interrupts, I saw the below line in hardirq.h.

    #define SOFTIRQ_OFFSET (1UL << SOFTIRQ_SHIFT)

    Can anyone please tell me what is 1UL means in the above line.


    Thanks in advance

    Regards
    Kumar

    1 Unsigned Long = an "unsigned long" full of ones

    Regards

    PS: I'm no expert, I might be wrong!
  • UL means long unsigned int. 1 is left shifted by SOFTIRQ_SHIFT(8) times, that means value will be

    0x00000100.

    This macro is used to increment the softirq count in the thread_info->preempt_count at 0x00000100 offset.

    For linux kernel articles, visit www.rulingminds.com
  • Goineasy9
    Goineasy9 Posts: 1,114
    That RulingMinds site is very interesting, especially for kernel newbies like me. The videos could have been edited better, well, they could have been edited, but, all in all, I'd still say it's an interesting site.
  • chekkizhar
    chekkizhar Posts: 182
    rulingminds wrote:

    This macro is used to increment the softirq count in the thread_info->preempt_count at 0x00000100 offset.

    Great . But, is it incrementing the count at 0x00000100 or assigning/updating the soft-interrupts value as 0x00000100

    My opinion is, it is doing the second one.
  • No, This is incrementing or decrementing the softirq count. The preempt_count is divided as follows.

    For softirq count there are 8 bits(from 8 - 15) in preempt_count variable. So, the variable can be incremented upto 255.
    This count says number of levels the softirqs are disabled(number of tymes local_bh_disable() is called) . decremented using local_bh_enable(). See the following code in softirq.c and preempt.h

    # define add_preempt_count(val) do { preempt_count() += (val); } while (0)

    static inline void __local_bh_disable(unsigned long ip, unsigned int cnt)
    {
    add_preempt_count(cnt);
    barrier();
    }

    Here, count is 0x100.


    -Rulingminds

Categories

Upcoming Training