Skip to contentSkip to conversation

Question re: __mlog_cpu_guess in fs/ocfs2/cluster/masklog.h

DISCUSSION Lee Revell 2 participants 4 messages May 22, 2006 – May 23, 2006

lore
Share & tools
lore

Lee Revell

author
#0 lore raw

I am puzzled by this code and comment:

/*
* smp_processor_id() "helpfully" screams when called outside preemptible
* regions in current kernels. sles doesn't have the variants that don't
* scream. just do this instead of trying to guess which we're building
* against.. *sigh*.
*/

#define __mlog_cpu_guess ({             \
        unsigned long _cpu = get_cpu(); \
        put_cpu();                      \
        _cpu;                           \
})

First I think you mean "inside preemptible regions". Second, it screams because it's a bug to call smp_processor_id() from preemptible code!

Am I missing something?

Lee

#1 lore raw
Quoted 2 lines

Am I missing something?

The comment isn't particularly coherent and can be gotten rid of. What puzzles you about the code?

- z

author
#2 lore raw
Quoted 4 lines · Zach Brown
Quoted 1 line

Am I missing something?

The comment isn't particularly coherent and can be gotten rid of. What puzzles you about the code?

I was wondering how it could not be a bug to use smp_processor_id in preemptible code, but I see that it's only used for debug output. Sorry for the noise.

Lee

#3 lore raw
Quoted 4 lines

I was wondering how it could not be a bug to use smp_processor_id in preemptible code, but I see that it's only used for debug output. Sorry for the noise.

No problem, thanks for taking a look in the first place. We'll update the comment to make it more explicit.

- z