sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget0/translations/zh_CN/timers/delay_sleep_functionsmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/zh_TW/timers/delay_sleep_functionsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/it_IT/timers/delay_sleep_functionsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ja_JP/timers/delay_sleep_functionsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/ko_KR/timers/delay_sleep_functionsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/pt_BR/timers/delay_sleep_functionsmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget0/translations/sp_SP/timers/delay_sleep_functionsmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhcomment)}(h SPDX-License-Identifier: GPL-2.0h]h SPDX-License-Identifier: GPL-2.0}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhhhJ/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions.rsthKubhsection)}(hhh](htitle)}(hDelay and sleep mechanismsh]hDelay and sleep mechanisms}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(haThis document seeks to answer the common question: "What is the RightWay (TM) to insert a delay?"h]heThis document seeks to answer the common question: “What is the RightWay (TM) to insert a delay?”}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThis question is most often faced by driver writers who have to deal with hardware delays and who may not be the most intimately familiar with the inner workings of the Linux Kernel.h]hThis question is most often faced by driver writers who have to deal with hardware delays and who may not be the most intimately familiar with the inner workings of the Linux Kernel.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hThe following table gives a rough overview about the existing function 'families' and their limitations. This overview table does not replace the reading of the function description before usage!h]hThe following table gives a rough overview about the existing function ‘families’ and their limitations. This overview table does not replace the reading of the function description before usage!}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubhtable)}(hhh]htgroup)}(hhh](hcolspec)}(hhh]h}(h]h ]h"]h$]h&]colwidthKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jhjubj)}(hhh]h}(h]h ]h"]h$]h&]jKuh1jhjubhthead)}(hhh](hrow)}(hhh](hentry)}(hhh]h}(h]h ]h"]h$]h&]uh1jMhjJubjN)}(hhh]h)}(h `*delay()`h]htitle_reference)}(hj]h]h*delay()}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1j_hj[ubah}(h]h ]h"]h$]h&]uh1hhhhKhjXubah}(h]h ]h"]h$]h&]uh1jMhjJubjN)}(hhh]h)}(h`usleep_range*()`h]j`)}(hjh]husleep_range*()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j_hj}ubah}(h]h ]h"]h$]h&]uh1hhhhKhjzubah}(h]h ]h"]h$]h&]uh1jMhjJubjN)}(hhh]h)}(h `*sleep()`h]j`)}(hjh]h*sleep()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j_hjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jMhjJubjN)}(hhh]h)}(h `fsleep()`h]j`)}(hjh]hfsleep()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j_hjubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jMhjJubeh}(h]h ]h"]h$]h&]uh1jHhjEubjI)}(hhh](jN)}(hhh]h}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hbusy-wait looph]hbusy-wait loop}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hhrtimers basedh]hhrtimers based}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(htimer list timers basedh]htimer list timers based}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hcombines the othersh]hcombines the others}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj1ubah}(h]h ]h"]h$]h&]uh1jMhjubeh}(h]h ]h"]h$]h&]uh1jHhjEubeh}(h]h ]h"]h$]h&]uh1jChjubhtbody)}(hhh](jI)}(hhh](jN)}(hhh]h)}(hUsage in atomic Contexth]hUsage in atomic Context}(hj_hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj\ubah}(h]h ]h"]h$]h&]uh1jMhjYubjN)}(hhh]h)}(hyesh]hyes}(hjvhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hjsubah}(h]h ]h"]h$]h&]uh1jMhjYubjN)}(hhh]h)}(hnoh]hno}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK!hjubah}(h]h ]h"]h$]h&]uh1jMhjYubjN)}(hhh]h)}(hnoh]hno}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hjubah}(h]h ]h"]h$]h&]uh1jMhjYubjN)}(hhh]h)}(hnoh]hno}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hjubah}(h]h ]h"]h$]h&]uh1jMhjYubeh}(h]h ]h"]h$]h&]uh1jHhjVubjI)}(hhh](jN)}(hhh]h)}(hprecise on "short intervals"h]h precise on “short intervals”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hyesh]hyes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK%hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hyesh]hyes}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hdependsh]hdepends}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK'hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hyesh]hyes}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK(hj4ubah}(h]h ]h"]h$]h&]uh1jMhjubeh}(h]h ]h"]h$]h&]uh1jHhjVubjI)}(hhh](jN)}(hhh]h)}(hprecise on "long intervals"h]hprecise on “long intervals”}(hjWhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK)hjTubah}(h]h ]h"]h$]h&]uh1jMhjQubjN)}(hhh]h)}(h Do not use!h]h Do not use!}(hjnhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hjkubah}(h]h ]h"]h$]h&]uh1jMhjQubjN)}(hhh]h)}(hyesh]hyes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK+hjubah}(h]h ]h"]h$]h&]uh1jMhjQubjN)}(hhh]h)}(hmax 12.5% slackh]hmax 12.5% slack}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK,hjubah}(h]h ]h"]h$]h&]uh1jMhjQubjN)}(hhh]h)}(hyesh]hyes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK-hjubah}(h]h ]h"]h$]h&]uh1jMhjQubeh}(h]h ]h"]h$]h&]uh1jHhjVubjI)}(hhh](jN)}(hhh]h)}(hinterruptible varianth]hinterruptible variant}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK.hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hnoh]hno}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK/hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hyesh]hyes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK0hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hyesh]hyes}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK1hjubah}(h]h ]h"]h$]h&]uh1jMhjubjN)}(hhh]h)}(hnoh]hno}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK2hj,ubah}(h]h ]h"]h$]h&]uh1jMhjubeh}(h]h ]h"]h$]h&]uh1jHhjVubeh}(h]h ]h"]h$]h&]uh1jThjubeh}(h]h ]h"]h$]h&]colsKuh1jhj ubah}(h]h ]colwidths-givenah"]h$]h&]uh1j hhhhhNhNubh)}(h2A generic advice for non atomic contexts could be:h]h2A generic advice for non atomic contexts could be:}(hj]hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK4hhhhubhenumerated_list)}(hhh](h list_item)}(hPUse `fsleep()` whenever unsure (as it combines all the advantages of the others)h]h)}(hPUse `fsleep()` whenever unsure (as it combines all the advantages of the others)h](hUse }(hjvhhhNhNubj`)}(h `fsleep()`h]hfsleep()}(hj~hhhNhNubah}(h]h ]h"]h$]h&]uh1j_hjvubhB whenever unsure (as it combines all the advantages of the others)}(hjvhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK6hjrubah}(h]h ]h"]h$]h&]uh1jphjmhhhhhNubjq)}(h Use `*sleep()` whenever possibleh]h)}(hjh](hUse }(hjhhhNhNubj`)}(h `*sleep()`h]h*sleep()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j_hjubh whenever possible}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjubah}(h]h ]h"]h$]h&]uh1jphjmhhhhhNubjq)}(hGUse `usleep_range*()` whenever accuracy of `*sleep()` is not sufficienth]h)}(hjh](hUse }(hjhhhNhNubj`)}(h`usleep_range*()`h]husleep_range*()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j_hjubh whenever accuracy of }(hjhhhNhNubj`)}(h `*sleep()`h]h*sleep()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j_hjubh is not sufficient}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hjubah}(h]h ]h"]h$]h&]uh1jphjmhhhhhNubjq)}(h+Use `*delay()` for very, very short delays h]h)}(h*Use `*delay()` for very, very short delaysh](hUse }(hjhhhNhNubj`)}(h `*delay()`h]h*delay()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j_hjubh for very, very short delays}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK:hjubah}(h]h ]h"]h$]h&]uh1jphjmhhhhhNubeh}(h]h ]h"]h$]h&]enumtypearabicprefixhsuffix.uh1jkhhhhhhhK6ubh)}(hWFind some more detailed information about the function 'families' in the next sections.h]h[Find some more detailed information about the function ‘families’ in the next sections.}(hj5hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj:ubah}(h]h ]h"]h$]h&]uh1jhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMhj6ubj)}(hhh]h)}(h(Requested sleep duration in millisecondsh]h(Requested sleep duration in milliseconds}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjQhMhjRubah}(h]h ]h"]h$]h&]uh1jhj6ubeh}(h]h ]h"]h$]h&]uh1jhjQhMhj3ubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hjwh]h Description}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjuubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMhjubh)}(hXimsleep() uses jiffy based timeouts for the sleep duration. Because of the design of the timer wheel, the maximum additional percentage delay (slack) is 12.5%. This is only valid for timers which will end up in level 1 or a higher level of the timer wheel. For explanation of those 12.5% please check the detailed description about the basics of the timer wheel.h]hXimsleep() uses jiffy based timeouts for the sleep duration. Because of the design of the timer wheel, the maximum additional percentage delay (slack) is 12.5%. This is only valid for timers which will end up in level 1 or a higher level of the timer wheel. For explanation of those 12.5% please check the detailed description about the basics of the timer wheel.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMhjubh)}(hThe slack of timers which will end up in level 0 depends on sleep duration (msecs) and HZ configuration and can be calculated in the following way (with the timer wheel design restriction that the slack is not less than 12.5%):h]hThe slack of timers which will end up in level 0 depends on sleep duration (msecs) and HZ configuration and can be calculated in the following way (with the timer wheel design restriction that the slack is not less than 12.5%):}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM#hjubj )}(h#``slack = MSECS_PER_TICK / msecs`` h]h)}(h"``slack = MSECS_PER_TICK / msecs``h]j)}(hjh]hslack = MSECS_PER_TICK / msecs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM'hjubah}(h]h ]h"]h$]h&]uh1j hjhM'hjubh)}(hWhen the allowed slack of the callsite is known, the calculation could be turned around to find the minimal allowed sleep duration to meet the constraints. For example:h]hWhen the allowed slack of the callsite is known, the calculation could be turned around to find the minimal allowed sleep duration to meet the constraints. For example:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM)hjubh bullet_list)}(hhh](jq)}(h``HZ=1000`` with ``slack=25%``: ``MSECS_PER_TICK / slack = 1 / (1/4) = 4``: all sleep durations greater or equal 4ms will meet the constraints.h]h)}(h``HZ=1000`` with ``slack=25%``: ``MSECS_PER_TICK / slack = 1 / (1/4) = 4``: all sleep durations greater or equal 4ms will meet the constraints.h](j)}(h ``HZ=1000``h]hHZ=1000}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh with }(hjhhhNhNubj)}(h ``slack=25%``h]h slack=25%}(hjh~^hhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh: }(hjhhhNhNubj)}(h*``MSECS_PER_TICK / slack = 1 / (1/4) = 4``h]h&MSECS_PER_TICK / slack = 1 / (1/4) = 4}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhE: all sleep durations greater or equal 4ms will meet the constraints.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM-hjubah}(h]h ]h"]h$]h&]uh1jphjubjq)}(h``HZ=1000`` with ``slack=12.5%``: ``MSECS_PER_TICK / slack = 1 / (1/8) = 8``: all sleep durations greater or equal 8ms will meet the constraints.h]h)}(h``HZ=1000`` with ``slack=12.5%``: ``MSECS_PER_TICK / slack = 1 / (1/8) = 8``: all sleep durations greater or equal 8ms will meet the constraints.h](j)}(h ``HZ=1000``h]hHZ=1000}(hj4hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj0ubh with }(hj0hhhNhNubj)}(h``slack=12.5%``h]h slack=12.5%}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj0ubh: }(hj0hhhNhNubj)}(h*``MSECS_PER_TICK / slack = 1 / (1/8) = 8``h]h&MSECS_PER_TICK / slack = 1 / (1/8) = 8}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj0ubhE: all sleep durations greater or equal 8ms will meet the constraints.}(hj0hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM/hj,ubah}(h]h ]h"]h$]h&]uh1jphjubjq)}(h``HZ=250`` with ``slack=25%``: ``MSECS_PER_TICK / slack = 4 / (1/4) = 16``: all sleep durations greater or equal 16ms will meet the constraints.h]h)}(h``HZ=250`` with ``slack=25%``: ``MSECS_PER_TICK / slack = 4 / (1/4) = 16``: all sleep durations greater or equal 16ms will meet the constraints.h](j)}(h ``HZ=250``h]hHZ=250}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh with }(hj{hhhNhNubj)}(h ``slack=25%``h]h slack=25%}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubh: }(hj{hhhNhNubj)}(h+``MSECS_PER_TICK / slack = 4 / (1/4) = 16``h]h'MSECS_PER_TICK / slack = 4 / (1/4) = 16}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj{ubhF: all sleep durations greater or equal 16ms will meet the constraints.}(hj{hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM1hjwubah}(h]h ]h"]h$]h&]uh1jphjubjq)}(h``HZ=250`` with ``slack=12.5%``: ``MSECS_PER_TICK / slack = 4 / (1/8) = 32``: all sleep durations greater or equal 32ms will meet the constraints. h]h)}(h``HZ=250`` with ``slack=12.5%``: ``MSECS_PER_TICK / slack = 4 / (1/8) = 32``: all sleep durations greater or equal 32ms will meet the constraints.h](j)}(h ``HZ=250``h]hHZ=250}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh with }(hjhhhNhNubj)}(h``slack=12.5%``h]h slack=12.5%}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh: }(hjhhhNhNubj)}(h+``MSECS_PER_TICK / slack = 4 / (1/8) = 32``h]h'MSECS_PER_TICK / slack = 4 / (1/8) = 32}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhF: all sleep durations greater or equal 32ms will meet the constraints.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM3hjubah}(h]h ]h"]h$]h&]uh1jphjubeh}(h]h ]h"]h$]h&]bullet*uh1jhj%hM-hjubh)}(h9See also the signal aware variant msleep_interruptible().h]h9See also the signal aware variant msleep_interruptible().}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chM6hjubeh}(h]h ] kernelindentah"]h$]h&]uh1j}hj)hhhNhNubj)}(hhh]h}(h]h ]h"]h$]h&]entries](j!msleep_interruptible (C function)c.msleep_interruptiblehNtauh1j~hj)hhhNhNubj)}(hhh](j)}(h7unsigned long msleep_interruptible (unsigned int msecs)h]j)}(h6unsigned long msleep_interruptible(unsigned int msecs)h](j)}(hunsignedh]hunsigned}(hjDhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj@hhhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMCubj)}(h h]h }(hjShhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj@hhhjRhMCubj)}(hlongh]hlong}(hjahhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj@hhhjRhMCubj)}(h h]h }(hjohhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj@hhhjRhMCubj)}(hmsleep_interruptibleh]j)}(hmsleep_interruptibleh]hmsleep_interruptible}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj}ubah}(h]h ](jjeh"]h$]h&]hhuh1jhj@hhhjRhMCubj)}(h(unsigned int msecs)h]j)}(hunsigned int msecsh](j)}(hunsignedh]hunsigned}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(hinth]hint}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(hmsecsh]hmsecs}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubah}(h]h ]h"]h$]h&]hhuh1jhj@hhhjRhMCubeh}(h]h ]h"]h$]h&]hhjGuh1jjHjIhj<hhhjRhMCubah}(h]j7ah ](jMjNeh"]h$]h&]jRjS)jThuh1jhjRhMChj9hhubjV)}(hhh]h)}(hsleep waiting for signalsh]hsleep waiting for signals}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMChjhhubah}(h]h ]h"]h$]h&]uh1jUhj9hhhjRhMCubeh}(h]h ](jrfunctioneh"]h$]h&]jwjrjxjjyjjzj{j|uh1jhhhj)hNhNubj~)}(hX**Parameters** ``unsigned int msecs`` Requested sleep duration in milliseconds **Description** See msleep() for some basic information. The difference between msleep() and msleep_interruptible() is that the sleep could be interrupted by a signal delivery and then returns early. **Return** The remaining time of the sleep duration transformed to msecs (see schedule_timeout() for details).h](h)}(h**Parameters**h]j)}(hj!h]h Parameters}(hj#hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMGhjubj)}(hhh]j)}(h@``unsigned int msecs`` Requested sleep duration in milliseconds h](j)}(h``unsigned int msecs``h]j)}(hj@h]hunsigned int msecs}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1jhj>ubah}(h]h ]h"]h$]h&]uh1jhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMDhj:ubj)}(hhh]h)}(h(Requested sleep duration in millisecondsh]h(Requested sleep duration in milliseconds}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjUhMDhjVubah}(h]h ]h"]h$]h&]uh1jhj:ubeh}(h]h ]h"]h$]h&]uh1jhjUhMDhj7ubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hj{h]h Description}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjyubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMFhjubh)}(h(See msleep() for some basic information.h]h(See msleep() for some basic information.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMEhjubh)}(hThe difference between msleep() and msleep_interruptible() is that the sleep could be interrupted by a signal delivery and then returns early.h]hThe difference between msleep() and msleep_interruptible() is that the sleep could be interrupted by a signal delivery and then returns early.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMGhjubh)}(h **Return**h]j)}(hjh]hReturn}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMJhjubh)}(hcThe remaining time of the sleep duration transformed to msecs (see schedule_timeout() for details).h]hcThe remaining time of the sleep duration transformed to msecs (see schedule_timeout() for details).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhi/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:117: ./kernel/time/sleep_timeout.chMKhjubeh}(h]h ] kernelindentah"]h$]h&]uh1j}hj)hhhNhNubj)}(hhh]h}(h]h ]h"]h$]h&]entries](jssleep (C function)c.ssleephNtauh1j~hj)hhhNhNubj)}(hhh](j)}(h"void ssleep (unsigned int seconds)h]j)}(h!void ssleep(unsigned int seconds)h](j)}(hvoidh]hvoid}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhK`ubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhjhK`ubj)}(hssleeph]j)}(hssleeph]hssleep}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubah}(h]h ](jjeh"]h$]h&]hhuh1jhjhhhjhK`ubj)}(h(unsigned int seconds)h]j)}(hunsigned int secondsh](j)}(hunsignedh]hunsigned}(hj3hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj/ubj)}(h h]h }(hjAhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj/ubj)}(hinth]hint}(hjOhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj/ubj)}(h h]h }(hj]hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj/ubj)}(hsecondsh]hseconds}(hjkhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj/ubeh}(h]h ]h"]h$]h&]noemphhhuh1jhj+ubah}(h]h ]h"]h$]h&]hhuh1jhjhhhjhK`ubeh}(h]h ]h"]h$]h&]hhjGuh1jjHjIhjhhhjhK`ubah}(h]jah ](jMjNeh"]h$]h&]jRjS)jThuh1jhjhK`hjhhubjV)}(hhh]h)}(h!wrapper for seconds around msleeph]h!wrapper for seconds around msleep}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhK`hjhhubah}(h]h ]h"]h$]h&]uh1jUhjhhhjhK`ubeh}(h]h ](jrfunctioneh"]h$]h&]jwjrjxjjyjjzj{j|uh1jhhhj)hNhNubj~)}(h**Parameters** ``unsigned int seconds`` Requested sleep duration in seconds **Description** Please refer to msleep() for detailed information.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKdhjubj)}(hhh]j)}(h=``unsigned int seconds`` Requested sleep duration in seconds h](j)}(h``unsigned int seconds``h]j)}(hjh]hunsigned int seconds}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKahjubj)}(hhh]h)}(h#Requested sleep duration in secondsh]h#Requested sleep duration in seconds}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKahjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhKahjubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKchjubh)}(h2Please refer to msleep() for detailed information.h]h2Please refer to msleep() for detailed information.}(hj'hhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKbhjubeh}(h]h ] kernelindentah"]h$]h&]uh1j}hj)hhhNhNubj)}(hhh]h}(h]h ]h"]h$]h&]entries](jfsleep (C function)c.fsleephNtauh1j~hj)hhhNhNubj)}(hhh](j)}(h!void fsleep (unsigned long usecs)h]j)}(h void fsleep(unsigned long usecs)h](j)}(hvoidh]hvoid}(hjVhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjRhhhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKnubj)}(h h]h }(hjehhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjRhhhjdhKnubj)}(hfsleeph]j)}(hfsleeph]hfsleep}(hjwhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjsubah}(h]h ](jjeh"]h$]h&]hhuh1jhjRhhhjdhKnubj)}(h(unsigned long usecs)h]j)}(hunsigned long usecsh](j)}(hunsignedh]hunsigned}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(hlongh]hlong}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(husecsh]husecs}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]noemphhhuh1jhjubah}(h]h ]h"]h$]h&]hhuh1jhjRhhhjdhKnubeh}(h]h ]h"]h$]h&]hhjGuh1jjHjIhjNhhhjdhKnubah}(h]jIah ](jMjNeh"]h$]h&]jRjS)jThuh1jhjdhKnhjKhhubjV)}(hhh]h)}(h3flexible sleep which autoselects the best mechanismh]h3flexible sleep which autoselects the best mechanism}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKnhjhhubah}(h]h ]h"]h$]h&]uh1jUhjKhhhjdhKnubeh}(h]h ](jrfunctioneh"]h$]h&]jwjrjxj jyj jzj{j|uh1jhhhj)hNhNubj~)}(hX**Parameters** ``unsigned long usecs`` requested sleep duration in microseconds **Description** flseep() selects the best mechanism that will provide maximum 25% slack to the requested sleep duration. Therefore it uses: * udelay() loop for sleep durations <= 10 microseconds to avoid hrtimer overhead for really short sleep durations. * usleep_range() for sleep durations which would lead with the usage of msleep() to a slack larger than 25%. This depends on the granularity of jiffies. * msleep() for all other sleep durations. **Note** When ``CONFIG_HIGH_RES_TIMERS`` is not set, all sleeps are processed with the granularity of jiffies and the slack might exceed 25% especially for short sleep durations.h](h)}(h**Parameters**h]j)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKrhjubj)}(hhh]j)}(hA``unsigned long usecs`` requested sleep duration in microseconds h](j)}(h``unsigned long usecs``h]j)}(hj6h]hunsigned long usecs}(hj8hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj4ubah}(h]h ]h"]h$]h&]uh1jhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKohj0ubj)}(hhh]h)}(h(requested sleep duration in microsecondsh]h(requested sleep duration in microseconds}(hjOhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjKhKohjLubah}(h]h ]h"]h$]h&]uh1jhj0ubeh}(h]h ]h"]h$]h&]uh1jhjKhKohj-ubah}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hjqh]h Description}(hjshhhNhNubah}(h]h ]h"]h$]h&]uh1jhjoubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKqhjubh)}(h{flseep() selects the best mechanism that will provide maximum 25% slack to the requested sleep duration. Therefore it uses:h]h{flseep() selects the best mechanism that will provide maximum 25% slack to the requested sleep duration. Therefore it uses:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKphjubj)}(hhh](jq)}(hpudelay() loop for sleep durations <= 10 microseconds to avoid hrtimer overhead for really short sleep durations.h]h)}(hpudelay() loop for sleep durations <= 10 microseconds to avoid hrtimer overhead for really short sleep durations.h]hpudelay() loop for sleep durations <= 10 microseconds to avoid hrtimer overhead for really short sleep durations.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKshjubah}(h]h ]h"]h$]h&]uh1jphjubjq)}(husleep_range() for sleep durations which would lead with the usage of msleep() to a slack larger than 25%. This depends on the granularity of jiffies.h]h)}(husleep_range() for sleep durations which would lead with the usage of msleep() to a slack larger than 25%. This depends on the granularity of jiffies.h]husleep_range() for sleep durations which would lead with the usage of msleep() to a slack larger than 25%. This depends on the granularity of jiffies.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKuhjubah}(h]h ]h"]h$]h&]uh1jphjubjq)}(h(msleep() for all other sleep durations. h]h)}(h'msleep() for all other sleep durations.h]h'msleep() for all other sleep durations.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKxhjubah}(h]h ]h"]h$]h&]uh1jphjubeh}(h]h ]h"]h$]h&]jjuh1jhjhKshjubh)}(h**Note**h]j)}(hjh]hNote}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhKzhjubh)}(hWhen ``CONFIG_HIGH_RES_TIMERS`` is not set, all sleeps are processed with the granularity of jiffies and the slack might exceed 25% especially for short sleep durations.h](hWhen }(hjhhhNhNubj)}(h``CONFIG_HIGH_RES_TIMERS``h]hCONFIG_HIGH_RES_TIMERS}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh is not set, all sleeps are processed with the granularity of jiffies and the slack might exceed 25% especially for short sleep durations.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhc/var/lib/git/docbuild/linux/Documentation/timers/delay_sleep_functions:120: ./include/linux/delay.hhK{hjubeh}(h]h ] kernelindentah"]h$]h&]uh1j}hj)hhhNhNubeh}(h]sleepah ]h"]*sleep()ah$]h&]uh1hhj@ hhhhhKsubeh}(h]*usleep-range-and-sleep-family-of-functionsah ]h"]0usleep_range*() and *sleep() family of functionsah$]h&]uh1hhhhhhhhKRubeh}(h]delay-and-sleep-mechanismsah ]h"]delay and sleep mechanismsah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksjMfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjderror_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehnj _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j?j<j= j: j7j4j&j#j/j,u nametypes}(j?j= j7j&j/uh}(j<hj: jCjjjjj) j. j4j@ j#j j j j j jjj,j)jOjTj7j<jjjIjNu footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.