lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20070617161439.8470.qmail@science.horizon.com>
Date:	17 Jun 2007 12:14:39 -0400
From:	linux@...izon.com
To:	linux-kernel@...r.kernel.org
Cc:	linux@...izon.com
Subject: msleep(1000) vs. schedule_timeout_uninterruptible(HZ+1)

I was looking at some of the stupider code that calls msleep(),
particularly that which does
	msleep(jiffies_to_msecs(jiff))

and I noticed that msleep() just calls schedule_timeout_uninterruptible().
But it does it in a loop.

The basic question is, when does the loop make a difference?
Is it only when you're on a wait queue?  Or are there other kinds of
unexpected wakeups that can arrive?

I see all kinds of uses of both kinds for simple "wait a while" operations,
and I'm not sure if one is more correct than the other.

(And, in drivers/media/video/cpia2/cpia2_v4l.c:cpia2_exit(), a lovely
example of calling schedule_timeout() without set_current_state() first.)
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ