mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* CONFIG_PREEMPT_COUNT
@ 2014-03-31 10:38 Skidanov, Alexey
  2014-03-31 12:24 ` CONFIG_PREEMPT_COUNT Paul Bolle
  0 siblings, 1 reply; 3+ messages in thread
From: Skidanov, Alexey @ 2014-03-31 10:38 UTC (permalink / raw)
  To: linux-kernel; +Cc: Gabbay, Oded

Hello,

I found that preempt_enable() and preempt_disable() macros are defined differently depending on CONFIG_PREEMPT_COUNT:
- They increment per CPU preemption counter, if CONFIG_PREEMPT_COUNT defined
- They do nothing (just call barrier), if not.
I have it undefined in my source tree.

The questions are:
1. What is the purpose of CONFIG_PREEMPT_COUNT define and how I can define it?
2. In the previous kernel versions, spin_lock() and spin_unlock() call preempt_enable() and preempt_disable() respectively, ensuring that the current task will not be preempted by any other task while lock is held. Is this still ensured with these macros defined as "do nothing" ?

Thanks
Alexey


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: CONFIG_PREEMPT_COUNT
  2014-03-31 10:38 CONFIG_PREEMPT_COUNT Skidanov, Alexey
@ 2014-03-31 12:24 ` Paul Bolle
  2014-03-31 12:50   ` CONFIG_PREEMPT_COUNT Skidanov, Alexey
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Bolle @ 2014-03-31 12:24 UTC (permalink / raw)
  To: Skidanov, Alexey; +Cc: linux-kernel, Gabbay, Oded

Alexey,

On Mon, 2014-03-31 at 10:38 +0000, Skidanov, Alexey wrote:
> What is the purpose of CONFIG_PREEMPT_COUNT define and how I can
> define it?

CONFIG_PREEMPT_COUNT is a Kconfig macro, ie it's (in short) to be
defined as a result one of the "*config" make targets. And doing
    git grep -nw PREEMPT_COUNT

gives
    kernel/Kconfig.preempt:38:      select PREEMPT_COUNT
    kernel/Kconfig.preempt:57:config PREEMPT_COUNT
    lib/Kconfig.debug:964:  select PREEMPT_COUNT

And looking at those hits it seems PREEMPT_COUNT will be set, and
therefore CONFIG_PREEMPT_COUNT defined, if either PREEMPT or
DEBUG_ATOMIC_SLEEP are set in a .config.

(I'm not familiar with PREEMPT_COUNT. I think I never used it.)

Hope this helps,


Paul Bolle


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: CONFIG_PREEMPT_COUNT
  2014-03-31 12:24 ` CONFIG_PREEMPT_COUNT Paul Bolle
@ 2014-03-31 12:50   ` Skidanov, Alexey
  0 siblings, 0 replies; 3+ messages in thread
From: Skidanov, Alexey @ 2014-03-31 12:50 UTC (permalink / raw)
  To: Paul Bolle; +Cc: linux-kernel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1606 bytes --]

Paul,
Thank you for your answer. We have PREEMT_VOLUNTARY  defined, so that is the reason why the CONFIG_PREEMPT_COUNT is undefined. 
The second question (that was badly formatted in original message) was:

In the previous kernel versions, spin_lock() and spin_unlock() call preempt_enable() and preempt_disable() respectively,
ensuring that the current task will not be preempted by any other task while lock is held. Is this still ensured with these macros defined as “do nothing” ?

-----Original Message-----
From: Paul Bolle [mailto:pebolle@tiscali.nl] 
Sent: Monday, March 31, 2014 3:25 PM
To: Skidanov, Alexey
Cc: linux-kernel@vger.kernel.org; Gabbay, Oded
Subject: Re: CONFIG_PREEMPT_COUNT

Alexey,

On Mon, 2014-03-31 at 10:38 +0000, Skidanov, Alexey wrote:
> What is the purpose of CONFIG_PREEMPT_COUNT define and how I can 
> define it?

CONFIG_PREEMPT_COUNT is a Kconfig macro, ie it's (in short) to be defined as a result one of the "*config" make targets. And doing
    git grep -nw PREEMPT_COUNT

gives
    kernel/Kconfig.preempt:38:      select PREEMPT_COUNT
    kernel/Kconfig.preempt:57:config PREEMPT_COUNT
    lib/Kconfig.debug:964:  select PREEMPT_COUNT

And looking at those hits it seems PREEMPT_COUNT will be set, and therefore CONFIG_PREEMPT_COUNT defined, if either PREEMPT or DEBUG_ATOMIC_SLEEP are set in a .config.

(I'm not familiar with PREEMPT_COUNT. I think I never used it.)

Hope this helps,


Paul Bolle


ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-31 12:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-31 10:38 CONFIG_PREEMPT_COUNT Skidanov, Alexey
2014-03-31 12:24 ` CONFIG_PREEMPT_COUNT Paul Bolle
2014-03-31 12:50   ` CONFIG_PREEMPT_COUNT Skidanov, Alexey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome