eflags on x86 sleep_on vs. wait_event

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

 



Hello,

While studying the Linux source code (2.4.8) for x86, I noticed that sleep_on() and wait_event() behave differently with respect to the eflags register:
- sleep_on() saves the flags [by using wq_write_lock_irqsave() in the SLEEP_ON_HEAD macro] before calling schedule() and restores them [by using
wq_write_unlock_irqrestore() in the SLEEP_ON_TAIL macro] when returning from schedule.
- wait_event() does not save/restore the eflags register before/after schedule.
Since schedule() does not save/restore the eflags register of the previous/next processes (at least I couldn't find any corresponding code in the switch_to() and
__switch_to() macros). This results in a different behaviour, in that a process may assume the eflags to remain constant across calls to sleep_on(), while they may be
modified (by another process) across calls to wait_event().

So my questions are:
1) Are my observations correct. In particular is it true, that the eflags are not saved/restored by schedule()?
2) Why did the kernel developpers choose to implement a different semantic (with respect to the eflags register) for sleep_on() and wait_event()?
3) Are such differences documented at any place, or is it up to the developper of a kernel module, to figure out such differences from the Linux sources?

thanks in advance for any help
with best regards
Martin

P.S. please put me on cc: in your reply, since I am not in the mailing list.

--
Supercomputing System AG          email: maletinsky@scs.ch
Martin Maletinsky                 phone: +41 (0)1 445 16 05
Technoparkstrasse 1               fax:   +41 (0)1 445 16 10
CH-8005 Zurich


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[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