Re: [PATCH 1/3] kernel.h: Add DO_ONCE statement expression macro

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

 



> Add a DO_ONCE statement expression analogous to printk_once
> that executes any arbitrary statement exactly once.

Your implementation is racy. Its also hiding stuff in macro magic which
is asking for accidents to happen.

The natural kernel way to write this is

	if (!test_and_set_bit(....))

which is a lot more obvious than a magic macro, doesn't race and can use
other bits in an existing set of flags and be used as a
"do-once-for-this-object-instance" - which is almost always want you want.

Alan
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Devel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Forum]     [Linux SCSI]

  Powered by Linux